Skip to content

Commit

Permalink
Define separate methods for the three public coefficient functions
Browse files Browse the repository at this point in the history
This specifies things more clearly, although now the names are kinda
long, but that's not really a big deal as these functions aren't meant
to be used frequently and this avoids confusion; if they are to be used
they will probably be used in an automated fashion.

What this also does is instead of just creating aliases these distinct
functions now directly access the desired quantities.
  • Loading branch information
Sagnac committed May 12, 2024
1 parent f9e0f01 commit df97558
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,6 @@ For the `standardize` subset method the tuples in `orders` must be of the form `

* If you're interested in only the full vector of Zernike expansion coefficients obtained through the least squares fit and want to avoid computing extra values and plotting the results you can call:
```julia
Zernike.reconstruct(ρ, θ, OPD, n_max)[1]
Zernike.wavefront_coefficients(ρ, θ, OPD, n_max)
```
Similarly you can do this for the radial polynomial coefficients and the NA transformed wavefront error expansion coefficients by importing the functions `coefficients` and `transform_coefficients`, respectively.
Similarly you can do this for the radial polynomial coefficients and the NA transformed wavefront error expansion coefficients by importing the functions `radial_coefficients` and `transform_coefficients`, respectively.
8 changes: 5 additions & 3 deletions src/Zernike.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export zernike, wavefront, transform, Z, W, P, WavefrontError,
noll_to_j, fringe_to_j, standardize, standardize!,
Observable, plotconfig, zplot

# public metrics, coefficients, transform_coefficients, reconstruct, scale, J
# public radial_coefficients, wavefront_coefficients, transform_coefficients,
# metrics, scale, J

using GLMakie
import .Makie: latexstring, LaTeXString
Expand Down Expand Up @@ -309,7 +310,8 @@ Z(j::Int) = Z(get_mn(j)...)
const piston = Z(0, 0)

# aliases for the API namespace
const coefficients = Φ
const transform_coefficients = S
radial_coefficients(x...) = Φ(x...)[end]
wavefront_coefficents(x...) = reconstruct(x...)[1]
transform_coefficients(x...) = S(x...)[1]

end
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function compare_coefficients(j_max)
end
i = j + 1
zλ[i] = Z(m, n).R.λ
Φλ[i] = Zernike.coefficients(μ, n)[end]
Φλ[i] = Zernike.radial_coefficients(μ, n)[end]
end
m_max, n_max = last(mn)
λ = Φ(m_max, n_max)
Expand Down

0 comments on commit df97558

Please sign in to comment.