prysm.propagation

Numerical optical propagation.

prysm.propagation.prop_pupil_plane_to_psf_plane(wavefunction, Q, incoherent=True, norm=None)

Propagate a pupil plane to a PSF plane and compute the grid along which the PSF exists.

Parameters
  • wavefunction (numpy.ndarray) – the pupil wavefunction

  • Q (float) – oversampling / padding factor

  • incoherent (bool, optional) – whether to return the incoherent (real valued) PSF, or the coherent (complex-valued) PSF. Incoherent = |coherent|^2

  • norm (str, {None, ‘ortho’}) – normalization parameter passed directly to numpy/cupy fft

Returns

psf – incoherent point spread function

Return type

numpy.ndarray

prysm.propagation.prop_pupil_plane_to_psf_plane_units(wavefunction, input_sample_spacing, prop_dist, wavelength, Q)

Compute the ordinate axes for a pupil plane to PSF plane propagation.

Parameters
  • wavefunction (numpy.ndarray) – the pupil wavefunction

  • input_sample_spacing (float) – spacing between samples in the pupil plane

  • prop_dist (float) – propagation distance along the z distance

  • wavelength (float) – wavelength of light

  • Q (float) – oversampling / padding factor

Returns

  • x (numpy.ndarray) – x axis unit, 1D ndarray

  • y (numpy.ndarray) – y axis unit, 1D ndarray

prysm.propagation.pupil_sample_to_psf_sample(pupil_sample, samples, wavelength, efl)

Convert pupil sample spacing to PSF sample spacing.

Parameters
  • pupil_sample (float) – sample spacing in the pupil plane

  • samples (int) – number of samples present in both planes (must be equal)

  • wavelength (float) – wavelength of light, in microns

  • efl (float) – effective focal length of the optical system in mm

Returns

the sample spacing in the PSF plane

Return type

float

prysm.propagation.psf_sample_to_pupil_sample(psf_sample, samples, wavelength, efl)

Convert PSF sample spacing to pupil sample spacing.

Parameters
  • psf_sample (float) – sample spacing in the PSF plane

  • samples (int) – number of samples present in both planes (must be equal)

  • wavelength (float) – wavelength of light, in microns

  • efl (float) – effective focal length of the optical system in mm

Returns

the sample spacing in the pupil plane

Return type

float

class prysm.propagation.Wavefront(x, y, fcn, wavelength)

Bases: prysm._richdata.RichData

(Complex) representation of a wavefront.

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.

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

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

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.

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