pyoptics.propagators

Propagators for electromagnetic fields.

The following propagators are available:

  • rayleigh_sommerfeld_I_IR()

  • rayleigh_sommerfeld_I_TF()

  • rayleigh_sommerfeld_I_TF_planes(): the same to many distances at once

  • fresnel_TF()

  • fresnel_IR()

  • fresnel_rescaling()

  • fraunhofer()

  • rayleigh_sommerfeld_I_DI()

Propagators onto a free output window (center, extent and sampling chosen independently of the input grid, evaluated with chirp-z transforms, see fft.czt()):

  • shifted_angular_spectrum(): exact (Rayleigh-Sommerfeld) propagation to an off-axis or rescaled window, band limited after Matsushima (2010)

  • fresnel_scaled(): Fresnel integral (single transform) on any window

  • fraunhofer_scaled(): Fraunhofer integral on any window

  • far_field(): far field amplitude in chosen directions

Propagation onto tilted planes (implemented in pyoptics.tilted, re-exported here):

  • tilted_plane(): scalar field on a plane with a rotated normal, or from a tilted plane to a parallel one

  • vectorial_tilted_plane(): the same for vector fields, in the plane’s axes

Fields with strongly curved wavefronts (behind lenses, near foci and point sources) are propagated with few samples by pyoptics.analytic_phase, which keeps the quadratic phase analytic (semi-analytical and homeomorphic Fourier transforms after Wyrowski and coworkers), also onto tilted planes.

Vectorial propagation (fields of shape (Ny, Nx, 2) or (Ny, Nx, 3) with the components [E_x, E_y(, E_z)]):

  • vectorial_rayleigh_sommerfeld_TF(): exact angular spectrum propagation

  • propagate_vectorial(): any of the scalar propagators for E_x, E_y, plus E_z

  • vectorial_mansuripur(): Mansuripur’s high NA (aplanatic lens) diffraction

  • longitudinal_component(): E_z from E_x and E_y (div E = 0)

The routines with _TF in their name use a transfer function approach, whereas the routines whose names end in _IR use formulations with using the impulse response. Mathematically, those approaches are identical; however, they may differ in their sampling properties.

The propagators share a common interface:

propagated_field, x, y = propagator_func(field, x_prime, y_prime, z, wavelength),

but individual propagators may accept further arguments.

The input grid must have x = 0 and y = 0 at index N//2 (FFT convention, e.g. utils.grid1d(-L/2, L/2, N) for even N, dx*(np.arange(N) - N//2) for any N; see pyoptics.fft); the impulse response based propagators, fresnel_rescaling() and fraunhofer() raise a ValueError otherwise.

FFT based convolutions are cyclic. Use propagate_padded() to zero pad the field if it spreads beyond the computational window, and band_limit=True in rayleigh_sommerfeld_I_TF() for large propagation distances.

Convention: fields vary as exp(i(k.r - omega*t)), the time dependence exp(-i*omega*t) being implicit. Propagation by z > 0 thus multiplies a plane wave by exp(+i*k_z*z), the Green’s function is exp(+i*k*r)/r and evanescent waves decay as exp(-|k_z|*z). FT() (kernel exp(-i*k_x*x)) yields the amplitudes of the plane waves exp(+i*(k_x*x + k_y*y)), inv_FT() sums them up. Negative z propagates backwards; the angular spectrum propagators then drop evanescent waves, which backward propagation would amplify exponentially. In rayleigh_sommerfeld_I_TF(), absorbing media can be described by a complex n = n’ + i*kappa with kappa > 0.

References

    1. Goodman, “Introduction to Fourier Optics”, 4th ed., W. H. Freeman (2017).

F. Shen and A. Wang, “Fast-Fourier-transform based numerical integration method for the Rayleigh-Sommerfeld diffraction formula”, Appl. Opt. 45, 1102-1110 (2006).

K. Matsushima and T. Shimobaba, “Band-limited angular spectrum method for numerical simulation of free-space propagation in far and near fields”, Opt. Express 17, 19662-19673 (2009).

K. Matsushima, “Shifted angular spectrum method for off-axis numerical propagation”, Opt. Express 18, 18453-18463 (2010).

B. Richards and E. Wolf, “Electromagnetic diffraction in optical systems II. Structure of the image field in an aplanatic system”, Proc. R. Soc. Lond. A 253, 358-379 (1959).

