API Reference
Below is a reference for VectorPSFs.jl. To see the source code or additional details, visit the corresponding file references (e.g., psf_core.jl, plane_parallel_plates.jl, objectives.jl, etc.).
Module Index
VectorPSFs.VectorPSFs — Modulemodule VectorPSFsThe primary module for computing vector PSFs (point spread functions) with or without aberrations caused by plane-parallel plates. Also supports NV-center weighted PSFs, Strehl ratio calculations, and lens objectives.
VectorPSFs.NVCenter — TypeNVCenterA struct for storing an NV emission spectrum, specifying:
λs::Vector{Float64}: the sampling wavelengths in micrometers (µm)weight::Vector{Float64}: weighting (normalized spectral intensity)
Example usage:
# Construct from an existing array of wavelengths & weights
center = NVCenter([0.632, 0.64, 0.65], [0.3, 0.5, 0.2])
# Or use the fitted NV default (pulling from `nv_spectrum_spline`):
center2 = NVCenter(0.5:0.01:0.7)VectorPSFs.NVCenter — MethodNVCenter(λs::Real, weight::Real)Constructor that takes arrays of wavelengths λs and weights weight (must be same length). Converts them to Float64 and returns a new NVCenter.
VectorPSFs.NVCenter — MethodNVCenter(λs::Vector{Float64})Constructor that uses the global NV spectrum spline (nv_spectrum_spline) to obtain weights for the given array of wavelengths λs. Weights are normalized (so their sum is 1).
VectorPSFs.NoAberration — Typestruct NoAberration <: PSFMode endNo plate, no tilt scenario.
VectorPSFs.NormalIncidence — Typestruct NormalIncidence <: PSFMode endNormal incidence with a plate scenario.
VectorPSFs.Objective — TypeObjectiveA microscope objective characterized by:
f::Float64: focal length (µm)NA::Float64: numerical aperturen::Float64: refractive index of immersion medium (e.g., 1.0 for air)
VectorPSFs.PSFMode — Typeabstract type PSFModeAbstract type for dispatching different PSF modes (e.g. NoAberration, NormalIncidence, TiltedIncidence).
VectorPSFs.PSFParams — Typemutable struct PSFParams{M<:PSFMode}Holds parameters for a certain PSF mode M.
λ::Float64: wavelength in µmobj::Objective: the objectiveplate: either aPlaneParallelPlateornothingα::Float64: tilt angle (radians)
VectorPSFs.PSFParams — MethodPSFParams(λ::Float64, obj::Objective, plate::PlaneParallelPlate, α::Float64)Construct a PSFParams{TiltedIncidence}, i.e. tilted incidence with plate. α in radians.
VectorPSFs.PSFParams — MethodPSFParams(λ::Float64, obj::Objective, plate::PlaneParallelPlate)Construct a PSFParams{NormalIncidence}, i.e. normal incidence with plate.
VectorPSFs.PSFParams — MethodPSFParams(λ::Float64, obj::Objective)Construct a PSFParams{NoAberration}, i.e. no plate, no tilt.
VectorPSFs.PlaneParallelPlate — TypePlaneParallelPlateA PlaneParallelPlate has thickness t (in micrometers) and a refractive index function n_λ(λ), where λ is in micrometers. The field n_λ returns the refractive index at that wavelength.
VectorPSFs.TiltedIncidence — Typestruct TiltedIncidence <: PSFMode endTilted incidence with a plate scenario.
VectorPSFs.BorosilicateCrown — MethodBorosilicateCrown(t)Creates a PlaneParallelPlate of thickness t (µm) for BK7 (borosilicate crown glass). Uses the Schott Sellmeier coefficients:
B = [1.040, 0.230, 1.010]
C = [0.006, 0.020, 103.560]Source: refractiveindex.info BK7 page.
VectorPSFs.CustomPlate — MethodCustomPlate(t, B, C)Create a PlaneParallelPlate of thickness t (µm), with a refractive index defined by the Sellmeier coefficients B and C, where
n^2 = 1 + ∑( Bᵢ * λ² / (λ² - Cᵢ) )(λ in micrometers). B and C must be the same length.
VectorPSFs.Diamond — MethodDiamond(t)Approximate dispersion for diamond with thickness t (in µm). λ is assumed in micrometers (µm), but the formula internally converts λ to nm by multiplying by 1e3 for the Sellmeier-like expression.
VectorPSFs.FusedSilica — MethodFusedSilica(t)Creates a PlaneParallelPlate of thickness t (µm) for Fused Silica (SiO₂), using the Malitson Sellmeier coefficients:
B = [0.6961663, 0.4079426, 0.8974794]
C = [0.0684043^2, 0.1162414^2, 9.896161^2]Source: Malitson data.
VectorPSFs.LMPLFLN100XBD — MethodLMPLFLN100XBD()Returns an Objective resembling the Olympus LMPLFLN 100x BD:
f=1800µmNA=0.8n=1.0(air)
VectorPSFs.M10x — MethodM10x()Returns an Objective resembling the Newport M10x:
f=16500µmNA=0.25n=1.0(air)
VectorPSFs.MPlanApo100x — MethodMPlanApo100x()Returns an Objective resembling the Mitsutoyo MPlanApo 100x:
f=2000µmNA=0.7n=1.0(air)
VectorPSFs.MPlanApo50x — MethodMPlanApo50x()Returns an Objective resembling the Mitsutoyo MPlanApo 50x:
f=4000µmNA=0.55n=1.0(air)
VectorPSFs.MagnesiumFluoride — MethodMagnesiumFluoride(t)Creates a PlaneParallelPlate of thickness t (µm) for MgF₂ using the ordinary-ray Sellmeier coefficients (Li):
B = [0.48755108, 0.39875031, 2.3120353]
C = [0.04338408^2, 0.09461442^2, 23.793604^2]Source: MgF₂ (Li) data.
VectorPSFs.PSF — MethodPSF(x, y, z, λ, NA; rtol=1e-3, atol=1e-4)Aberration-free PSF with no objective structure, using air (n=1).
λin µmNAnumeric aperture(x, y, z)in µmrtol,atoltolerances
VectorPSFs.PSF — MethodPSF(x, y, z, λ, NA::Float64, plate::PlaneParallelPlate, α; ...)Tilted incidence with no explicit Objective.
VectorPSFs.PSF — MethodPSF(x, y, z, λ, NA::Float64, plate::PlaneParallelPlate; ...)Normal incidence with a plane-parallel plate, no explicit Objective.
VectorPSFs.PSF — MethodPSF(x, y, z, λ, obj::Objective, plate::PlaneParallelPlate, α; ...)Tilted incidence with plane + objective.
VectorPSFs.PSF — MethodPSF(x, y, z, λ, obj::Objective, plate::PlaneParallelPlate; ...)Normal incidence with a plane-parallel plate and an explicit Objective.
VectorPSFs.PSF — MethodPSF(x, y, z, λ, obj::Objective; rtol=1e-3, atol=1e-4)Aberration-free PSF with an Objective specifying immersion index, NA, etc. No plate, normal incidence in air or immersion.
VectorPSFs.PSF — MethodPSF(x, y, z, obj::Objective, nv::NVCenter, plate::PlaneParallelPlate, α::Float64; rtol=1e-3, atol=1e-4)Compute a polychromatic PSF for NV emission with a tilted-incidence plate. Again, integrates over nv.λs and sums with nv.weight.
VectorPSFs.PSF — MethodPSF(x, y, z, obj::Objective, nv::NVCenter, plate::PlaneParallelPlate; rtol=1e-3, atol=1e-4)Compute a polychromatic PSF for NV emission with a normal-incidence plate. Broadcasts over nv.λs, calling single-wavelength PSF(...) for each λ, then weights with nv.weight.
VectorPSFs.PSF — MethodPSF(x, y, z, obj::Objective, nv::NVCenter; rtol=1e-3, atol=1e-4)Compute a polychromatic PSF for an NV center (no plate scenario). Integrates over all wavelengths in nv.λs, calling the single-wavelength PSF(...) for each λ and weighting by nv.weight.
(x, y, z)in µmobjis anObjectivenv::NVCenteris the NV spectrum datartol, atolare integration tolerances
VectorPSFs.PSF — MethodPSF(x, y, z, param::PSFParams{NoAberration}; rtol=1e-3, atol=1e-4)Dispatch for the no-aberration case (NoAberration). Calls PSF(x, y, z, λ, obj; rtol, atol).
VectorPSFs.PSF — MethodPSF(x, y, z, param::PSFParams{NormalIncidence}; rtol=1e-3, atol=1e-4)Dispatch for normal incidence with a plate. Calls PSF(x, y, z, λ, obj, plate; rtol, atol).
VectorPSFs.PSF — MethodPSF(x, y, z, param::PSFParams{TiltedIncidence}; rtol=1e-3, atol=1e-4)Dispatch for tilted incidence with a plate. Calls PSF(x, y, z, λ, obj, plate, α; rtol, atol).
VectorPSFs.Sapphire — MethodSapphire(t)Creates a PlaneParallelPlate of thickness t (µm) for sapphire (Al₂O₃), using the ordinary-ray Sellmeier coefficients (Li):
B = [1.4313493, 0.65054713, 5.3414021]
C = [0.0726631^2, 0.1193242^2, 18.028251^2]Source: Sapphire (Li) data.
VectorPSFs.UPLXAPO100X — MethodUPLXAPO100X()Returns an Objective resembling the Olympus UPLXAPO100X:
f=1800µmNA=1.45n=1.515(oil immersion)
VectorPSFs.maxtol_thick — Functionmaxtol_thick(λ::Float64, obj::Objective; plate=Diamond, t_range=(0.0, 500.0), zrange=[-2.0,4.0], ...)Find thickness t in t_range that yields a Strehl ratio near 0.8. No tilt is assumed. We define:
cost(t) = (strehl(t, λ, obj, plate; zrange=zrange) - 0.8)^2and minimize with a 1D search. Returns the thickness that best satisfies S ≈ 0.8.
VectorPSFs.maxtol_thick — Methodmaxtol_thick(λ::Float64, obj::Objective, plate::Function, α::Float64; t_range=(0.0, 500.0), zrange=[-2.0,4.0], ...)Same as above, but for tilted incidence angle α.
cost(t) = (strehl(t, λ, obj, plate, α; zrange=zrange) - 0.8)^2VectorPSFs.psf_inner — Methodpsf_inner(ψ, u, v, s, n; rtol=1e-3, atol=1e-4)Computes the aberration-free PSF intensity by numerically integrating the x-, y-, and z-polarized integrands via hcubature.
ψ, u, vare phase parameters relating to off-axis, defocus, etc.sis the normalized aperture.nis the refractive index (1.0 or immersion).rtol,atolare integration tolerances.
VectorPSFs.psf_inner — Methodpsf_inner(ψ, u, v, k, s, n, n_a, t; rtol=1e-3, atol=1e-4)Compute the PSF with normal incidence on a plane-parallel plate via hcubature.
kis the wave number (2πn_obj / λ).tis plate thickness in µm.n_ais the plate’s refractive index (possibly scaled by immersion factor).
VectorPSFs.psf_inner — Methodpsf_inner(ψ, u, v, k, s, α, n, n_a, t; rtol=1e-3, atol=1e-4)Compute the PSF with tilted incidence on a plane-parallel plate via hcubature.
αis the tilt angle (radians).kis wave number (2π n_imm / λ).n_ais plate index scaled if needed.- Other parameters as before.
VectorPSFs.sellmeier — Methodsellmeier(λ, B, C)Generic Sellmeier equation:
n^2 = 1 + ∑( Bᵢ * λ² / (λ² - Cᵢ) )λin micrometers (µm).B/Care matching-length vectors of Sellmeier coefficients.
Returns the refractive index n(λ).
VectorPSFs.strehl — Functionstrehl(t, λ, obj::Objective, plate::Function=Diamond;
zrange=[-2.0, 4.0], rtol=1e-10, atol=1e-10)Compute the Strehl ratio when a plate of thickness t (µm) is placed in the optical path.
λis wavelength in µmobjis the objective (e.g.MPlanApo50x())plateis a constructor function for aPlaneParallelPlate(defaults toDiamond).zrangein µm is the defocus search range: the function does a 1D optimization to find the best focus.rtol,atolare integration tolerances for the PSF.
Returns the maximum on-axis intensity (aberrated) normalized by the unaberrated case. Example:
S = strehl(50.0, 0.7, MPlanApo100x()) # diamond thickness=50 µm, λ=0.7 µmVectorPSFs.strehl — Functionstrehl(t, λ, obj::Objective, z_est::Float64, plate::Function=Diamond; rtol=1e-10, atol=1e-10)Compute the on-axis Strehl ratio for a plate thickness t (µm) at a specified defocus z_est (µm). No tilt assumed.
VectorPSFs.strehl — Methodstrehl(t, λ, obj::Objective, z_est::Float64, plate::Function, α::Float64; rtol=1e-10, atol=1e-10)Same as above, but with incidence angle α (tilt).
VectorPSFs.strehl — Methodstrehl(t, λ, obj::Objective, plate::Function, α::Float64;
zrange=[-2.0, 4.0], rtol=1e-10, atol=1e-10)Compute the Strehl ratio for a plate of thickness t (µm), wavelength λ (µm), Objective obj, and tilt angle α (radians). The search for best defocus is done in zrange (µm).
VectorPSFs.Ξ — MethodΞ(ρ, ϕ, ψ, u, v, k, s, n, n_a, t)Phase term for normal incidence with a plane-parallel plate. Adds the plate-induced phase k * t * Φ(...) to the aberration-free phase.
VectorPSFs.Ξ — MethodΞ(ρ, ϕ, ψ, u, v, k, s, α, n, n_a, t)Phase term for tilted incidence with a plane-parallel plate. Adds the tilt-based phase Φ(..., α) plus the base aberration-free term.
VectorPSFs.Ξ — MethodΞ(ρ, ϕ, ψ, u, v, s, n)Computes the phase term for the aberration-free case.
ρ, ϕare polar coordinates in the pupil.ψis an azimuthal shift (e.g. relating to off-axis propagation).u, vare defocus/piston terms in the exponent.sis the normalized aperture (NA).nis the refractive index (often 1.0 for air orobj.nfor immersion).
VectorPSFs.Φ — MethodΦ(sρ, ϕ, n, α)Computes the aberration phase for tilted incidence.
sρ: again,s * ρ.ϕ: azimuthal angle in the pupil plane.n: refractive index.α: tilt angle (radians).
Returns a phase shift accounting for tilt plus the normal-incidence phase.
VectorPSFs.Φ — MethodΦ(sρ, n)Computes the aberration phase for normal incidence.
sρ: the product of normalized aperturesand radial coordinateρin the pupil plane.n: refractive index (e.g., 1.0 for air or the immersion index).
Returns a dimensionless phase shift due to the optical path difference.
VectorPSFs.ξx — Methodξx(ρ, ϕ, ψ, u, v, k, s, n, n_a, t)x-polarized integrand with normal-incidence plate.
VectorPSFs.ξx — Methodξx(ρ, ϕ, ψ, u, v, k, s, α, n, n_a, t)x-polarized integrand with tilted-incidence plate.
VectorPSFs.ξx — Methodξx(ρ, ϕ, Ξ, s)x-polarized integrand for the aberration-free PSF integral.
ρ, ϕare pupil-plane coordinates.Ξis the accumulated phase fromΞ(...).sis the normalized aperture.
Returns the complex field contribution in the x-direction.
VectorPSFs.ξy — Methodξy(ρ, ϕ, ψ, u, v, k, s, n, n_a, t)y-polarized integrand with normal-incidence plate.
VectorPSFs.ξy — Methodξy(ρ, ϕ, ψ, u, v, k, s, α, n, n_a, t)y-polarized integrand with tilted-incidence plate.
VectorPSFs.ξy — Methodξy(ρ, ϕ, Ξ, s)y-polarized integrand for the aberration-free PSF integral. Similar arguments as ξx(...).
VectorPSFs.ξz — Methodξz(ρ, ϕ, ψ, u, v, k, s, n, n_a, t)z-polarized integrand with normal-incidence plate.
VectorPSFs.ξz — Methodξz(ρ, ϕ, ψ, u, v, k, s, α, n, n_a, t)z-polarized integrand with tilted-incidence plate.
VectorPSFs.ξz — Methodξz(ρ, ϕ, Ξ, s)z-polarized integrand for the aberration-free PSF integral. Similar arguments as ξx(...).
VectorPSFs.NVspectrum — Modulemodule NVspectrumNV center spectrum.
- The
wavelengtharray is given in micrometers (µm). - The
spectrumarray holds corresponding intensities (arbitrary units). nv_spectrum_splineis a smoothing spline fit ofspectrumvs.wavelength.
You can access the raw data via NVspectrum.wavelength and NVspectrum.spectrum, or use nv_spectrum_spline for continuous interpolation.
VectorPSFs.NVspectrum.nv_spectrum_spline — Constantnv_spectrum_splineA smoothing spline fit (SmoothingSplines.SmoothingSpline) constructed from wavelength and spectrum, using a smoothing parameter of 250.0. This allows continuous interpolation/extrapolation of the NV emission data.
VectorPSFs.NVspectrum.spectrum — ConstantspectrumA constant array of raw intensities (arbitrary units) for each entry in wavelength.
VectorPSFs.NVspectrum.wavelength — ConstantwavelengthA constant array of NV emission wavelengths (in µm).