prysm.pupil¶
A base pupil interface for different aberration models.
-
class
prysm.pupil.
Pupil
(samples=128, dia=1.0, wavelength=0.55, opd_unit='waves', mask='circle', mask_target='both', ux=None, uy=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
-
mask
(mask, target, nanify=True)¶ Apply a mask to the pupil.
Used to implement vignetting, chief ray angles, etc.
- Parameters
mask (str or numpy.ndarray) – if a string, uses geometry.mcache for high speed access to a mask with a given shape, e.g. mask=’circle’ or mask=’hexagon’. If an ndarray, directly use the mask.
target (str, {‘phase’, ‘fcn’, ‘both’}) – which array to mask
nanify (bool, optional) – if True, make (target) equal to NaN where the mask is zero.
- Returns
self, the pupil instance
- Return type
Pupil
-
Sa
¶ Sa phase error. DIN/ISO Sa.
-
center_x
¶ Center “pixel” in x.
-
center_y
¶ Center “pixel” in y.
-
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
-
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.
-
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.
-
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
-
phase_unit
¶ Unit used to describe the optical phase.
-
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
-
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.
-
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)
-
spatial_unit
¶ Unit used to describe the spatial phase.
-
std
¶ Standard deviation of phase error.
-
static
from_interferogram
(interferogram, wvl=None)¶ 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
-