M. Mansuripur, “Certain computational aspects of vector diffraction problems”, J. Opt. Soc. Am. A 6, 786-805 (1989), erratum J. Opt. Soc. Am. A 10, 382 (1993).

Functions

aplanatic_rotation

Polarization rotation of a ray bent into the direction (sigma_x, sigma_y, sigma_z) by an aplanatic lens.

far_field

Far field amplitude of a field in chosen directions.

fraunhofer

Compute the Fraunhofer integral (farfield approximation) using FFTs.

fraunhofer_scaled

Fraunhofer integral on a free output window.

fresnel_IR

Compute the Fresnel difraction integral using FFTs.

fresnel_TF

Compute the Fresnel diffraction integral using FFTs.

fresnel_number

Return Fresnel number for diffraction of circular or annular apertures.

fresnel_rescaling

Compute the Fresnel integral (paraxial approximation) on a rescaled coordinate grid.

fresnel_scaled

Fresnel diffraction integral on a free output window.

longitudinal_component

Return E_z of a field from its transverse components E_x, E_y.

propagate_padded

Call propagator on a zero padded field and crop the result.

propagate_vectorial

Propagate a vector field with any of the scalar propagators.

rayleigh_sommerfeld_I_DI

Implement the Rayleigh-Sommerfeld direct integration method of Shen and Wang.

rayleigh_sommerfeld_I_IR

Compute the Rayleigh-Sommerfeld integral of first kind using FFTs.

rayleigh_sommerfeld_I_TF

Compute the Rayleigh-Sommerfeld integral of first kind using FFTs.

rayleigh_sommerfeld_I_TF_planes

rayleigh_sommerfeld_I_TF() of one field to many distances.

shifted_angular_spectrum

Angular spectrum propagation onto a shifted (and rescaled) window.

suggest_N_critical

Suggest number of samples N for "critical sampling" -- for this number of samples, both the impulse response and the transfer function for the Fresnel propagator are well sampled.

suggest_lateral_sampling

Suggest number of samples N such that all propagating frequencies are covered.

vectorial_fresnel

Deprecated alias of vectorial_mansuripur().

vectorial_mansuripur

Mansuripur's vectorial diffraction: each plane wave of the angular spectrum of a (paraxially described) field is given the polarization of a ray bent by an aplanatic lens.

vectorial_rayleigh_sommerfeld_TF

Propagate a vector field with the angular spectrum method.

z_from_fresnel_number

Inverse of fresnel_number() for a collimated beam and a circular aperture.

pyoptics.propagators.propagate_padded(propagator, field, x_prime, y_prime, z, wavelength, n=1.0, pad_factor=2, **kwargs)[source]

Call propagator on a zero padded field and crop the result.

FFT based convolutions are cyclic: light leaving the computational window on one side reenters on the other. Zero padding enlarges the window to pad_factor times its size and thereby suppresses this wrap-around.

Parameters:
propagatorcallable

One of the propagators that keep the grid (rayleigh_sommerfeld_I_TF, rayleigh_sommerfeld_I_IR, rayleigh_sommerfeld_I_DI, fresnel_TF, fresnel_IR) or of the vectorial ones (vectorial_rayleigh_sommerfeld_TF, vectorial_mansuripur). Vector fields of shape (Ny, Nx, 2) or (Ny, Nx, 3) are padded componentwise; the vectorial propagators compute E_z in the padded window.

field, x_prime, y_prime, z, wavelength, n

As for the propagator.

pad_factornumber, optional

Size of the padded window relative to the original one.

kwargs

Passed on to propagator.

Returns:
field_propagatedarray
x, yarrays

Coordinates (the same as given).

pyoptics.propagators.suggest_N_critical(L, z, wl)[source]

Suggest number of samples N for “critical sampling” – for this number of samples, both the impulse response and the transfer function for the Fresnel propagator are well sampled.

Parameters:
Lnumber

Sampling box side length.

znumber

Propagation distance.

wlnumber

Wavelength.

Returns:
N_critinteger
pyoptics.propagators.rayleigh_sommerfeld_I_IR(field, x_prime, y_prime, z, wavelength, n=1.0)[source]

Compute the Rayleigh-Sommerfeld integral of first kind using FFTs. The convolution with Green’s function is performed in k-space, with the Green’s function being explicitly taken to k-space by FFT.

Parameters:
fieldarray
x_prime, y_primearrays

Linear or 2d arrays in the initial plane.

znumber

