Wavefront

class poppy.Wavefront(wavelength=<Quantity 1.e-06 m>, npix=1024, dtype=None, diam=<Quantity 8. m>, oversample=2, pixelscale=None)[source]

Bases: BaseWavefront

Wavefront in the Fraunhofer approximation: a monochromatic wavefront that can be transformed between pupil and image planes only, not to intermediate planes

In a pupil plane, a wavefront object wf has

  • wf.diam, a diameter in meters

  • wf.pixelscale, a scale in meters/pixel

In an image plane, it has

  • wf.fov, a field of view in arcseconds

  • wf.pixelscale, a scale in arcsec/pixel

Use the wf.propagate_to() method to transform a wavefront between conjugate planes. This will update those properties as appropriate.

By default, Wavefronts are created in a pupil plane. Set pixelscale=# to make an image plane instead.

Parameters:
wavelengthfloat

Wavelength of light in meters

npixint

Size parameter for wavefront array to create, per side.

diamfloat, optional

For _PUPIL wavefronts, sets physical size corresponding to npix. Units are meters. At most one of diam or pixelscale should be set when creating a wavefront.

pixelscalefloat, optional

For PlaneType.image PLANE wavefronts, use this pixel scale.

oversampleint, optional

how much to oversample by in FFTs. Default is 2. Note that final propagations to Detectors use a different algorithm and, optionally, a separate oversampling factor.

dtypenumpy.dtype, optional

default is double complex.

Methods Summary

coordinates()

Return Y, X coordinates for this wavefront, in the manner of numpy.indices()

from_fresnel_wavefront(fresnel_wavefront[, ...])

Convert a Fresnel type wavefront object to a Fraunhofer one

image_coordinates(shape, pixelscale, ...)

Utility function to generate coordinates arrays for an image plane wavefront

propagate_to(optic)

Propagates a wavefront object to the next optic in the list.

pupil_coordinates(shape, pixelscale)

Utility function to generate coordinates arrays for a pupil plane wavefront

Methods Documentation

coordinates()[source]

Return Y, X coordinates for this wavefront, in the manner of numpy.indices()

This function knows about the offset resulting from FFTs. Use it whenever computing anything measured in wavefront coordinates.

Returns:
Y, Xarray_like

Wavefront coordinates in either meters or arcseconds for pupil and image, respectively

classmethod from_fresnel_wavefront(fresnel_wavefront, verbose=False)[source]

Convert a Fresnel type wavefront object to a Fraunhofer one

Note, this function implicitly assumes this wavefront is at a pupil plane, so the resulting Fraunhofer wavefront will have pixelscale in meters/pix rather than arcsec/pix.

Parameters:
fresnel_wavefrontWavefront

The (Fresnel-type) wavefront to be converted.

static image_coordinates(shape, pixelscale, last_transform_type, image_centered)[source]

Utility function to generate coordinates arrays for an image plane wavefront

Parameters:
shapetuple of ints

Shape of the wavefront array

pixelscalefloat or 2-tuple of floats

the pixelscale in meters/pixel, optionally different in X and Y

last_transform_typestring

Was the last transformation on the Wavefront an FFT or an MFT?

image_centeredstring

Was POPPY trying to keeping the center of the image on a pixel, crosshairs (‘array_center’), or corner?

propagate_to(optic)[source]

Propagates a wavefront object to the next optic in the list. Modifies this wavefront object itself.

Transformations between pupil and detector planes use MFT or inverse MFT. Transformations between pupil and other (non-detector) image planes use FFT or inverse FFT, unless explicitly tagged to use MFT via a propagation hint. Transformations from any frame through a rotation or coordinate transform plane simply transform the wavefront accordingly.

Parameters:
opticOpticalElement

The optic to propagate to. Used for determining the appropriate optical plane.

static pupil_coordinates(shape, pixelscale)[source]

Utility function to generate coordinates arrays for a pupil plane wavefront

Parameters:
shapetuple of ints

Shape of the wavefront array

pixelscalefloat or 2-tuple of floats

the pixel scale in meters/pixel, optionally different in X and Y