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.VectorPSFsModule
module VectorPSFs

The 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.

source
VectorPSFs.NVCenterType
NVCenter

A 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)
source
VectorPSFs.NVCenterMethod
NVCenter(λ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.

source
VectorPSFs.NVCenterMethod
NVCenter(λ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).

source
VectorPSFs.ObjectiveType
Objective

A microscope objective characterized by:

  • f::Float64: focal length (µm)
  • NA::Float64: numerical aperture
  • n::Float64: refractive index of immersion medium (e.g., 1.0 for air)
source
VectorPSFs.PSFModeType
abstract type PSFMode

Abstract type for dispatching different PSF modes (e.g. NoAberration, NormalIncidence, TiltedIncidence).

source
VectorPSFs.PSFParamsType
mutable struct PSFParams{M<:PSFMode}

Holds parameters for a certain PSF mode M.

  • λ::Float64: wavelength in µm
  • obj::Objective: the objective
  • plate: either a PlaneParallelPlate or nothing
  • α::Float64: tilt angle (radians)
source
VectorPSFs.PSFParamsMethod
PSFParams(λ::Float64, obj::Objective, plate::PlaneParallelPlate, α::Float64)

Construct a PSFParams{TiltedIncidence}, i.e. tilted incidence with plate. α in radians.

source
VectorPSFs.PSFParamsMethod
PSFParams(λ::Float64, obj::Objective, plate::PlaneParallelPlate)

Construct a PSFParams{NormalIncidence}, i.e. normal incidence with plate.

source
VectorPSFs.PSFParamsMethod
PSFParams(λ::Float64, obj::Objective)

Construct a PSFParams{NoAberration}, i.e. no plate, no tilt.

source
VectorPSFs.PlaneParallelPlateType
PlaneParallelPlate

A 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.

source
VectorPSFs.CustomPlateMethod
CustomPlate(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.

source
VectorPSFs.DiamondMethod
Diamond(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.

source
VectorPSFs.FusedSilicaMethod
FusedSilica(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.

source
VectorPSFs.M10xMethod
M10x()

Returns an Objective resembling the Newport M10x:

  • f=16500 µm
  • NA=0.25
  • n=1.0 (air)
source
VectorPSFs.MagnesiumFluorideMethod
MagnesiumFluoride(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.

source
VectorPSFs.PSFMethod
PSF(x, y, z, λ, NA; rtol=1e-3, atol=1e-4)

Aberration-free PSF with no objective structure, using air (n=1).

  • λ in µm
  • NA numeric aperture
  • (x, y, z) in µm
  • rtol, atol tolerances
source
VectorPSFs.PSFMethod
PSF(x, y, z, λ, NA::Float64, plate::PlaneParallelPlate, α; ...)

Tilted incidence with no explicit Objective.

source
VectorPSFs.PSFMethod
PSF(x, y, z, λ, NA::Float64, plate::PlaneParallelPlate; ...)

Normal incidence with a plane-parallel plate, no explicit Objective.

source
VectorPSFs.PSFMethod
PSF(x, y, z, λ, obj::Objective, plate::PlaneParallelPlate, α; ...)

Tilted incidence with plane + objective.

source
VectorPSFs.PSFMethod
PSF(x, y, z, λ, obj::Objective, plate::PlaneParallelPlate; ...)

Normal incidence with a plane-parallel plate and an explicit Objective.

source
VectorPSFs.PSFMethod
PSF(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.

source
VectorPSFs.PSFMethod
PSF(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.

source
VectorPSFs.PSFMethod
PSF(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.

source
VectorPSFs.PSFMethod
PSF(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 µm
  • obj is an Objective
  • nv::NVCenter is the NV spectrum data
  • rtol, atol are integration tolerances
source
VectorPSFs.PSFMethod
PSF(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).

source
VectorPSFs.PSFMethod
PSF(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).

source
VectorPSFs.PSFMethod
PSF(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).

source
VectorPSFs.SapphireMethod
Sapphire(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.

source
VectorPSFs.UPLXAPO100XMethod
UPLXAPO100X()

Returns an Objective resembling the Olympus UPLXAPO100X:

  • f=1800 µm
  • NA=1.45
  • n=1.515 (oil immersion)
source
VectorPSFs.maxtol_thickFunction
maxtol_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)^2

and minimize with a 1D search. Returns the thickness that best satisfies S ≈ 0.8.

source
VectorPSFs.maxtol_thickMethod
maxtol_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)^2
source
VectorPSFs.psf_innerMethod
psf_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, v are phase parameters relating to off-axis, defocus, etc.
  • s is the normalized aperture.
  • n is the refractive index (1.0 or immersion).
  • rtol, atol are integration tolerances.
source
VectorPSFs.psf_innerMethod
psf_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.

  • k is the wave number (2πn_obj / λ).
  • t is plate thickness in µm.
  • n_a is the plate’s refractive index (possibly scaled by immersion factor).
source
VectorPSFs.psf_innerMethod
psf_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).
  • k is wave number (2π n_imm / λ).
  • n_a is plate index scaled if needed.
  • Other parameters as before.
source
VectorPSFs.sellmeierMethod
sellmeier(λ, B, C)

Generic Sellmeier equation:

n^2 = 1 + ∑( Bᵢ * λ² / (λ² - Cᵢ) )
  • λ in micrometers (µm).
  • B/C are matching-length vectors of Sellmeier coefficients.

Returns the refractive index n(λ).

source
VectorPSFs.strehlFunction
strehl(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 µm
  • obj is the objective (e.g. MPlanApo50x())
  • plate is a constructor function for a PlaneParallelPlate (defaults to Diamond).
  • zrange in µm is the defocus search range: the function does a 1D optimization to find the best focus.
  • rtol, atol are 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 µm
source
VectorPSFs.strehlFunction
strehl(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.

source
VectorPSFs.strehlMethod
strehl(t, λ, obj::Objective, z_est::Float64, plate::Function, α::Float64; rtol=1e-10, atol=1e-10)

Same as above, but with incidence angle α (tilt).

source
VectorPSFs.strehlMethod
strehl(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).

source
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.

source
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.

source
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, v are defocus/piston terms in the exponent.
  • s is the normalized aperture (NA).
  • n is the refractive index (often 1.0 for air or obj.n for immersion).
source
VectorPSFs.ΦMethod
Φ(sρ, ϕ, n, α)

Computes the aberration phase for tilted incidence.

  • : 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.

source
VectorPSFs.ΦMethod
Φ(sρ, n)

Computes the aberration phase for normal incidence.

  • : the product of normalized aperture s and 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.

source
VectorPSFs.ξxMethod
ξx(ρ, ϕ, ψ, u, v, k, s, n, n_a, t)

x-polarized integrand with normal-incidence plate.

source
VectorPSFs.ξxMethod
ξx(ρ, ϕ, ψ, u, v, k, s, α, n, n_a, t)

x-polarized integrand with tilted-incidence plate.

source
VectorPSFs.ξxMethod
ξx(ρ, ϕ, Ξ, s)

x-polarized integrand for the aberration-free PSF integral.

  • ρ, ϕ are pupil-plane coordinates.
  • Ξ is the accumulated phase from Ξ(...).
  • s is the normalized aperture.

Returns the complex field contribution in the x-direction.

source
VectorPSFs.ξyMethod
ξy(ρ, ϕ, ψ, u, v, k, s, n, n_a, t)

y-polarized integrand with normal-incidence plate.

source
VectorPSFs.ξyMethod
ξy(ρ, ϕ, ψ, u, v, k, s, α, n, n_a, t)

y-polarized integrand with tilted-incidence plate.

source
VectorPSFs.ξyMethod
ξy(ρ, ϕ, Ξ, s)

y-polarized integrand for the aberration-free PSF integral. Similar arguments as ξx(...).

source
VectorPSFs.ξzMethod
ξz(ρ, ϕ, ψ, u, v, k, s, n, n_a, t)

z-polarized integrand with normal-incidence plate.

source
VectorPSFs.ξzMethod
ξz(ρ, ϕ, ψ, u, v, k, s, α, n, n_a, t)

z-polarized integrand with tilted-incidence plate.

source
VectorPSFs.ξzMethod
ξz(ρ, ϕ, Ξ, s)

z-polarized integrand for the aberration-free PSF integral. Similar arguments as ξx(...).

source
VectorPSFs.NVspectrumModule
module NVspectrum

NV center spectrum.

  • The wavelength array is given in micrometers (µm).
  • The spectrum array holds corresponding intensities (arbitrary units).
  • nv_spectrum_spline is a smoothing spline fit of spectrum vs. wavelength.

You can access the raw data via NVspectrum.wavelength and NVspectrum.spectrum, or use nv_spectrum_spline for continuous interpolation.

source
VectorPSFs.NVspectrum.nv_spectrum_splineConstant
nv_spectrum_spline

A 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.

source