Propagation distance in the same units as x_prime, y_prime and wavelength.

wavelengthnumber
nnumber, optional
Returns:
field_propagatedarray
x, yarrays

Coordinates (2d) in final plane.

pyoptics.propagators.rayleigh_sommerfeld_I_TF(field, x_prime, y_prime, z, wavelength, n=1.0, band_limit=False)[source]

Compute the Rayleigh-Sommerfeld integral of first kind using FFTs. The convolution with Green’s function is performed in k-space, with the Green’s function being analytically transformed to k-space.

Parameters:
fieldarray
x_prime, y_primearrays

Linear or 2d arrays in the initial plane.

znumber

Propagation distance in the same units as x_prime, y_prime and wavelength. For z < 0 (backwards), evanescent waves are dropped.

wavelengthnumber
nnumber, optional
band_limitboolean, optional

If True, remove the frequencies for which the transfer function is undersampled (band-limited angular spectrum method of Matsushima and Shimobaba, Opt. Express 17, 19662 (2009)). This avoids aliasing for large z; combine with propagate_padded() as in the paper.

Returns:
field_propagatedarray
x, yarrays

Coordinates (2d) in final plane.

pyoptics.propagators.rayleigh_sommerfeld_I_TF_planes(field, x_prime, y_prime, zs, wavelength, n=1.0, band_limit=False, max_bytes=268435456)[source]

rayleigh_sommerfeld_I_TF() of one field to many distances.

The spectrum of the field and k_z are computed once; the inverse transforms of the planes run in batches (one multi-threaded FFT call per batch). Use it for caustics, through-focus series and refocusing scans.

Parameters:
fieldarray

Scalar field (Ny, Nx).

x_prime, y_primearrays

Linear or 2d arrays in the initial plane.

zs1d array

Propagation distances (negative ones propagate backwards, without the evanescent waves, as in rayleigh_sommerfeld_I_TF()).

wavelengthnumber
nnumber, optional
band_limitboolean, optional

See rayleigh_sommerfeld_I_TF() (applied per distance).

max_bytesint, optional

Memory for the planes of one batch.

Returns:
fieldsarray

Propagated fields, shape (len(zs), Ny, Nx).

x, yarrays

Coordinates in the final planes (the same as given).

pyoptics.propagators.rayleigh_sommerfeld_I_DI(field, x_prime, y_prime, z, wavelength, n=1.0, use_simpson=True)[source]

Implement the Rayleigh-Sommerfeld direct integration method of Shen and Wang.

This method expressed a numerical integration of the Rayleigh-Sommerfeld diffraction formula using Simpon’s rule as a convolution product which can be computed by means of FFTs.

Parameters:
fieldarray
x_prime, y_primearrays

Linear or 2d arrays in the initial plane.

znumber

Propagation distance in the same units as x_prime, y_prime and wavelength.

wavelengthnumber
nnumber, optional
use_simpsonboolean, optional

If True (default), use a Simpson integration; if False, use a midpoint rule.

Returns:
field_propagatedarray
x, yarrays

Coordinates (2d) in final plane.

pyoptics.propagators.fresnel_IR(field, x_prime, y_prime, z, wavelength, n=1.0)[source]

Compute the Fresnel difraction integral using FFTs. The convolution with Green’s function is performed in k-space, with the Green’s function being explicitly taken to k-space by FFT.

Parameters:
fieldarray
x_prime, y_primearrays

Linear or 2d arrays in the initial plane.

znumber

Propagation distance in the same units as x_prime, y_prime and wavelength.

wavelengthnumber
nnumber, optional
Returns:
field_propagatedarray
x, yarrays

Coordinates (2d) in final plane.

pyoptics.propagators.fresnel_TF(field, x_prime, y_prime, z, wavelength, n=1.0)[source]

Compute the Fresnel diffraction integral using FFTs. The convolution with the Fresnel Green’s function is performed in k-space, with the Green’s function being analytically transformed to k-space.

Parameters:
fieldarray
x_prime, y_primearrays

Linear or 2d arrays in the initial plane.

znumber

Propagation distance in the same units as x_prime, y_prime and wavelength.

wavelengthnumber
nnumber, optional
Returns:
field_propagatedarray
x, yarrays

Coordinates (2d) in final plane.

pyoptics.propagators.fresnel_rescaling(field, x_prime, y_prime, z, wavelength, n=1.0)[source]

Compute the Fresnel integral (paraxial approximation) on a rescaled coordinate grid.

