pyoptics.analytical

Analytical solutions for testing.

References

M. Born and E. Wolf, “Principles of Optics”, 7th ed., Cambridge University Press (1999).

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

V. N. Mahajan, “Optical Imaging and Aberrations, Part II: Wave Diffraction Optics”, 2nd ed., SPIE Press (2011).

Functions

airy_encircled_energy

Fraction of the energy of the Airy pattern inside a circle.

airy_pattern

Intensity PSF of an aberration-free imaging system with a circular pupil (Airy pattern) in scalar paraxial theory.

circular_otf

Diffraction limited optical transfer function (OTF) of an incoherent imaging system with a circular pupil.

cylinder_coefficients

Scattering coefficients of a circular dielectric cylinder for the scalar Helmholtz equation (TE polarization: E parallel to the cylinder axis).

cylinder_field

Exact total field of a circular dielectric cylinder (axis along y, centred at x = z = 0) illuminated by plane waves travelling towards +z, TE polarization (scalar Helmholtz equation).

mahajan_on_axis_intensity

On-axis intensity for light diffracted by an annular aperture.

sphere_coefficients

Scattering coefficients of a dielectric sphere for the scalar Helmholtz equation (a scalar analogue of Mie theory).

sphere_field

Exact solution of the scalar Helmholtz equation for a dielectric sphere (centred at the origin) illuminated by an axially symmetric field travelling towards +z.

pyoptics.analytical.mahajan_on_axis_intensity(a, epsilon, I0, wavelength, z, R=None)[source]

On-axis intensity for light diffracted by an annular aperture.

Parameters:
a, epsilonnumbers

Outer and inner anulus radii defined by a and epsilon*a respecticvely.

I0
wavelengthnumber
znumber

Axial distance from apeture.

Rnumber, optional

Radius defining curvature 1/R of wavefront in aperture. Defaults to None, which is interpreted as the infite curvature of a collimated beam. R is the distance of geometric focus from the center of the aperture.

Returns:
I_znumber

On axis intensity at distance z from aperture.

Notes

Mahajan’s results are obtained using scalar Rayleigh-Sommerfeld diffraction theory.

TODO: Mahajan paper citation

pyoptics.analytical.airy_pattern(r, NA, wavelength)[source]

Intensity PSF of an aberration-free imaging system with a circular pupil (Airy pattern) in scalar paraxial theory.

Parameters:
rnumber or array

Distance from the optical axis in the image plane.

NAnumber

Image-side numerical aperture.

wavelengthnumber

Wavelength in the image space medium (vacuum wavelength if NA already includes the refractive index).

Returns:
Inumber or array

(2*J_1(v)/v)**2 with v = 2*pi*NA*r/wavelength, normalized to I(0) = 1. The first zero lies at r = 0.61*wavelength/NA.

pyoptics.analytical.airy_encircled_energy(r, NA, wavelength)[source]

Fraction of the energy of the Airy pattern inside a circle.

Rayleigh’s formula 1 - J_0(v)**2 - J_1(v)**2, v = 2*pi*NA*r/wavelength.

Parameters:
rnumber or array

Radius of the circle.

NAnumber

Numerical aperture.

wavelengthnumber

Wavelength.

Returns:
fractionnumber or array
pyoptics.analytical.circular_otf(f, NA, wavelength)[source]

Diffraction limited optical transfer function (OTF) of an incoherent imaging system with a circular pupil.

Parameters:
fnumber or array

Spatial frequency (in 1/length, i.e. cycles per unit length, not angular wavenumber).

NAnumber

Image-side numerical aperture.

wavelengthnumber

Wavelength.

Returns:
OTFnumber or array

2/pi*(arccos(s) - s*sqrt(1 - s**2)) with s = |f|/f_c and the cut-off frequency f_c = 2*NA/wavelength; zero for s > 1. The OTF is real and non-negative, so it is identical to the MTF.

pyoptics.analytical.cylinder_coefficients(radius, n_cyl, wl, n_medium=1.0, num_orders=None)[source]

Scattering coefficients of a circular dielectric cylinder for the scalar Helmholtz equation (TE polarization: E parallel to the cylinder axis).

The total field is written as

  • outside: u = sum_m i**m B_m (J_m(k r) + a_m H_m(k r)) exp(i m phi),

  • inside: u = sum_m i**m B_m c_m J_m(m_rel k r) exp(i m phi),

with the Hankel function H_m of the first kind (time dependence exp(-i omega t)), k = 2 pi n_medium/wl and m_rel = n_cyl/n_medium. B_m describes the incident field (B_m = 1 for a plane wave along phi = 0). For E parallel to the axis, u = E_axis and its radial derivative are continuous at r = radius, so this is the exact solution of Maxwell’s equations [1].

