class poppy.FITSOpticalElement(name=u'unnamed optic', transmission=None, opd=None, opdunits=u'meters', shift=None, rotation=None, pixelscale=None, planetype=None, transmission_index=None, opd_index=None, **kwargs)[source]

Bases: poppy.poppy_core.OpticalElement

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

This optic could be a pupil or field stop, an aberrated mirror, a phase mask, etc. The FITSOpticalElement class follows the behavior of the Wavefront class, using units of meters/pixel in pupil space and arcsec/pixel in image space.

The interface is very flexible. You can define a FITSOpticalElement either from

  • a single FITS file giving the amplitude transmission (in which case phase is zero)
  • a single FITS file giving the OPD (in which case transmission is 1 everywhere)
  • two FITS files specifying both transmission and OPD.

The FITS file argument(s) can be supplied either as

  1. a string giving the path to a file on disk,
  2. a FITS HDUlist object, or
  3. in the case of OPDs, a tuple consisting of a path to a datacube and an integer index of a slice in that datacube.

A better interface for slice selection in datacubes is the transmission_index and opd_index keyword parameters listed below, but the tuple interface is retained for back compatibility with existing code.


name : string

descriptive name for optic

transmission, opd : string or fits HDUList

Either FITS filenames or actual fits.HDUList objects for the transmission (from 0-1) and opd (in meters)

transmission_slice, opd_slice : integers, optional

If either transmission or OPD files are datacubes, you can specify the slice index using this argument.

opdunits : string

units for the OPD file. Default is ‘meters’. can be ‘meter’, ‘meters’, ‘micron(s)’, ‘nanometer(s)’, or their SI abbreviations. If this keyword is not set explicitly, the BUNIT keyword in the FITS header will be checked.

planetype : int

either _IMAGE or _PUPIL

oversample : int

how much to oversample beyond Nyquist.

shift : tuple of floats, optional

2-tuple containing X and Y fractional shifts for the pupil. These shifts are implemented by rounding them to the nearest integer pixel, and doing integer pixel shifts on the data array, without interpolation.

rotation : float

Rotation for that optic, in degrees counterclockwise. This is implemented using spline interpolation via the scipy.ndimage.interpolation.rotate function.

pixelscale : optical str or float

By default, poppy will attempt to determine the appropriate pixel scale by examining the FITS header, checking keywords “PUPLSCAL” and ‘PIXSCALE’ for pupil and image planes respectively. If you would like to override and use a different keyword, provide that as a string here. Alternatively, you can just set a floating point value directly too (in meters/pixel or arcsec/pixel, respectively, for pupil or image planes).

transmission_index, opd_index : ints, optional

If the input transmission or OPD files are datacubes, provide a scalar index here for which cube slice should be used.

*NOTE:* All mask files must be *squares*.

Also, please note that the adopted convention is for the spectral throughput (transmission) to be given

in appropriate units for acting on the *amplitude* of the electric field. Thus for example an optic with

a uniform transmission of 0.5 will reduce the electric field amplitude to 0.5 relative to the input,

and thus reduce the total power to 0.25. This distinction only matters in the case of semitransparent

(grayscale) masks.

Attributes Summary


Attributes Documentation


Page Contents