Parameters:
fieldarray
x_prime, y_primearrays

Linear or 2d arrays in the initial plane.

znumber

Propagation distance in the same units as x_prime, y_prime and wavelength.

wavelengthnumber
nnumber, optional
Returns:
field_propagatedarray
x, yarrays

Coordinates (2d) in final plane.

pyoptics.propagators.fraunhofer(field, x_prime, y_prime, z, wavelength, n=1.0)[source]

Compute the Fraunhofer integral (farfield approximation) using FFTs.

Parameters:
fieldarray
x_prime, y_primearrays

Linear or 2d arrays in the initial plane.

znumber

Propagation distance in the same units as x_prime, y_prime and wavelength.

wavelengthnumber
nnumber, optional
Returns:
field_propagatedarray
x, yarrays

Coordinates (2d) in final plane.

pyoptics.propagators.shifted_angular_spectrum(field, x_prime, y_prime, z, wavelength, x_out, y_out, n=1.0, band_limit=True, pad_factor='auto')[source]

Angular spectrum propagation onto a shifted (and rescaled) window.

Evaluates the exact solution of the Helmholtz equation (as rayleigh_sommerfeld_I_TF())

U(x, y, z) = 1/(Nx*Ny) sum_mn A[m, n]*exp(i*(k_x*x + k_y*y + k_z*z))

with the plane wave amplitudes A of the field in the initial plane, at the points of an output window x_out, y_out that may lie anywhere (e.g. off-axis, beside the input window) and may have a sampling of its own. The sum is evaluated with chirp-z transforms (fft.zoom_inv_FT()).

The discrete spectrum describes a periodic continuation of the input field. To keep the replicas out of the output window, the input is zero padded to a window of at least the size of input plus output window, and (band_limit=True) only plane waves that travel from the input window into the output window are kept: a plane wave with the wavevector (k_x, k_y, k_z) moves laterally by z*k_x/k_z, which must lie between min(x_out) - max(x_prime) and max(x_out) - min(x_prime) (the same for y). This also guarantees that the transfer function is sampled finely enough (Matsushima’s shifted angular spectrum method; for an output window equal to the input window it is the band limit of rayleigh_sommerfeld_I_TF(band_limit=True)). Evanescent waves are dropped if band_limit is True.

The band shrinks with the distance: the spectral spacing 2*pi/L_pad (L_pad: padded window) must resolve it. A warning is issued if fewer than four plane waves are kept along x or y; increase pad_factor then, or use fresnel_scaled() or far_field(), which have no such limit (in the Fresnel and far field regime).

Parameters:
fieldarray
x_prime, y_primearrays

Linear or 2d equidistant coordinates of the field. They need not be centered.

znumber

Propagation distance (negative z propagates backwards).

wavelengthnumber

Vacuum wavelength.

x_out, y_outarrays

Linear or 2d equidistant coordinates of the output window.

nnumber, optional

Refractive index.

band_limitboolean, optional

Apply the band limit described above (default). Without it, light that leaves the output window may reenter from the periodic replicas.

pad_factor“auto” or number, optional

Size of the padded input window relative to the input window. “auto” (default) pads to at least input plus output window in x and y. Use 1 to switch padding off.

Returns:
field_propagatedarray

Field of shape (len(y_out), len(x_out)).

x_out, y_outarrays

The output coordinates as given.

References

K. Matsushima, “Shifted angular spectrum method for off-axis numerical propagation,” Opt. Express 18, 18453-18463 (2010) K. Matsushima and T. Shimobaba, “Band-limited angular spectrum method for numerical simulation of free-space propagation in far and near fields,” Opt. Express 17, 19662-19673 (2009)

pyoptics.propagators.fresnel_scaled(field, x_prime, y_prime, z, wavelength, x_out, y_out, n=1.0)[source]

Fresnel diffraction integral on a free output window.

Evaluates the single transform form of the Fresnel integral

U(x, y) = exp(i*k*z)/(i*wavelength*z)*exp(i*k*(x**2 + y**2)/(2*z))
          * sum U'(x', y')*exp(i*k*(x'**2 + y'**2)/(2*z))
                       *exp(-i*k*(x*x' + y*y')/z)*dx'*dy'

with chirp-z transforms (fft.zoom_FT()), on any equidistant output grid. In contrast to fresnel_rescaling() (output spacing wavelength*z/L), the output spacing, center and number of samples are free; e.g. the focus of a lens can be sampled finely without padding.

