Skip to content

Commit

Permalink
Use ceil instead of cld for floats, pass Ints to div
Browse files Browse the repository at this point in the history
  • Loading branch information
Sagnac committed Sep 22, 2024
1 parent 0a3e2f1 commit 8393d83
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/WavefrontError.jl
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ end
# synthesis function
function Λ(ΔW::WavefrontError; finesse::Int)
(; recap, v, n_max) = ΔW
finesse::Int = finesse 1:100 ? finesse : cld(100, length(recap))
finesse = finesse 1:100 ? finesse : ceil(Int, 100 / length(recap))
ρ, θ = polar(n_max, n_max; finesse)
# construct the estimated wavefront error
w = ΔW.(ρ', θ)
Expand Down
4 changes: 2 additions & 2 deletions src/Zernike.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function polar_mat(ρ, θ)
end

# radial order
get_n(j::Int)::Int = cld(-3 + (9 + 8j), 2)
get_n(j::Int) = ceil(Int, (-3 + (9 + 8j)) / 2)
# azimuthal frequency
get_m(j::Int, n::Int) = 2j - (n + 2)n
# ISO / ANSI / OSA standard single mode-ordering index
Expand Down Expand Up @@ -172,7 +172,7 @@ function fringe_to_j(fringe::Int)
if fringe == 37
return get_j(0, 12)
end
d = trunc((fringe - 1)) + 1
d = trunc(Int, (fringe - 1)) + 1
d2 = d^2 - fringe
m::Int = (d2 + 1) ÷ 2
m = flipsign(m, isodd(d2) ? -1 : 1)
Expand Down

0 comments on commit 8393d83

Please sign in to comment.