psf_generator.propagators.scalar_spherical_propagator#

The propagator for scalar field in Spherical coordinates.

Classes#

ScalarSphericalPropagator

Propagator for the scalar approximation of the Richard's-Wolf integral in spherical parameterization.

Module Contents#

class psf_generator.propagators.scalar_spherical_propagator.ScalarSphericalPropagator(n_pix_pupil=128, n_pix_psf=128, device='cpu', zernike_coefficients=None, custom_field=None, wavelength=632, na=1.3, pix_size=10, defocus_step=0, n_defocus=1, apod_factor=False, envelope=None, cos_factor=False, gibson_lanni=False, z_p=1000.0, n_s=1.3, n_g=1.5, n_g0=1.5, t_g=170000.0, t_g0=170000.0, n_i=1.5, n_i0=1.5, t_i0=100000.0, integrator=simpsons_rule)[source]#

Bases: psf_generator.propagators.spherical_propagator.SphericalPropagator

Propagator for the scalar approximation of the Richard’s-Wolf integral in spherical parameterization.

The equation to compute the eletric field is

\[E(\boldsymbol{\rho}) = -\mathrm{i}fk \int_0^{\theta_{\max}} d\theta \mathrm{e}_{\infty}(\theta) J_0(k \rho \sin \theta) \mathrm{e}^{\mathrm{i} kz\cos\theta} \sin\theta,\]

where \(J_0\) is the Bessel function of first kind and order 0.

classmethod get_name() str[source]#
initialize_input_field() torch.Tensor[source]#

Define a (1D) radial pupil function as the input field.

Notes#

This function is defined on the interval \(\rho \in [0,1]\); \(\rho\) is a “normalized” radius. The conversion to physical pupil coordinates - the polar angle \(\theta\) - is given by

\[\rho = \frac{\sin{\theta}}{\sin{\theta_{\max}}},\]

such that the physical domain is

\[\theta \leq \theta_{\max}.\]
compute_focus_field() torch.Tensor[source]#

Compute the focus field for scalar spherical propagator.

Parameters#

self.thetastorch.Tensor

Angles of sampling of shape (n_thetas, ).

self.rstorch.Tensor

Radii of sampling of shape (n_radii, ).

self.correction_factortorch.Tensor

Correction factor of shape (n_thetas, ).

J0torch.Tensor

Bessel function of the first kind of order 0 \(J_0\). Shape: (n_theta, n_radii).

Returns#

field: torch.Tensor

Output field.

Notes#

This involves expensive evaluations of Bessel functions. We compute it independently of defocus and handle defocus via batching with vmap().

_compute_psf_at_defocus(defocus_term, J0: torch.Tensor, pupil: torch.Tensor, sin_t: torch.Tensor) torch.Tensor[source]#

Compute PSF at defocus.

Parameters#

defocus_term:

Factor in the integrand corresponding to defocus.

J0: torch.Tensor

Bessel function of the first kind of order 0 \(J_0\).

pupil: torch.Tensor

Pupil function.

sin_t: torch.Tensor

Factor in the integrand of shape: (n_thetas, ).

Returns#

field: torch.Tensor

Output field at defocus. Shape: (n_channels=1, size_x, size_y).

Notes#

We first compute E(r)–integrand for a list of unique radii values, then scatter the radial evaluations of E(r) onto the xy image grid.