prysm.pupil

A base pupil interface for different aberration models.

class prysm.pupil.Pupil(samples=128, dia=1, labels=None, xy_unit=None, z_unit=None, wavelength=None, phase_mask='circle', transmission='circle', x=None, y=None, phase=None)

Bases: prysm._phase.OpticalPhase

Pupil of an optical system.

strehl

Strehl ratio of the pupil.

fcn

Complex wavefunction associated with the pupil.

build()

Construct a numerical model of a Pupil.

The method should be overloaded by all subclasses to impart their unique mathematical models to the simulation.

Returns

this pupil instance

Return type

Pupil

Sa

Sa phase error. DIN/ISO Sa.

astype(other_type)

Change this instance of one type into another.

Useful to access methods of the other class.

Parameters

other_type (object) – the name of the other type to “cast” to, e.g. Interferogram. Not a string.

Returns

type-converted to the other type.

Return type

self

center_x

Center “pixel” in x.

center_y

Center “pixel” in y.

change_xy_unit(to, inplace=True)

Change the x/y unit to a new one, scaling the data in the process.

Parameters
  • to (astropy.unit or str) – if not an astropy unit, a string that is a valid attribute of astropy.units.

  • inplace (bool, optional) – if True, returns self. Otherwise returns the modified data.

Returns

  • RichData – self, if inplace=True

  • numpy.ndarray, numpy.ndarray – x, y from self, if inplace=False

change_z_unit(to, inplace=True)

Change the z unit to a new one, scaling the data in the process.

Parameters
  • to (astropy.unit or str) – if not an astropy unit, a string that is a valid attribute of astropy.units.

  • inplace (bool, optional) – if True, returns self. Otherwise returns the modified data.

Returns

  • RichData – self, if inplace=True

  • numpy.ndarray – data from self, if inplace=False

copy()

Return a (deep) copy of this instance.

diameter

Greater of (self.diameter_x, self.diameter_y).

diameter_x

Diameter of the data in x.

diameter_y

Diameter of the data in y.

exact_polar(rho, phi=None)

Retrieve data at the specified radial coordinates pairs.

Parameters
  • r (iterable) – radial coordinate(s) to sample

  • phi (iterable) – azimuthal coordinate(s) to sample

Returns

data at the given points

Return type

numpy.ndarray

exact_x(x)

Return data at an exact x coordinate along the y=0 axis.

Parameters

x (number or numpy.ndarray) – x coordinate(s) to return

Returns

ndarray of values

Return type

numpy.ndarray

exact_xy(x, y=None)

Retrieve data at the specified X-Y frequency pairs.

Parameters
  • x (iterable) – X coordinate(s) to retrieve

  • y (iterable) – Y coordinate(s) to retrieve

Returns

data at the given points

Return type

numpy.ndarray

exact_y(y)

Return data at an exact y coordinate along the x=0 axis.

Parameters

y (number or numpy.ndarray) – y coordinate(s) to return

Returns

ndarray of values

Return type

numpy.ndarray

interferogram(visibility=1, passes=2, interpolation='lanczos', fig=None, ax=None)

Create a picture of fringes.

Parameters
  • visibility (float) – Visibility of the interferogram

  • passes (float) – Number of passes (double-pass, quadra-pass, etc.)

  • interp_method (str, optional) – interpolation method, passed directly to matplotlib

  • fig (matplotlib.figure.Figure, optional) – Figure to draw plot in

  • ax (matplotlib.axes.Axis) – Axis to draw plot in

Returns

  • fig (matplotlib.figure.Figure, optional) – Figure containing the plot

  • ax (matplotlib.axes.Axis, optional:) – Axis containing the plot

phase

Phase is the Z (“height” or “opd”) data.

plot2d(xlim=None, ylim=None, clim=None, cmap=None, log=False, power=1, interpolation=None, show_colorbar=True, show_axlabels=True, fig=None, ax=None)

Plot the data in 2D.

Parameters
  • xlim (float or iterable, optional) – x axis limits. If not iterable, symmetric version of the single value

  • ylim (float or iterable, optional) – y axis limits. If None and xlim is not None, copied from xlim. If not iterable, symmetric version of the single value.

  • clim (iterable, optional) – clim passed directly to matplotlib. If None, looked up on self._default_clim.

  • cmap (str, optional) – colormap to use, passed directly to matplotlib if not None. If None, looks up the default cmap for self._data_type on config

  • log (bool, optional) – if True, plot on a log color scale

  • power (float, optional) – if not 1, plot on a power stretched color scale

  • interpolation (str, optional) – interpolation method to use, passed directly to matplotlib

  • show_colorbar (bool, optional) – if True, draws the colorbar

  • show_axlabels (bool, optional) – if True, draws the axis labels

  • fig (matplotlib.figure.Figure) – Figure containing the plot

  • ax (matplotlib.axes.Axis) – Axis containing the plot

Returns

  • fig (matplotlib.figure.Figure) – Figure containing the plot

  • ax (matplotlib.axes.Axis) – Axis containing the plot

pv

Peak-to-Valley phase error. DIN/ISO St.

rms

RMS phase error. DIN/ISO Sq.

sample_spacing

center-to-center sample spacing.

samples_x

Number of samples in the x dimension.

samples_y

Number of samples in the y dimension.

semidiameter

Half of self.diameter.

shape

Proxy to phase or data shape.

size

Proxy to phase or data size.

slices(twosided=None)

Create a Slices instance from this instance.

Parameters

twosided (bool, optional) – if None, copied from self._default_twosided

Returns

a Slices object

Return type

Slices

std

Standard deviation of phase error.

static from_interferogram(interferogram, wvl=None, mask_phase=True)

Create a new Pupil instance from an interferogram.

Parameters
  • interferogram (Interferogram) – an interferogram object

  • wvl (float, optional) – wavelength of light, in micrometers, if not present in interferogram.meta

Returns

new Pupil instance

Return type

Pupil

Raises

ValueError – wavelength not present