JWST POPPY:docs

OpticalSystem

class poppy.OpticalSystem(name='unnamed system', verbose=True, oversample=2)[source] [edit on github]

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

The difference between Image and Detector planes is that Detectors have fixed pixels in terms of arcsec/pixel regardless of wavelength (computed via MFT) while Image planes have variable pixels scaled in terms of lambda/D. Pupil planes are some fixed size in meters, of course.

Parameters :

name : string

descriptive name of optical system

oversample : int

Either how many times above Nyquist we should be (for pupil or image planes), or how many times a fixed detector pixel will be sampled. E.g. oversample=2 means image plane sampling lambda/4*D (twice Nyquist) and detector plane sampling 2x2 computed pixels per real detector pixel. Default is 2.

verbose : bool

whether to print stuff while computing

Methods Summary

addDetector(pixelscale[, oversample]) Add a Detector object to an optical system.
addImage([optic, function]) Add an image plane optic to the optical system That image plane optic can be specified either 1) from file(s) giving transmission or OPD [set arguments transmission=filename and/or opd=filename] 2) from an analytic function [set function='circle, fieldstop, bandlimitedcoron, or FQPM' and set additional kwargs to define shape etc.
addPupil([optic, function]) Add a pupil plane optic from file(s) giving transmission or OPD 1) from file(s) giving transmission and/or OPD [set arguments transmission=filename and/or opd=filename] 2) from an analytic function [set function='Circle', 'Square' and set additional kwargs to define shape etc.
addRotation(*args, **kwargs) Add a clockwise or counterclockwise rotation around the optical axis
calcPSF([wavelength, weight, ...]) Calculate a PSF, either multi-wavelength or monochromatic.
describe() Print out a string table describing all planes in an optical system
display(**kwargs) Display all elements in an optical system on screen.
inputWavefront([wavelength]) Create a Wavefront object suitable for sending through a given optical system, based on the size of the first optical plane, assumed to be a pupil.
propagate_mono([wavelength, normalize, ...]) Propagate a monochromatic wavefront through the optical system.

Methods Documentation

addDetector(pixelscale, oversample=None, **kwargs)[source] [edit on github]

Add a Detector object to an optical system. By default, use the same oversampling as the rest of the optical system, but the user can override to a different value if desired by setting oversample.

Other arguments are passed to the init method for Detector().

Parameters :

pixelscale : float

Pixel scale in arcsec/pixel

oversample : int, optional

Oversampling factor for this detector, relative to hardware pixel size. Optionally distinct from the default oversampling parameter of the OpticalSystem.

addImage(optic=None, function=None, **kwargs)[source] [edit on github]

Add an image plane optic to the optical system

That image plane optic can be specified either

  1. from file(s) giving transmission or OPD

    [set arguments transmission=filename and/or opd=filename]

  2. from an analytic function

    [set function='circle, fieldstop, bandlimitedcoron, or FQPM' and set additional kwargs to define shape etc.

  3. from an already-created OpticalElement object

    [set optic=that object]

Parameters :

optic : poppy.OpticalElement

An already-created OpticalElement you would like to add

function: string :

Name of some analytic function to add. Optional kwargs can be used to set the parameters of that function. Allowable function names are CircularOcculter, fieldstop, BandLimitedCoron, FQPM

opd, transmission : string

Filenames of FITS files describing the desired optic.

Notes

Now you can use the optic argument for either an OpticalElement or a string function name, and it will do the right thing depending on type. Both existing arguments are left for back compatibility for now.

addPupil(optic=None, function=None, **kwargs)[source] [edit on github]

Add a pupil plane optic from file(s) giving transmission or OPD

  1. from file(s) giving transmission and/or OPD

    [set arguments transmission=filename and/or opd=filename]

  2. from an analytic function

    [set function='Circle', 'Square' and set additional kwargs to define shape etc.

  3. from an already-created OpticalElement object

    [set optic=that object]

Parameters :

optic : poppy.OpticalElement, optional

An already-created OpticalElement object you would like to add

function: string, optional :

The name of some analytic function you would like to use. Optional kwargs can be used to set the parameters of that function. Allowable function names are Circle, Square, Hexagon, Rectangle, and FQPM_FFT_Aligner

opd, transmission : string, optional

Filenames of FITS files describing the desired optic.

Note: Now you can use the optic argument for either an OpticalElement or a string function name, :

and it will do the right thing depending on type. Both existing arguments are left for compatibility for now. :

Any provided parameters are passed to :ref:`OpticalElement`. :

addRotation(*args, **kwargs)[source] [edit on github]

Add a clockwise or counterclockwise rotation around the optical axis

calcPSF(wavelength=1e-06, weight=None, save_intermediates=False, save_intermediates_what='all', display=False, return_intermediates=False, source=None, **kwargs)[source] [edit on github]

Calculate a PSF, either multi-wavelength or monochromatic.

The wavelength coverage computed will be: - multi-wavelength PSF over some weighted sum of wavelengths (if you provide a source parameter) - monochromatic (if you provide just a wavelen= parameter)

Any additional kwargs will be passed on to propagate_mono()

Parameters :

source : dict

a dict containing ‘wavelengths’ and ‘weights’ list. TBD - replace w/ pysynphot observation object

wavelen : float, optional

wavelength in meters for monochromatic calculation.

save_intermediates : bool

whether to output intermediate optical planes to disk. Default is False

save_intermediate_what : string

What to save - phase, intensity, amplitude, complex, parts, all. default is all.

return_intermediates: bool :

return intermediate wavefronts as well as PSF?

display : bool

whether to display when finished or not.

Returns :

outfits : :

a fits.HDUList

describe()[source] [edit on github]

Print out a string table describing all planes in an optical system

display(**kwargs)[source] [edit on github]

Display all elements in an optical system on screen.

Any extra arguments are passed to the optic.display() methods of each element.

inputWavefront(wavelength=2e-06)[source] [edit on github]

Create a Wavefront object suitable for sending through a given optical system, based on the size of the first optical plane, assumed to be a pupil.

If the first optical element is an Analytic pupil (i.e. has no pixel scale) then an array of 1024x1024 will be created (not including oversampling).

Uses self.source_offset to assign an off-axis tilt, if requested.

Parameters :

wavelength : float

Wavelength in meters

Returns :

wavefront : poppy.Wavefront instance

A wavefront appropriate for passing through this optical system.

propagate_mono(wavelength=2e-06, normalize='first', save_intermediates=False, display_intermediates=False, intermediate_fn='wave_step_%03d.fits', poly_weight=None, **kwargs)[source] [edit on github]

Propagate a monochromatic wavefront through the optical system. Called from within calcPSF. Returns a fits.HDUList object.

Parameters :

wavelength : float

Wavelength in meters

normalize : string, {‘first’, ‘last’}

how to normalize the wavefront? * ‘first’ = set total flux = 1 after the first optic, presumably a pupil * ‘last’ = set total flux = 1 after the entire optical system. * ‘first=2’ = set total flux = 2 after the first optic (used for debugging only)

display_intermediates : bool

Should intermediate steps in the calculation be displayed on screen? Default False

save_intermediates : bool

Should intermediate steps in the calculation be saved to disk? Default False. If this is True, then setting poly_weight controls whether intermediate optical planes are actually saved to disk by this routine (for the monochromatic case) or are passed back up via memory and handled in calcPSF (for the polychromatic case).

poly_weight : float

is this being called as part of a polychromatic calculation? if not, set this to None. if so, set this to the weight for that wavelength. (This is used only for properly normalizing the multiwavelength FITs file written to disk if save_intermediates is set.)

Page Contents