The sum is exact for the sampled input, so the result does not suffer from wrap-around. It is accurate as long as the input chirp exp(i*k*r'**2/(2z)) times the field is sampled well; a warning is issued if the chirp alone is undersampled at the edge of the input window (|z| < 2*max|x'|*dx/wavelength) or if the output window exceeds the period wavelength*z/dx of the result (it then contains replicas). For short distances use shifted_angular_spectrum().

Parameters:
fieldarray
x_prime, y_primearrays

Linear or 2d equidistant coordinates of the field. They need not be centered: the phases refer to x’ = y’ = 0.

znumber

Propagation distance (z != 0, negative z propagates backwards).

wavelengthnumber

Vacuum wavelength.

x_out, y_outarrays

Linear or 2d equidistant output coordinates.

nnumber, optional

Refractive index.

Returns:
field_propagatedarray

Field of shape (len(y_out), len(x_out)).

x_out, y_outarrays

The output coordinates as given.

Notes

With x_out, y_out the output grid of fresnel_rescaling(), the results of both agree.

pyoptics.propagators.fraunhofer_scaled(field, x_prime, y_prime, z, wavelength, x_out, y_out, n=1.0)[source]

Fraunhofer integral on a free output window.

As fresnel_scaled(), but without the input chirp (far field approximation, Fresnel number of the input much smaller than one). With x_out, y_out the output grid of fraunhofer(), both agree.

Parameters:
fieldarray
x_prime, y_primearrays

Linear or 2d equidistant coordinates of the field; the phases refer to x’ = y’ = 0.

znumber

Propagation distance (z != 0).

wavelengthnumber

Vacuum wavelength.

x_out, y_outarrays

Linear or 2d equidistant output coordinates.

nnumber, optional

Refractive index.

Returns:
field_propagatedarray

Field of shape (len(y_out), len(x_out)).

x_out, y_outarrays

The output coordinates as given.

pyoptics.propagators.far_field(field, x_prime, y_prime, wavelength, sigma_x, sigma_y, n=1.0)[source]

Far field amplitude of a field in chosen directions.

For r -> infinity in the direction of the unit vector s = (sigma_x, sigma_y, sigma_z), the Rayleigh-Sommerfeld (first kind) field of the input plane becomes

U(r*s) = f(s)*exp(i*k*r)/r,
f(s) = k*sigma_z/(2*pi*i) * sum U'(x', y')*exp(-i*k*(sigma_x*x' + sigma_y*y'))*dx'*dy'

(stationary phase evaluation of the angular spectrum; exact in this limit, no paraxial approximation). f is evaluated on an equidistant grid of direction cosines with chirp-z transforms, so the angular range and resolution are free (e.g. a fine grid over one diffraction order). Directions with sigma_x**2 + sigma_y**2 > 1 get f = 0.

Parameters:
fieldarray
x_prime, y_primearrays

Linear or 2d equidistant coordinates of the field; the phase of f refers to x’ = y’ = 0.

wavelengthnumber

Vacuum wavelength.

sigma_x, sigma_yarrays

Linear, equidistant direction cosines, sigma_x = sin(theta_x) for a direction in the x-z plane at the angle theta_x to the z axis (inside the medium of index n).

nnumber, optional

Refractive index.

Returns:
farray

Far field amplitude of shape (len(sigma_y), len(sigma_x)); |f|**2 is the radiant intensity (power per solid angle up to the medium’s impedance factor).

sigma_x, sigma_yarrays

The directions as given.

pyoptics.propagators.longitudinal_component(E_x, E_y, x, y, wavelength, n=1.0)[source]

Return E_z of a field from its transverse components E_x, E_y.

Uses div(E) = 0 in a homogeneous, charge-free medium: for every plane wave of the angular spectrum k.E = 0, hence E_z(k) = -(k_x*E_x(k) + k_y*E_y(k))/k_z. Evanescent waves (imaginary k_z) are included.

The factor 1/k_z diverges for grazing waves (|k_perp| -> k). The singularity is integrable, but a frequency sample that happens to lie very close to the circle |k_perp| = k would get an arbitrarily large weight. |k_z| is therefore bounded from below by sqrt(k*dk) (dk: the smaller frequency spacing of the grid), which is the order of magnitude of the mean of 1/k_z over one frequency cell at the circle. Only samples within about dk/2 of the circle are affected.

