API Reference

poppy Package

Physical Optics Propagation in PYthon (POPPY)

POPPY is a Python package that simulates physical optical propagation including diffraction. It implements a flexible framework for modeling Fraunhofer (far-field) diffraction and point spread function formation, particularly in the context of astronomical telescopes. POPPY was developed as part of a simulation package for JWST, but is more broadly applicable to many kinds of imaging simulations.

Developed by Marshall Perrin and colleagues at STScI, for use simulating the James Webb Space Telescope and other NASA missions.

Documentation can be found online at https://poppy-optics.readthedocs.io/

Functions

display_psf(hdulist_or_filename[, ext, ...])

Display nicely a PSF from a given hdulist or filename

display_psf_difference([...])

Display nicely the difference of two PSFs from given files

display_ee([hdulist_or_filename, ext, ...])

Display Encircled Energy curve for a PSF

measure_ee([hdulist_or_filename, ext, ...])

measure encircled energy vs radius and return as an interpolator

measure_radius_at_ee([hdulist_or_filename, ...])

measure encircled energy vs radius and return as an interpolator Returns a function object which when called returns the radius for a given Encircled Energy.

display_profiles([hdulist_or_filename, ext, ...])

Produce two plots of PSF radial profile and encircled energy

radial_profile([hdulist_or_filename, ext, ...])

Compute a radial profile of the image.

measure_radial([hdulist_or_filename, ext, ...])

measure azimuthally averaged radial profile of a PSF.

measure_fwhm(hdulist_or_filename[, ext, ...])

Improved version of measuring FWHM, without any binning of image data.

measure_sharpness([HDUlist_or_filename, ext])

Compute image sharpness, the sum of pixel squares.

measure_centroid([HDUlist_or_filename, ext, ...])

Measure the center of an image via center-of-mass

measure_anisotropy([HDUlist_or_filename, ...])

spectrum_from_spectral_type(sptype[, ...])

Get synphot Spectrum object from a user-friendly spectral type string.

specFromSpectralType(sptype[, return_list, ...])

Get synphot Spectrum object from a user-friendly spectral type string.

removePadding(array, oversample)

Remove zeros around the edge of an array, assuming some integer oversampling padding factor

fixed_sampling_optic(optic, wavefront[, ...])

Convert a variable-sampling AnalyticOpticalElement to a fixed-sampling ArrayOpticalElement

Classes

Instrument([name])

A generic astronomical instrument, composed of

Wavefront([wavelength, npix, dtype, diam, ...])

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

OpticalSystem([name, verbose, oversample, ...])

A class representing a series of optical elements, either Pupil, Image, or Detector planes, through which light can be propagated.

CompoundOpticalSystem([optsyslist, name])

A concatenation of two or more optical systems, acting as a single larger optical system.

OpticalElement([name, verbose, planetype, ...])

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

ArrayOpticalElement([opd, transmission, ...])

Defines an arbitrary optic, based on amplitude transmission and/or OPD given as numpy arrays.

FITSOpticalElement([name, transmission, ...])

Defines an arbitrary optic, based on amplitude transmission and/or OPD FITS files.

Rotation([angle, units, hide])

Performs a rotation of the axes in the optical train.

Detector([pixelscale, fov_pixels, ...])

A Detector is a specialized type of OpticalElement that forces a wavefront onto a specific fixed pixelization of an Image plane.

AnalyticOpticalElement([shift_x, shift_y, ...])

Defines an abstract analytic optical element, i.e. one definable by some formula rather than by an input OPD or pupil file.

ScalarTransmission([name, transmission])

Uniform transmission between 0 and 1.0 in intensity.

ScalarOpticalPathDifference([name, opd])

Uniform and constant optical path difference

InverseTransmission([optic])

Given any arbitrary OpticalElement with transmission T(x,y) return the inverse transmission 1 - T(x,y)

BandLimitedCoron

alias of BandLimitedCoronagraph

BandLimitedCoronagraph([name, kind, sigma, ...])

Defines an ideal band limited coronagraph occulting mask.

