optics.propagators

Free-space propagator classes.

Functions

fft(x[, output_shape, axes, norm])

Compute the N-dimensional discrete Fourier Transform

ifft(x[, output_shape, axes, norm])

Compute the N-dimensional inverse discrete Fourier transform

Classes

FraunhoferPropagator()

FresnelPropagator(input_shape, dx, wavelength, z)

Free space Fresnel wave propagator

Propagator(input_shape, dx, wavelength, z)

Free space wave propagator

class optics.propagators.Propagator(input_shape, dx, wavelength, z)[source]

Bases: object

Free space wave propagator

Propagates a planar source field, \(U(x, y, 0)\) a distance \(z\), computed via the exact transfer function given by (Eq. 5-4, [1])

\[U(x, y, z) = \mathcal{F}^{-1} \left( \mathcal{F}(U(x,y,0)) \times e^{j 2 \pi z / \lambda \sqrt{1 - (\lambda f_x)^2 - (\lambda f_x)^2}} \right) \;,\]

where the \(\mathcal{F}\) is the Fourier transform, implemented by numpy.fft.fftn().

Parameters:
  • input_shape (Sequence[int]) – Shape of input array.

  • dx (Sequence[float]) – Sampling interval at source plane, \((\Delta x, \Delta y)\).

  • wavelength (float) – Illumination wavelength, \(\lambda\).

  • z (float) – Propagation distance, \(z\).

class optics.propagators.FresnelPropagator(input_shape, dx, wavelength, z)[source]

Bases: Propagator

Free space Fresnel wave propagator

Propagates a planar source field, \(U(x, y, 0)\) a distance \(z\), computed via the Fresnel transfer function given by (Eq. 5-3, [1])

\[U(x, y, z) = \mathcal{F}^{-1} \left( \mathcal{F} (U(x,y,0)) \times \, e^{j2\pi z / \lambda} \times e^{-j\pi \lambda z (f_x^2 + f_y^2)} \right) \;,\]

where the \(\mathcal{F}\) is the Fourier transform, implemented by numpy.fft.fftn().

Parameters:
  • input_shape (Sequence[int]) – Shape of input array.

  • dx (Sequence[float]) – Sampling interval at source plane, \((\Delta x, \Delta y)\).

  • wavelength (float) – Illumination wavelength, \(\lambda\).

  • z (float) – Propagation distance, \(z\).

optics.propagators.fft(x, output_shape=None, axes=None, norm='ortho')[source]

Compute the N-dimensional discrete Fourier Transform

Parameters:
  • x (ndarray) – Input array

  • output_shape (Optional[Sequence[int]]) – Shape of output array. Defaults to input shape.

  • axes (Optional[Sequence[int]]) – Axes over which to compute the FFT. Defaults to all axes.

  • norm (Optional[str]) – Method of normalizing FFT. Either “backward”, “ortho”, “forward”. Defaults to “ortho”.

Return type:

ndarray

Returns:

out – Output array

optics.propagators.ifft(x, output_shape=None, axes=None, norm='ortho')[source]

Compute the N-dimensional inverse discrete Fourier transform

Parameters:
  • x (ndarray) – Input array

  • output_shape (Optional[Sequence[int]]) – Shape of output array. Defaults to input shape.

  • axes (Optional[Sequence[int]]) – Axes over which to compute the FFT. Defaults to all axes.

  • norm (Optional[str]) – Method of normalizing FFT. Either “backward”, “ortho”, “forward”. Defaults to “ortho”.

Return type:

ndarray

Returns:

out – Output array