WFO (paos.classes.wfo)

class WFO(beam_diameter, wl, grid_size, zoom)[source]

Bases: object

Physical optics wavefront propagation. Implements the paraxial theory described in Lawrence et al., Applied Optics and Optical Engineering, Volume XI (1992)

All units are meters.

Parameters:
  • beam_diameter (scalar) – the input beam diameter. Note that the input beam is always circular, regardless of whatever non-circular apodization the input pupil might apply.

  • wl (scalar) – the wavelength

  • grid_size (scalar) – grid size must be a power of 2

  • zoom (scalar) – linear scaling factor of input beam.

Variables:
  • wl (scalar) – the wavelength

  • z (scalar) – current beam position along the z-axis (propagation axis). Initial value is 0

  • w0 (scalar) – pilot Gaussian beam waist. Initial value is beam_diameter/2

  • zw0 (scalar) – z-coordinate of the Gaussian beam waist. initial value is 0

  • zr (scalar) – Rayleigh distance: \(\pi w_{0}^{2} / \lambda\)

  • rayleigh_factor (scalar) – Scale factor multiplying zr to determine ‘I’ and ‘O’ regions. Built in value is 2

  • dx (scalar) – pixel sampling interval along x-axis

  • dy (scalar) – pixel sampling interval along y-axis

  • C (scalar) – curvature of the reference surface at beam position

  • fratio (scalar) – pilot Gaussian beam f-ratio

  • wfo (array [gridsize, gridsize], complex128) – the wavefront complex array

  • amplitude (array [gridsize, gridsize], float64) – the wavefront amplitude array

  • phase (array [gridsize, gridsize], float64) – the wavefront phase array in radians

  • wz (scalar) – the Gaussian beam waist w(z) at current beam position

  • distancetofocus (scalar) – the distance to focus from current beam position

  • extent (tuple) – the physical coordinates of the wavefront bounding box (xmin, xmax, ymin, ymax). Can be used directly in im.set_extent.

Returns:

out

Return type:

an instance of wfo

Example

>>> import paos
>>> import matplotlib.pyplot as plt
>>> beam_diameter = 1.0  # m
>>> wavelength = 3.0  # micron
>>> grid_size = 512
>>> zoom = 4
>>> xdec, ydec = 0.0, 0.0
>>> fig, (ax0, ax1) = plt.subplots(nrows=1, ncols=2, figsize=(12, 6))
>>> wfo = paos.WFO(beam_diameter, 1.0e-6 * wavelength, grid_size, zoom)
>>> wfo.aperture(xc=xdec, yc=ydec, r=beam_diameter/2, shape='circular')
>>> wfo.make_stop()
>>> ax0.imshow(wfo.amplitude)
>>> wfo.lens(lens_fl=1.0)
>>> wfo.propagate(dz=1.0)
>>> ax1.imshow(wfo.amplitude)
>>> plt.show()
property wl
property z
property w0
property zw0
property zr
property rayleigh_factor
property dx
property dy
property C
property fratio
property wfo
property amplitude
property phase
property wz
property distancetofocus
property extent
make_stop()[source]

Make current surface a stop. Stop here just means that the wf at current position is normalised to unit energy.

aperture(xc, yc, hx=None, hy=None, r=None, shape='elliptical', tilt=None, obscuration=False)[source]

Apply aperture mask

Parameters:
  • xc (scalar) – x-centre of the aperture

  • yc (scalar) – y-centre of the aperture

  • hx (scalars) – semi-axes of shape ‘elliptical’ aperture, or full dimension of shape ‘rectangular’ aperture

  • hy (scalars) – semi-axes of shape ‘elliptical’ aperture, or full dimension of shape ‘rectangular’ aperture

  • r (scalar) – radius of shape ‘circular’ aperture

  • shape (string) – defines aperture shape. Can be ‘elliptical’, ‘circular’, ‘rectangular’

  • tilt (scalar) – tilt angle in degrees. Applies to shapes ‘elliptical’ and ‘rectangular’.

  • obscuration (boolean) – if True, aperture mask is converted into obscuration mask.

insideout(z=None)[source]

Check if z position is within the Rayleigh distance

Parameters:

z (scalar) – beam coordinate long propagation axis

Returns:

out – ‘I’ if \(|z - z_{w0}| < z_{r}\) else ‘O’

Return type:

string

lens(lens_fl)[source]

Apply wavefront phase from paraxial lens

Parameters:

lens_fl (scalar) – Lens focal length. Positive for converging lenses. Negative for diverging lenses.

Note

A paraxial lens imposes a quadratic phase shift.

Magnification(My, Mx=None)[source]

Given the optical magnification along one or both directions, updates the sampling along both directions, the beam semi-diameter, the Rayleigh distance, the distance to focus, and the beam focal ratio

Parameters:
  • My (scalar) – optical magnification along tangential direction

  • Mx (scalar) – optical magnification along sagittal direction

Returns:

out – updates the wfo parameters

Return type:

None

ChangeMedium(n1n2)[source]

Given the ratio of refractive indices n1/n2 for light propagating from a medium with refractive index n1, into a medium with refractive index n2, updates the Rayleigh distance, the wavelength, the distance to focus, and the beam focal ratio

Parameters:

n1n2

Returns:

out – updates the wfo parameters

Return type:

None

ptp(dz)[source]

Plane-to-plane (far field) wavefront propagator

Parameters:

dz (scalar) – propagation distance

stw(dz)[source]

Spherical-to-waist (near field to far field) wavefront propagator

Parameters:

dz (scalar) – propagation distance

wts(dz)[source]

Waist-to-spherical (far field to near field) wavefront propagator

Parameters:

dz (scalar) – propagation distance

propagate(dz)[source]

Wavefront propagator. Selects the appropriate propagation primitive and applies the wf propagation

Parameters:

dz (scalar) – propagation distance

zernikes(index, Z, ordering, normalize, radius, offset=0.0, origin='x')[source]

Add a WFE represented by a Zernike expansion

Parameters:
  • index (array of integers) – Sequence of zernikes to use. It should be a continuous sequence.

  • Z (array of floats) – The coefficients of the Zernike polynomials in meters.

  • ordering (string) – Can be ‘ansi’, ‘noll’, ‘fringe’, or ‘standard’.

  • normalize (bool) – Polynomials are normalised to RMS=1 if True, or to unity at radius if False.

  • radius (float) – The radius of the circular aperture over which the polynomials are calculated.

  • offset (float) – Angular offset in degrees.

  • origin (string) – Angles measured counter-clockwise positive from x axis by default (origin=’x’). Set origin=’y’ for angles measured clockwise-positive from the y-axis.

Returns:

out – the WFE

Return type:

masked array

psd(A=10.0, B=0.0, C=0.0, fknee=1.0, fmin=None, fmax=None, SR=0.0, units=Unit('m'))[source]

Add a WFE represented by a power spectral density (PSD) and surface roughness (SR) specification.

Parameters:
  • A (float) – The amplitude of the PSD.

  • B (float) – PSD parameter. If B = 0, the PSD is a power law.

  • C (float) – PSD parameter. It sets the slope of the PSD.

  • fknee (float) – The knee frequency of the PSD.

  • fmin (float) – The minimum frequency of the PSD.

  • fmax (float) – The maximum frequency of the PSD.

  • SR (float) – The rms of the surface roughness.

  • units (astropy.units) – The units of the SFE. Default is meters.

Returns:

out – the WFE

Return type:

masked array