JWST POPPY:docs

Wavefront

class poppy.Wavefront(wavelength=2e-06, npix=1024, dtype=<type 'numpy.complex128'>, diam=8.0, oversample=2, pixelscale=None)[source] [edit on github]

Bases: object

A class representing a monochromatic wavefront that can be transformed between pupil and image planes (but not to intermediate planes, yet).

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.propagateTo() 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 :

wavelength : float

Wavelength of light in meters

npix : int

Size parameter for wavefront array to create, per side.

diam : float, 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.

pixelscale : float, optional

For _IMAGE PLANE wavefronts, use this pixel scale.

oversample : int, optional

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

dtype : numpy.dtype, optional

default is double complex.

Attributes Summary

amplitude Electric field amplitude of the wavefront
intensity Electric field intensity of the wavefront (i.e.
phase Phase of the wavefront, in radians
shape Shape of the wavefront array
totalIntensity Integrated intensity over the entire spatial/angular extent of the wavefront

Methods Summary

asFITS([what, includepadding]) Return a wavefront as a pyFITS HDUList object :Parameters: what : string what kind of data to write.
coordinates() Return Y, X coordinates for this wavefront, in the manner of numpy.indices() This function knows about the offset resulting from FFTs.
copy() Return a copy of the wavefront as a different object.
display([what, nrows, row, showpadding, ...]) Display wavefront on screen :Parameters: what : string What to display.
normalize() Set this wavefront’s total intensity to 1
propagateTo(optic) Propagates a wavefront object to the next optic in the list.
rotate([angle]) Rotate a wavefront by some amount :Parameters: angle : float Angle to rotate, in degrees counterclockwise.
tilt([Xangle, Yangle]) Tilt a wavefront in X and Y.
writeto(filename[, clobber]) Write a wavefront to a FITS file.

Attributes Documentation

amplitude

Electric field amplitude of the wavefront

intensity

Electric field intensity of the wavefront (i.e. field amplitude squared)

phase

Phase of the wavefront, in radians

shape

Shape of the wavefront array

totalIntensity

Integrated intensity over the entire spatial/angular extent of the wavefront

Methods Documentation

asFITS(what='intensity', includepadding=False, **kwargs)[source] [edit on github]

Return a wavefront as a pyFITS HDUList object

Parameters :

what : string

what kind of data to write. Must be one of ‘parts’, ‘intensity’, ‘complex’. The default is to write a file containing intensity.

includepadding : bool

include any “padding” region, if present, in the returned FITS file?

coordinates()[source] [edit on github]

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 measures in wavefront coordinates.

Returns :

Y, X : array_like

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

copy()[source] [edit on github]

Return a copy of the wavefront as a different object.

display(what='intensity', nrows=1, row=1, showpadding=False, imagecrop=None, colorbar=False, crosshairs=True, ax=None, title=None, vmin=1e-08, vmax=1.0)[source] [edit on github]

Display wavefront on screen

Parameters :

what : string

What to display. Must be one of {intensity, phase, best}. ‘Best’ implies to display the phase if there is nonzero OPD, or else display the intensity for a perfect pupil.

nrows : int

Number of rows to display in current figure (used for showing steps in a calculation)

row : int

Which row to display this one in?

imagecrop : float, optional

For image planes, set the maximum # of arcseconds to display. Default is 5, so only the innermost 5x5 arcsecond region will be shown. This default may be changed in the POPPY config file. If the image size is < 5 arcsec then the entire image is displayed.

showpadding : bool, optional

Show the entire padded arrays, or just the good parts? Default is False

colorbar : bool

Display colorbar

ax : matplotlib Axes

axes to display into

Returns :

figure : matplotlib figure

The current figure is modified.

normalize()[source] [edit on github]

Set this wavefront’s total intensity to 1

propagateTo(optic)[source] [edit on github]

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

Parameters :

optic : OpticalElement

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

rotate(angle=0.0)[source] [edit on github]

Rotate a wavefront by some amount

Parameters :

angle : float

Angle to rotate, in degrees counterclockwise.

tilt(Xangle=0.0, Yangle=0.0)[source] [edit on github]

Tilt a wavefront in X and Y.

Recall from Fourier optics (although this is straightforwardly rederivable by drawing triangles) that for a wavefront tilted by some angle theta in radians, that a point r meters from the center of the pupil has:

extra_pathlength = sin(theta) * r extra_waves = extra_pathlength/ wavelength = r * sin(theta) / wavelength

So we calculate the U and V arrays (corresponding to r for the pupil, in meters from the center) and then multiply by the appropriate trig factors for the angle.

The sign convention is chosen such that positive Yangle tilts move the star upwards in the array at the focal plane. (This is sort of an inverse of what physically happens in the propagation to or through focus, but we’re ignoring that here and trying to just work in sky coords)

Parameters :

Xangle, Yangle : float

tilt angles, specified in arcseconds

writeto(filename, clobber=True, **kwargs)[source] [edit on github]

Write a wavefront to a FITS file.

Parameters :

filename : string

filename to use

what : string

what to write. Must be one of ‘parts’, ‘intensity’, ‘complex’

clobber : bool, optional

overwhat existing? default is True

Returns :

outfile: file on disk :

The output is written to disk.

Page Contents