Parameters:
radiusnumber

Cylinder radius.

n_cylnumber

Refractive index of the cylinder (may be complex).

wlnumber

Vacuum wavelength.

n_mediumnumber, optional

Refractive index of the surrounding medium.

num_ordersint, optional

Highest order m. Defaults to Wiscombe’s criterion.

Returns:
marray

Orders -num_orders..num_orders.

a_m, c_marrays

Coefficients of the scattered and the inner field.

References

[1]

C. F. Bohren and D. R. Huffman, “Absorption and Scattering of Light by Small Particles”, Wiley (1983), chapter 8.

pyoptics.analytical.cylinder_field(x, z, radius, n_cyl, wl, n_medium=1.0, k_x=None, amplitudes=None, num_orders=None)[source]

Exact total field of a circular dielectric cylinder (axis along y, centred at x = z = 0) illuminated by plane waves travelling towards +z, TE polarization (scalar Helmholtz equation).

Parameters:
x, zarrays

Coordinates (broadcastable against each other).

radius, n_cyl, wl, n_medium, num_orders

See cylinder_coefficients().

k_xarray, optional

Transverse wavenumbers of the incident plane waves. Defaults to a single plane wave along z.

amplitudesarray, optional

Complex amplitudes of the plane waves exp(i (k_x x + k_z z)), with the phase referred to the cylinder centre. The incident field is sum(amplitudes*exp(i (k_x x + k_z z))), e.g. the angular spectrum of a beam. Defaults to 1.

Returns:
uarray

Total field (incident plus scattered outside, transmitted inside).

pyoptics.analytical.sphere_coefficients(radius, n_sph, wl, n_medium=1.0, num_orders=None)[source]

Scattering coefficients of a dielectric sphere for the scalar Helmholtz equation (a scalar analogue of Mie theory).

The total field of an axially symmetric incident field is written as

  • outside: u = sum_l i**l (2l + 1) B_l (j_l(k r) + a_l h_l(k r)) P_l(cos theta),

  • inside: u = sum_l i**l (2l + 1) B_l c_l j_l(m_rel k r) P_l(cos theta),

with spherical Bessel and Hankel functions (first kind, time dependence exp(-i omega t)) and Legendre polynomials P_l; B_l = 1 for a plane wave along +z. u and its radial derivative are continuous at r = radius. This is the “acoustic” (soft contrast) sphere of [1] and the scalar counterpart of the Lorenz-Mie solution [2]: the electric field of the full vectorial problem additionally depends on the polarization.

Parameters:
radiusnumber

Sphere radius.

n_sphnumber

Refractive index of the sphere (may be complex).

wlnumber

Vacuum wavelength.

n_mediumnumber, optional

Refractive index of the surrounding medium.

num_ordersint, optional

Highest order l. Defaults to Wiscombe’s criterion.

Returns:
larray

Orders 0..num_orders.

a_l, c_larrays

Coefficients of the scattered and the inner field.

References

[1]

P. M. Morse and K. U. Ingard, “Theoretical Acoustics”, McGraw-Hill (1968).

[2]

C. F. Bohren and D. R. Huffman, “Absorption and Scattering of Light by Small Particles”, Wiley (1983), chapter 4.

pyoptics.analytical.sphere_field(rho, z, radius, n_sph, wl, n_medium=1.0, k_rho=None, amplitudes=None, num_orders=None)[source]

Exact solution of the scalar Helmholtz equation for a dielectric sphere (centred at the origin) illuminated by an axially symmetric field travelling towards +z.

Parameters:
rho, zarrays

Distance from the z axis and axial position (broadcastable).

radius, n_sph, wl, n_medium, num_orders

See sphere_coefficients().

k_rhoarray, optional

Radial wavenumbers of the incident field. Defaults to a single plane wave along z.

amplitudesarray, optional

Weights of the incident field sum(amplitudes*J_0(k_rho rho)*exp(i k_z z)) (a sum of cones of plane waves, e.g. the discretized Hankel transform of a beam, phases referred to z = 0). Defaults to 1.

Returns:
uarray

Total field (incident plus scattered outside, transmitted inside).

Notes

The averaged response to the plane waves on a cone of half angle alpha follows from the addition theorem of the Legendre polynomials, B_l = sum(amplitudes*P_l(cos alpha)) (the simplest case of the generalized Lorenz-Mie theory, G. Gouesbet and G. Grehan, “Generalized Lorenz-Mie Theories”, Springer (2011)).