Parameters:
E_x, E_yarrays

Transverse field components sampled on x, y.

x, yarrays

Linear or 2d coordinates, centered as pyoptics.fft expects.

wavelengthnumber

Vacuum wavelength.

nnumber, optional

Refractive index.

Returns:
E_zarray
pyoptics.propagators.vectorial_rayleigh_sommerfeld_TF(field, x_prime, y_prime, z, wavelength, n=1.0, band_limit=False)[source]

Propagate a vector field with the angular spectrum method.

This is the vectorial counterpart of rayleigh_sommerfeld_I_TF() and an exact solution of Maxwell’s equations in a homogeneous, charge-free medium: E_x and E_y are propagated like scalar fields, E_z is computed in the final plane from div(E) = 0 (see longitudinal_component()). The angular spectrum is the vectorial Rayleigh-Sommerfeld solution for given transverse fields in the initial plane.

Parameters:
fieldarray

Vector field of shape (Ny, Nx, 2) ([E_x, E_y]) or (Ny, Nx, 3) ([E_x, E_y, E_z]); a given E_z is ignored as it follows from E_x and E_y.

x_prime, y_primearrays

Linear or 2d arrays in the initial plane.

znumber

Propagation distance in the same units as x_prime, y_prime and wavelength.

wavelengthnumber
nnumber, optional
band_limitboolean, optional

See rayleigh_sommerfeld_I_TF().

Returns:
field_propagatedarray

Field [E_x, E_y, E_z] of shape (Ny, Nx, 3).

x, yarrays

Coordinates in final plane (the same as given).

Notes

Use propagate_padded() to suppress the wrap-around of cyclic convolutions; it accepts vector fields.

pyoptics.propagators.propagate_vectorial(propagator, field, x_prime, y_prime, z, wavelength, n=1.0, **kwargs)[source]

Propagate a vector field with any of the scalar propagators.

E_x and E_y are propagated independently by the scalar propagator, which is exact for rayleigh_sommerfeld_I_TF() and an approximation of the same order as the scalar propagator otherwise. E_z is computed in the final plane:

  • for propagators that keep the grid from div(E) = 0 with longitudinal_component(),

  • for fraunhofer() and fresnel_rescaling() from the transversality of the far field, E.r = 0, i.e. E_z = -(x*E_x + y*E_y)/z.

Parameters:
propagatorcallable

A scalar propagator of this module.

fieldarray

Vector field of shape (Ny, Nx, 2) or (Ny, Nx, 3) (a given E_z is ignored).

x_prime, y_prime, z, wavelength, n

As for the propagator.

kwargs

Passed on to propagator.

Returns:
field_propagatedarray

Field [E_x, E_y, E_z] of shape (Ny, Nx, 3).

x, yarrays

Coordinates in final plane.

pyoptics.propagators.aplanatic_rotation(sigma_x, sigma_y)[source]

Polarization rotation of a ray bent into the direction (sigma_x, sigma_y, sigma_z) by an aplanatic lens.

A ray parallel to the optical axis with transverse polarization [p_x, p_y] leaves an aplanatic lens (or any system obeying the sine condition) in the direction s = (sigma_x, sigma_y, sigma_z), sigma_z = sqrt(1 - sigma_x**2 - sigma_y**2). Its field is rotated about the axis z x s, i.e. the s component (perpendicular to the meridional plane) is kept and the p component is tilted along with the ray (Mansuripur’s “psi” factors):

E = R @ [p_x, p_y],
R = [[1 - sigma_x**2/(1 + sigma_z), -sigma_x*sigma_y/(1 + sigma_z)],
     [-sigma_x*sigma_y/(1 + sigma_z), 1 - sigma_y**2/(1 + sigma_z)],
     [-sigma_x, -sigma_y]].

R has orthonormal columns that are perpendicular to s.

Parameters:
sigma_x, sigma_ynumbers or arrays

Direction cosines of the ray; sigma_x**2 + sigma_y**2 <= 1.

Returns:
Rarray

Matrix of shape (3, 2) + np.shape(sigma_x).

pyoptics.propagators.vectorial_mansuripur(field, x_prime, y_prime, z, wavelength, n=1.0)[source]

Mansuripur’s vectorial diffraction: each plane wave of the angular spectrum of a (paraxially described) field is given the polarization of a ray bent by an aplanatic lens.

