Base Classes

class prysm._basicdata.BasicData(x, y, data)

Bases: object

Abstract base class holding some data properties.

shape

Proxy to phase or data shape.

size

Proxy to phase or data size.

samples_x

Number of samples in the x dimension.

samples_y

Number of samples in the y dimension.

sample_spacing

center-to-center sample spacing.

center_x

Center “pixel” in x.

center_y

Center “pixel” in y.

slice_x

Retrieve a slice through the X axis of the phase.

Returns

  • self.unit (numpy.ndarray) – ordinate axis

  • slice of self.phase or self.data (numpy.ndarray)

slice_y

Retrieve a slice through the Y axis of the phase.

Returns

  • self.unit (numpy.ndarray) – ordinate axis

  • slice of self.phase or self.data (numpy.ndarray)

copy()

Return a (deep) copy of this instance.

class prysm._phase.OpticalPhase(x, y, phase, phase_unit, spatial_unit, wavelength=None)

Bases: prysm._basicdata.BasicData

Phase of an optical field.

phase_unit

Unit used to describe the optical phase.

spatial_unit

Unit used to describe the spatial phase.

pv

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

rms

RMS phase error. DIN/ISO Sq.

Sa

Sa phase error. DIN/ISO Sa.

std

Standard deviation of phase error.

diameter_x

Diameter of the data in x.

diameter_y

Diameter of the data in y.

diameter

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

semidiameter

Half of self.diameter.

change_phase_unit(to, inplace=True)

Change the units used to describe the phase.

Parameters
  • to (str) – new unit, a member of OpticalPhase.units.keys()

  • inplace (bool, optional) – whether to change self.phase, if False, returns updated phase, if True, returns self.

Returns

  • `new_phase` (np.ndarray) – new phase data

  • OR

  • `self` (OpticalPhase) – self

center_x

Center “pixel” in x.

center_y

Center “pixel” in y.

change_spatial_unit(to, inplace=True)

Change the units used to describe the spatial dimensions.

Parameters
  • to (str) – new unit, a member of OpticalPhase.units.keys()

  • inplace (bool, optional) – whether to change self.x and self.y. If False, returns updated phase, if True, returns self

Returns

  • `new_ux` (np.ndarray) – new ordinate x axis

  • `new_uy` (np.ndarray) – new ordinate y axis

  • OR

  • `self` (OpticalPhase) – self

copy()

Return a (deep) copy of this instance.

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.

shape

Proxy to phase or data shape.

size

Proxy to phase or data size.

slice_x

Retrieve a slice through the X axis of the phase.

Returns

  • self.unit (numpy.ndarray) – ordinate axis

  • slice of self.phase or self.data (numpy.ndarray)

slice_y

Retrieve a slice through the Y axis of the phase.

Returns

  • self.unit (numpy.ndarray) – ordinate axis

  • slice of self.phase or self.data (numpy.ndarray)

plot2d(cmap='inferno', clim=(None, None), interp_method='lanczos', show_colorbar=True, fig=None, ax=None)

Plot the phase in 2D.

Parameters
  • cmap (str) – colormap to use, passed directly to matplotlib

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

  • show_colorbar (bool, optional) – whether to draw the colorbar

  • 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

plot_slice_xy(lw=3, zorder=3, fig=None, ax=None)

Create a plot of slices through the X and Y axes of the Pupil.

Parameters
  • lw (float, optional) – line width

  • zorder (int, optional) – zorder

  • 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

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

Create an interferogram of the Pupil.

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