OpticalElement

class poppy.OpticalElement(name='unnamed optic', verbose=True, planetype=PlaneType.unspecified, oversample=1, interp_order=3)[source]

Bases: object

Base class for all optical elements, whether from FITS files or analytic functions.

If instantiated on its own, this just produces a null optical element (empty space, i.e. an identity function on transmitted wavefronts.) Use one of the many subclasses to create a nontrivial optic.

The OpticalElement class follows the behavior of the Wavefront class, using units of meters/pixel in pupil space and arcsec/pixel in image space.

The internal implementation of this class represents an optic with an array for the electric field amplitude transmissivity (or reflectivity), plus an array for the optical path difference in units of meters. This representation was chosen since most typical optics of interest will have wavefront error properties that are independent of wavelength. Subclasses particularly the AnalyticOpticalElements extend this paradigm with optics that have wavelength-dependent properties.

The get_phasor() function is used to obtain the complex phasor for any desired wavelength based on the amplitude and opd arrays. Those can individually be obtained from the get_transmission() and get_opd() functions.

Parameters:
namestring

descriptive name for optic

verbosebool

whether to be more verbose in log outputs while computing

planetypeint

either poppy.PlaneType.image or poppy.PlaneType.pupil

oversampleint

how much to oversample beyond Nyquist.

interp_orderint

the order (0 to 5) of the spline interpolation used if the optic is resized.

Attributes Summary

shape

Return shape of the OpticalElement, as a tuple

Methods Summary

display([nrows, row, what, crosshairs, ax, ...])

Display plots showing an optic's transmission and OPD.

get_opd(wave)

Return the optical path difference, given a wavelength.

get_phasor(wave)

Compute a complex phasor from an OPD, given a wavelength.

get_transmission(wave)

Return the electric field amplitude transmission, given a wavelength.

Attributes Documentation

shape

Return shape of the OpticalElement, as a tuple

Methods Documentation

display(nrows=1, row=1, what='intensity', crosshairs=False, ax=None, colorbar=True, colorbar_orientation=None, title=None, opd_vmax=<Quantity 5.e-07 m>, wavelength=<Quantity 1.e-06 m>, npix=512, grid_size=None)[source]

Display plots showing an optic’s transmission and OPD.

Parameters:
whatstr

What to display: ‘intensity’, ‘amplitude’, ‘phase’, ‘opd’, or ‘both’ (meaning intensity and OPD in two subplots)

axmatplotlib.Axes instance

Axes to display into

nrows, rowintegers

number of rows and row index for subplot display

crosshairsbool

Display crosshairs indicating the center?

colorbarbool

Show colorbar?

colorbar_orientationbool

Desired orientation, horizontal or vertical? Default is horizontal if only 1 row of plots, else vertical

opd_vmaxfloat

Max absolute value for OPD image display, in meters.

titlestring

Plot label

wavelengthfloat, default 1 micron

For optics with wavelength-dependent behavior, evaluate at this wavelength for display.

npixinteger

For optics without a fixed pixel sampling, evaluate onto this many pixels for display.

grid_sizefloat

For optics without a fixed pixel sampling, evaluate onto this large a spatial or angular extent for display. Specify in units of arcsec for image plane optics, meters for all other optics. If unspecified, a default value will be chosen instead, possibly from the ._default_display_size attribute, if present.

get_opd(wave)[source]

Return the optical path difference, given a wavelength.

In this base class instance, the wavefront parameter ‘wave’ is not used,

and the .opd attribute of the optic is returned directly. Subclasses may change this behavior, for instance to evaluate optical aberrations on the sampling defined for that wavefront, or to compute the wavelength-dependent aberrations of a refractive optic.

Parameters:
wavefloat or obj

either a scalar wavelength or a Wavefront object

Returns:
ndarray giving OPD in meters
get_phasor(wave)[source]

Compute a complex phasor from an OPD, given a wavelength.

The returned value should be the complex phasor array as appropriate for multiplying by the wavefront amplitude.

Parameters:
wavefloat or obj

either a scalar wavelength or a Wavefront object

get_transmission(wave)[source]

Return the electric field amplitude transmission, given a wavelength.

Parameters:
wavefloat or obj

either a scalar wavelength or a Wavefront object

Returns:
ndarray giving electric field amplitude transmission between 0 - 1.0