IdealFQPM([name, wavelength])

Defines an ideal 4-quadrant phase mask coronagraph, with its retardance set perfectly to 0.5 waves at one specific wavelength and varying linearly on either side of that.

CircularPhaseMask([name, radius, ...])

Circular phase mask coronagraph, with its retardance set perfectly at one specific wavelength and varying linearly on either side of that.

RectangularFieldStop([name, width, height])

Defines an ideal rectangular field stop

SquareFieldStop([name, size])

Defines an ideal square field stop

AnnularFieldStop([name, radius_inner, ...])

Defines a circular field stop with an (optional) opaque circular center region

HexagonFieldStop([name, side, diameter, ...])

Defines an ideal hexagonal field stop

CircularOcculter([name, radius])

Defines an ideal circular occulter (opaque circle)

BarOcculter([name, width, height])

Defines an ideal bar occulter (like in MIRI's Lyot coronagraph)

FQPM_FFT_aligner([name, direction])

Helper class for modeling FQPMs accurately

CircularAperture([name, radius, pad_factor, ...])

Defines an ideal circular pupil aperture

HexagonAperture([name, side, diameter, ...])

Defines an ideal hexagonal pupil aperture

MultiHexagonAperture([name, flattoflat, ...])

Defines a hexagonally segmented aperture

NgonAperture([name, nsides, radius, rotation])

Defines an ideal N-gon pupil aperture.

MultiCircularAperture([name, rings, ...])

Defines a circularly segmented aperture in close compact configuration

RectangleAperture([name, width, height, ...])

Defines an ideal rectangular pupil aperture

SquareAperture([name, size])

Defines an ideal square pupil aperture

SecondaryObscuration([name, ...])

Defines the central obscuration of an on-axis telescope including secondary mirror and supports

LetterFAperture([name, radius, pad_factor])

Define a capital letter F aperture.

AsymmetricSecondaryObscuration([...])

Defines a central obscuration with one or more supports which can be oriented at arbitrary angles around the primary mirror, a la the three supports of JWST

ThinLens([name, nwaves, ...])

An idealized thin lens, implemented as a Zernike defocus term.

GaussianAperture([name, fwhm, w, pupil_diam])

Defines an ideal Gaussian apodized pupil aperture, or at least as much of one as can be fit into a finite-sized array

KnifeEdge([name, rotation])

A half-infinite opaque plane, with a perfectly sharp edge through the origin.

TiltOpticalPathDifference([name, ...])

A simple tilt in OPD.

CompoundAnalyticOptic([opticslist, name, ...])

Define a compound analytic optical element made up of the combination of two or more individual optical elements.

QuadPhase([z, planetype, name])

Quadratic phase factor, q(z) suitable for representing a radially-dependent wavefront curvature.

QuadraticLens([f_lens, planetype, name])

Gaussian Lens

FresnelWavefront(beam_radius[, units, ...])

Wavefront for Fresnel diffraction calculation.

FresnelOpticalSystem([name, pupil_diameter, ...])

Class representing a series of optical elements, through which light can be propagated using the Fresnel formalism.

FixedSamplingImagePlaneElement([name, ...])

This class allows the definition of focal plane masks using .fits files that will be applied to a wavefront via an FFT/MFT sequence to achieve the correct sampling at the assumed focal plane.

WavefrontError(**kwargs)

A base class for different sources of wavefront error

ParameterizedWFE([name, coefficients, ...])

Define an optical element in terms of its distortion as decomposed into a set of orthonormal basis functions (e.g.

ZernikeWFE([name, coefficients, radius, ...])

Define an optical element in terms of its Zernike components by providing coefficients for each Zernike term contributing to the analytic optical element.

SineWaveWFE([name, spatialfreq, amplitude, ...])

A single sine wave ripple across the optic

StatisticalPSDWFE([name, index, wfe, ...])

Statistical PSD WFE class from power law for optical noise.

PowerSpectrumWFE([name, psd_parameters, ...])

WFE model specified via a Power Spectral Density (PSD), or a list of multiple PSDs, which follow von Karman PSD model:

KolmogorovWFE([name, r0, Cn2, dz, ...])

A turbulent phase screen.

ThermalBloomingWFE(abs_coeff, dz[, name, ...])

A thermal blooming phase screen.

ContinuousDeformableMirror([dm_shape, ...])

Generic deformable mirror, of the continuous face sheet variety.

HexSegmentedDeformableMirror([rings, ...])

Hexagonally segmented DM.

CircularSegmentedDeformableMirror([rings, ...])

Circularly segmented DM.

TipTiltStage([optic, radius, ...])

Put an arbitrary optic on a tip-tilt stage, so we can actively adjust its tip and tilt.

Class Inheritance Diagram

digraph inheritancef9280f4bc2 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "AnalyticImagePlaneElement" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Parent virtual class for AnalyticOptics which are"]; "AnalyticOpticalElement" -> "AnalyticImagePlaneElement" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AnalyticOpticalElement" [URL="../api/poppy.AnalyticOpticalElement.html#poppy.AnalyticOpticalElement",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines an abstract analytic optical element, i.e. one definable by"]; "OpticalElement" -> "AnalyticOpticalElement" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AnnularFieldStop" [URL="../api/poppy.AnnularFieldStop.html#poppy.AnnularFieldStop",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines a circular field stop with an (optional) opaque circular center region"]; "AnalyticImagePlaneElement" -> "AnnularFieldStop" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ArrayOpticalElement" [URL="../api/poppy.ArrayOpticalElement.html#poppy.ArrayOpticalElement",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines an arbitrary optic, based on amplitude transmission and/or OPD given as numpy arrays."]; "OpticalElement" -> "ArrayOpticalElement" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AsymmetricSecondaryObscuration" [URL="../api/poppy.AsymmetricSecondaryObscuration.html#poppy.AsymmetricSecondaryObscuration",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines a central obscuration with one or more supports which can be oriented at"]; "SecondaryObscuration" -> "AsymmetricSecondaryObscuration" [arrowsize=0.5,style="setlinewidth(0.5)"]; "BandLimitedCoronagraph" [URL="../api/poppy.BandLimitedCoronagraph.html#poppy.BandLimitedCoronagraph",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines an ideal band limited coronagraph occulting mask."]; "AnalyticImagePlaneElement" -> "BandLimitedCoronagraph" [arrowsize=0.5,style="setlinewidth(0.5)"]; "BarOcculter" [URL="../api/poppy.BarOcculter.html#poppy.BarOcculter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines an ideal bar occulter (like in MIRI's Lyot coronagraph)"]; "AnalyticImagePlaneElement" -> "BarOcculter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "BaseOpticalSystem" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Abstract Base class for optical systems"]; "ABC" -> "BaseOpticalSystem" [arrowsize=0.5,style="setlinewidth(0.5)"]; "BaseWavefront" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Abstract base class for wavefronts."]; "ABC" -> "BaseWavefront" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CircularAperture" [URL="../api/poppy.CircularAperture.html#poppy.CircularAperture",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines an ideal circular pupil aperture"]; "AnalyticOpticalElement" -> "CircularAperture" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CircularOcculter" [URL="../api/poppy.CircularOcculter.html#poppy.CircularOcculter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines an ideal circular occulter (opaque circle)"]; "AnnularFieldStop" -> "CircularOcculter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CircularPhaseMask" [URL="../api/poppy.CircularPhaseMask.html#poppy.CircularPhaseMask",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Circular phase mask coronagraph, with its retardance"]; "AnalyticImagePlaneElement" -> "CircularPhaseMask" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CircularSegmentedDeformableMirror" [URL="../api/poppy.CircularSegmentedDeformableMirror.html#poppy.CircularSegmentedDeformableMirror",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Circularly segmented DM. Each actuator is controllable in piston, tip, and tilt (and any zernike term)"]; "SegmentedDeformableMirror" -> "CircularSegmentedDeformableMirror" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MultiCircularAperture" -> "CircularSegmentedDeformableMirror" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CompoundAnalyticOptic" [URL="../api/poppy.CompoundAnalyticOptic.html#poppy.CompoundAnalyticOptic",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Define a compound analytic optical element made up of the combination"]; "AnalyticOpticalElement" -> "CompoundAnalyticOptic" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CompoundOpticalSystem" [URL="../api/poppy.CompoundOpticalSystem.html#poppy.CompoundOpticalSystem",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A concatenation of two or more optical systems,"]; "OpticalSystem" -> "CompoundOpticalSystem" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ContinuousDeformableMirror" [URL="../api/poppy.ContinuousDeformableMirror.html#poppy.ContinuousDeformableMirror",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Generic deformable mirror, of the continuous face sheet variety."]; "AnalyticOpticalElement" -> "ContinuousDeformableMirror" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CoordinateTransform" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Performs a coordinate transformation (rotation or axes inversion"]; "OpticalElement" -> "CoordinateTransform" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Detector" [URL="../api/poppy.Detector.html#poppy.Detector",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A Detector is a specialized type of OpticalElement that forces a wavefront"]; "OpticalElement" -> "Detector" [arrowsize=0.5,style="setlinewidth(0.5)"]; "FITSOpticalElement" [URL="../api/poppy.FITSOpticalElement.html#poppy.FITSOpticalElement",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines an arbitrary optic, based on amplitude transmission and/or OPD FITS files."]; "OpticalElement" -> "FITSOpticalElement" [arrowsize=0.5,style="setlinewidth(0.5)"]; "FQPM_FFT_aligner" [URL="../api/poppy.FQPM_FFT_aligner.html#poppy.FQPM_FFT_aligner",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Helper class for modeling FQPMs accurately"]; "AnalyticOpticalElement" -> "FQPM_FFT_aligner" [arrowsize=0.5,style="setlinewidth(0.5)"]; "FixedSamplingImagePlaneElement" [URL="../api/poppy.FixedSamplingImagePlaneElement.html#poppy.FixedSamplingImagePlaneElement",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="This class allows the definition of focal plane masks using .fits files that will be applied to a "]; "FITSOpticalElement" -> "FixedSamplingImagePlaneElement" [arrowsize=0.5,style="setlinewidth(0.5)"]; "FresnelOpticalSystem" [URL="../api/poppy.FresnelOpticalSystem.html#poppy.FresnelOpticalSystem",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Class representing a series of optical elements,"]; "BaseOpticalSystem" -> "FresnelOpticalSystem" [arrowsize=0.5,style="setlinewidth(0.5)"]; "FresnelWavefront" [URL="../api/poppy.FresnelWavefront.html#poppy.FresnelWavefront",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "BaseWavefront" -> "FresnelWavefront" [arrowsize=0.5,style="setlinewidth(0.5)"]; "GaussianAperture" [URL="../api/poppy.GaussianAperture.html#poppy.GaussianAperture",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines an ideal Gaussian apodized pupil aperture,"]; "AnalyticOpticalElement" -> "GaussianAperture" [arrowsize=0.5,style="setlinewidth(0.5)"]; "HexSegmentedDeformableMirror" [URL="../api/poppy.HexSegmentedDeformableMirror.html#poppy.HexSegmentedDeformableMirror",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Hexagonally segmented DM. Each actuator is controllable in piston, tip, and tilt"]; "SegmentedDeformableMirror" -> "HexSegmentedDeformableMirror" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MultiHexagonAperture" -> "HexSegmentedDeformableMirror" [arrowsize=0.5,style="setlinewidth(0.5)"]; "HexagonAperture" [URL="../api/poppy.HexagonAperture.html#poppy.HexagonAperture",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines an ideal hexagonal pupil aperture"]; "AnalyticOpticalElement" -> "HexagonAperture" [arrowsize=0.5,style="setlinewidth(0.5)"]; "HexagonFieldStop" [URL="../api/poppy.HexagonFieldStop.html#poppy.HexagonFieldStop",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines an ideal hexagonal field stop"]; "AnalyticImagePlaneElement" -> "HexagonFieldStop" [arrowsize=0.5,style="setlinewidth(0.5)"]; "IdealFQPM" [URL="../api/poppy.IdealFQPM.html#poppy.IdealFQPM",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines an ideal 4-quadrant phase mask coronagraph, with its retardance"]; "AnalyticImagePlaneElement" -> "IdealFQPM" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Instrument" [URL="../api/poppy.Instrument.html#poppy.Instrument",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A generic astronomical instrument, composed of"]; "InverseTransmission" [URL="../api/poppy.InverseTransmission.html#poppy.InverseTransmission",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Given any arbitrary OpticalElement with transmission T(x,y)"]; "AnalyticOpticalElement" -> "InverseTransmission" [arrowsize=0.5,style="setlinewidth(0.5)"]; "KnifeEdge" [URL="../api/poppy.KnifeEdge.html#poppy.KnifeEdge",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A half-infinite opaque plane, with a perfectly sharp edge"]; "AnalyticOpticalElement" -> "KnifeEdge" [arrowsize=0.5,style="setlinewidth(0.5)"]; "KolmogorovWFE" [URL="../api/poppy.KolmogorovWFE.html#poppy.KolmogorovWFE",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A turbulent phase screen."]; "WavefrontError" -> "KolmogorovWFE" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LetterFAperture" [URL="../api/poppy.LetterFAperture.html#poppy.LetterFAperture",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Define a capital letter F aperture. This is sometimes useful for"]; "AnalyticOpticalElement" -> "LetterFAperture" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MultiCircularAperture" [URL="../api/poppy.MultiCircularAperture.html#poppy.MultiCircularAperture",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines a circularly segmented aperture in close compact configuration"]; "MultiSegmentAperture" -> "MultiCircularAperture" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MultiHexagonAperture" [URL="../api/poppy.MultiHexagonAperture.html#poppy.MultiHexagonAperture",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines a hexagonally segmented aperture"]; "MultiSegmentAperture" -> "MultiHexagonAperture" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MultiSegmentAperture" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Abstract base class for an aperture made of sub-apertures"]; "AnalyticOpticalElement" -> "MultiSegmentAperture" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "MultiSegmentAperture" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NgonAperture" [URL="../api/poppy.NgonAperture.html#poppy.NgonAperture",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines an ideal N-gon pupil aperture."]; "AnalyticOpticalElement" -> "NgonAperture" [arrowsize=0.5,style="setlinewidth(0.5)"]; "OpticalElement" [URL="../api/poppy.OpticalElement.html#poppy.OpticalElement",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for all optical elements, whether from FITS files or analytic functions."]; "OpticalSystem" [URL="../api/poppy.OpticalSystem.html#poppy.OpticalSystem",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A class representing a series of optical elements,"]; "BaseOpticalSystem" -> "OpticalSystem" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ParameterizedWFE" [URL="../api/poppy.ParameterizedWFE.html#poppy.ParameterizedWFE",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Define an optical element in terms of its distortion as decomposed"]; "WavefrontError" -> "ParameterizedWFE" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PowerSpectrumWFE" [URL="../api/poppy.PowerSpectrumWFE.html#poppy.PowerSpectrumWFE",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="WFE model specified via a Power Spectral Density (PSD),"]; "WavefrontError" -> "PowerSpectrumWFE" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QuadPhase" [URL="../api/poppy.QuadPhase.html#poppy.QuadPhase",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Quadratic phase factor, q(z)"]; "AnalyticOpticalElement" -> "QuadPhase" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QuadraticLens" [URL="../api/poppy.QuadraticLens.html#poppy.QuadraticLens",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Gaussian Lens"]; "QuadPhase" -> "QuadraticLens" [arrowsize=0.5,style="setlinewidth(0.5)"]; "RectangleAperture" [URL="../api/poppy.RectangleAperture.html#poppy.RectangleAperture",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines an ideal rectangular pupil aperture"]; "AnalyticOpticalElement" -> "RectangleAperture" [arrowsize=0.5,style="setlinewidth(0.5)"]; "RectangularFieldStop" [URL="../api/poppy.RectangularFieldStop.html#poppy.RectangularFieldStop",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines an ideal rectangular field stop"]; "AnalyticImagePlaneElement" -> "RectangularFieldStop" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Rotation" [URL="../api/poppy.Rotation.html#poppy.Rotation",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Performs a rotation of the axes in the optical train."]; "CoordinateTransform" -> "Rotation" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ScalarOpticalPathDifference" [URL="../api/poppy.ScalarOpticalPathDifference.html#poppy.ScalarOpticalPathDifference",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Uniform and constant optical path difference"]; "AnalyticOpticalElement" -> "ScalarOpticalPathDifference" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ScalarTransmission" [URL="../api/poppy.ScalarTransmission.html#poppy.ScalarTransmission",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Uniform transmission between 0 and 1.0 in intensity."]; "AnalyticOpticalElement" -> "ScalarTransmission" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SecondaryObscuration" [URL="../api/poppy.SecondaryObscuration.html#poppy.SecondaryObscuration",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines the central obscuration of an on-axis telescope including secondary mirror and"]; "AnalyticOpticalElement" -> "SecondaryObscuration" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SegmentedDeformableMirror" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Abstract class for segmented DMs."]; "ABC" -> "SegmentedDeformableMirror" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SineWaveWFE" [URL="../api/poppy.SineWaveWFE.html#poppy.SineWaveWFE",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A single sine wave ripple across the optic"]; "WavefrontError" -> "SineWaveWFE" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SquareAperture" [URL="../api/poppy.SquareAperture.html#poppy.SquareAperture",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines an ideal square pupil aperture"]; "RectangleAperture" -> "SquareAperture" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SquareFieldStop" [URL="../api/poppy.SquareFieldStop.html#poppy.SquareFieldStop",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines an ideal square field stop"]; "RectangularFieldStop" -> "SquareFieldStop" [arrowsize=0.5,style="setlinewidth(0.5)"]; "StatisticalPSDWFE" [URL="../api/poppy.StatisticalPSDWFE.html#poppy.StatisticalPSDWFE",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Statistical PSD WFE class from power law for optical noise."]; "WavefrontError" -> "StatisticalPSDWFE" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ThermalBloomingWFE" [URL="../api/poppy.ThermalBloomingWFE.html#poppy.ThermalBloomingWFE",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A thermal blooming phase screen."]; "WavefrontError" -> "ThermalBloomingWFE" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ThinLens" [URL="../api/poppy.ThinLens.html#poppy.ThinLens",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An idealized thin lens, implemented as a Zernike defocus term."]; "CircularAperture" -> "ThinLens" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TiltOpticalPathDifference" [URL="../api/poppy.TiltOpticalPathDifference.html#poppy.TiltOpticalPathDifference",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A simple tilt in OPD."]; "AnalyticOpticalElement" -> "TiltOpticalPathDifference" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TipTiltStage" [URL="../api/poppy.TipTiltStage.html#poppy.TipTiltStage",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Put an arbitrary optic on a tip-tilt stage, so we can actively adjust its tip and tilt."]; "OpticalElement" -> "TipTiltStage" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Wavefront" [URL="../api/poppy.Wavefront.html#poppy.Wavefront",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Wavefront in the Fraunhofer approximation: a monochromatic wavefront that"]; "BaseWavefront" -> "Wavefront" [arrowsize=0.5,style="setlinewidth(0.5)"]; "WavefrontError" [URL="../api/poppy.WavefrontError.html#poppy.WavefrontError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A base class for different sources of wavefront error"]; "AnalyticOpticalElement" -> "WavefrontError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ZernikeWFE" [URL="../api/poppy.ZernikeWFE.html#poppy.ZernikeWFE",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Define an optical element in terms of its Zernike components by"]; "WavefrontError" -> "ZernikeWFE" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

poppy.zernike Module

Zernike & Related Polynomials

This module implements several sets of orthonormal polynomials for measuring and modeling wavefronts:

  • the classical Zernike polynomials, which are orthonormal over the unit circle.

  • ‘Hexikes’, orthonormal over the unit hexagon

  • tools for creating a custom set orthonormal over a numerically supplied JWST pupil,

    or other generalized pupil

  • Segmented bases with piston, tip, & tilt of independent hexagonal segments.

For definitions of Zernikes and a basic introduction to why they are a useful way to

parametrize data, see e.g.

Hardy’s ‘Adaptive Optics for Astronomical Telescopes’ section 3.5.1 or even just the Wikipedia page is pretty decent.

For definition of the hexagon and arbitrary pupil polynomials, a good reference to the

Gram-Schmidt orthonormalization process as applied to this case is

Mahajan and Dai, 2006. Optics Letters Vol 31, 16, p 2462:

Functions

R(n, m, rho)

Compute R[n, m], the Zernike radial polynomial

cached_zernike1(j, shape, pixelscale, ...[, ...])

Compute Zernike based on Noll index j, using an LRU cache for efficiency.

hex_aperture([npix, rho, theta, vertical, ...])

Return an aperture function for a hexagon.

hexike_basis([nterms, npix, rho, theta, ...])

Return a list of hexike polynomials 1-N following the method of Mahajan and Dai 2006 for numerical orthonormalization

noll_indices(j)

Convert from 1-D to 2-D indexing for Zernikes or Hexikes.

decompose_opd(opd[, aperture, nterms, basis])

Given a wavefront OPD map, return the list of coefficients in a given basis set (by default, Zernikes) that best fit the OPD map.

decompose_opd_nonorthonormal_basis(opd[, ...])

Modified version of decompose_opd, for cases where the basis function is not orthonormal, for instance using the regular Zernike functions on obscured apertures.

decompose_opd_segments(opd[, aperture, ...])

Expand OPD into a basis defined by segments, typically with piston, tip, & tilt of each.

compose_opd_from_basis(coeffs[, basis, ...])

Synthesize an OPD from a set of coefficients

opd_expand(opd[, aperture, nterms, basis])

Given a wavefront OPD map, return the list of coefficients in a given basis set (by default, Zernikes) that best fit the OPD map.

opd_expand_nonorthonormal(opd[, aperture, ...])

Modified version of decompose_opd, for cases where the basis function is not orthonormal, for instance using the regular Zernike functions on obscured apertures.

opd_expand_segments(opd[, aperture, nterms, ...])

Expand OPD into a basis defined by segments, typically with piston, tip, & tilt of each.

opd_from_zernikes(coeffs[, basis, aperture, ...])

Synthesize an OPD from a set of coefficients

str_zernike(n, m)

Return analytic expression for a given Zernike in LaTeX syntax

zern_name(i)

Return a human-readable text name corresponding to some Zernike term as specified by j, the index

zernike(n, m[, npix, rho, theta, outside, ...])

Return the Zernike polynomial Z[m,n] for a given pupil.

zernike1(j, **kwargs)

Return the Zernike polynomial Z_j for pupil points {r,theta}.

zernike_basis([nterms, npix, rho, theta])

Return a cube of Zernike terms from 1 to N each as a 2D array showing the value at each point.

arbitrary_basis(aperture[, nterms, rho, ...])

Orthonormal basis on arbitrary aperture, via Gram-Schmidt

Classes

Segment_Piston_Basis([rings, flattoflat, ...])

Eigenbasis of segment pistons, tips, tilts.

Segment_PTT_Basis([rings, flattoflat, gap, ...])

Eigenbasis of segment pistons, tips, tilts.

Class Inheritance Diagram

digraph inheritance71029364bc { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Segment_PTT_Basis" [URL="../api/poppy.zernike.Segment_PTT_Basis.html#poppy.zernike.Segment_PTT_Basis",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "Segment_Piston_Basis" [URL="../api/poppy.zernike.Segment_Piston_Basis.html#poppy.zernike.Segment_Piston_Basis",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "Segment_PTT_Basis" -> "Segment_Piston_Basis" [arrowsize=0.5,style="setlinewidth(0.5)"]; }