The angular spectrum T(sigma_x, sigma_y) of the transverse input field [E_x, E_y] is interpreted as the field in the exit pupil of an aplanatic lens: the pupil point that belongs to the direction sigma = k_perp/k is turned into a plane wave whose polarization is aplanatic_rotation() of [T_x, T_y], weighted by 1/sqrt(sigma_z). The weight conserves energy: the power flowing through every plane z = const equals the power of the input field (sum of |E_x|**2 + |E_y|**2 on the grid). The plane waves are then propagated exactly to z.

For a field whose spectrum is a pupil function, e.g. field = inv_FT(P) with P(sigma_x, sigma_y) the pupil, the result is the focus of an aplanatic high NA lens (Richards-Wolf theory) at the distance z from the focal plane. In the paraxial limit (small sigma) it reduces to scalar propagation of E_x and E_y. The transverse components at z = 0 do not equal the input field for non-paraxial spectra: the input is not the field in a physical plane, but the scalar (“paraxial”) representative of the vector field. Use vectorial_rayleigh_sommerfeld_TF() to propagate a field given in a physical plane.

Only propagating waves (sigma_x**2 + sigma_y**2 < 1) are kept; a lens does not produce evanescent waves.

Parameters:
fieldarray

Input field of shape (Ny, Nx, 2); the last index holds the x and y polarization components.

x_prime, y_primearrays

Linear or 2d coordinates, centered as pyoptics.fft expects.

znumber

Distance from the focal plane.

wavelengthnumber
nnumber, optional

Refractive index of the image space; sigma = k_perp/(k_0*n).

Returns:
field_propagatedarray

Field [E_x, E_y, E_z] of shape (Ny, Nx, 3).

x, yarrays

Coordinates (the same as given).

References

M. Mansuripur, “Certain computational aspects of vector diffraction problems,” J. Opt. Soc. Am. A 6, 786-805 (1989), erratum J. Opt. Soc. Am. A 10, 382 (1993) B. Richards and E. Wolf, “Electromagnetic diffraction in optical systems II,” Proc. R. Soc. Lond. A 253, 358-379 (1959)

pyoptics.propagators.vectorial_fresnel(field, x_prime, y_prime, z, wavelength, n=1.0)[source]

Deprecated alias of vectorial_mansuripur().

The name was misleading: the function does not use the Fresnel approximation.

Parameters:
fieldarray
x_prime, y_primearrays
znumber
wavelengthnumber
nnumber, optional

See vectorial_mansuripur().

Returns:
tuple

The return values of vectorial_mansuripur().

pyoptics.propagators.fresnel_number(outer_aperture_diameter, z, wavelength, wavefront_curvature=None, inner_aperture_diameter_factor=0.0)[source]

Return Fresnel number for diffraction of circular or annular apertures.

Parameters:
outer_aperture_diameternumber

Diameter of outer boundary of aperture.

znumber

Propagation distance

wavelengthnumber

Wavelength (in same units as propgation distance z)

wavefront_curvaturenumber

Curvature of wavefront in the aperture. Use 1/f for a wavefront that (geometrically) focusses at distance f along the optical axis. Defaults to None, which is interpreted as infinite curvature, i.e. a collimated wavefront.

inner_aperture_diameter_factornumber, optional

Factor defining the annulus’ inner diameter as inner_aperture_diameter_factor*outer_aperture_diameter. Defaults to 0, i.e. a circular aperture.

Returns:
Fnumber

Fresnel number, i.e. number of half-wave zones of the aperture as seen from the on-axis point at distance z: F = a**2*(1 - eps**2)/wavelength*|1/z - c| with a the outer radius, eps the inner diameter factor and c the wavefront curvature.

pyoptics.propagators.z_from_fresnel_number(F, aperture_diameter, wavelength)[source]

Inverse of fresnel_number() for a collimated beam and a circular aperture.

Parameters:
Fnumber

Fresnel number.

aperture_diameternumber

Diameter of the aperture.

wavelengthnumber

Wavelength (same unit as the diameter).

Returns:
znumber

Propagation distance (aperture_diameter/2)**2/(wavelength*F).

pyoptics.propagators.suggest_lateral_sampling(L, n, wl)[source]

Suggest number of samples N such that all propagating frequencies are covered.

Parameters:
Ldouble or array_like

Lateral extent of one or dimensions.

ndouble

Refractive index.

wldouble

Wavelength (in same units as L).

Returns:
Nint or tuple

Suggested number of samples.