prysm.otf¶
A base optical transfer function interface.
-
class
prysm.otf.
MTF
(data, x, y=None)¶ Bases:
prysm._basicdata.BasicData
Modulation Transfer Function.
-
tan
¶ Retrieve the tangential MTF.
Notes
Assumes the object is extended in y. If the object is extended along a different azimuth, this will not return the tangential MTF.
- Returns
self.x (numpy.ndarray) – ordinate
self.data (numpy.ndarray) – coordiante
-
sag
¶ Retrieve the sagittal MTF.
Notes
Assumes the object is extended in y. If the object is extended along a different azimuth, this will not return the sagittal MTF.
- Returns
self.x (numpy.ndarray) – ordinate
self.data (numpy.ndarray) – coordiante
-
exact_polar
(freqs, azimuths=None)¶ Retrieve the MTF at the specified frequency-azimuth pairs.
- Parameters
freqs (iterable) – radial frequencies to retrieve MTF for
azimuths (iterable) – corresponding azimuths to retrieve MTF for
- Returns
MTF at the given points
- Return type
list
-
exact_xy
(x, y=None)¶ Retrieve the MTF at the specified X-Y frequency pairs.
- Parameters
x (iterable) – X frequencies to retrieve the MTF at
y (iterable) – Y frequencies to retrieve the MTF at
- Returns
MTF at the given points
- Return type
list
-
exact_tan
(freq)¶ Return data at an exact x coordinate along the y=0 axis.
- Parameters
freq (number or numpy.ndarray) – frequency or frequencies to return
- Returns
ndarray of MTF values
- Return type
numpy.ndarray
-
exact_sag
(freq)¶ Return data at an exact y coordinate along the x=0 axis.
- Parameters
freq (number or numpy.ndarray) – frequency or frequencies to return
- Returns
ndarray of MTF values
- Return type
numpy.ndarray
-
azimuthal_average
()¶ Return the azimuthally averaged MTF.
- Returns
nu (numpy.ndarray) – spatial frequencies
mtf (numpy.ndarray) – mtf values
-
plot2d
(max_freq=200, power=1, cmap='Greys_r', fig=None, ax=None)¶ Create a 2D plot of the MTF.
- Parameters
max_freq (float) – Maximum frequency to plot to. Axis limits will be ((-max_freq, max_freq), (-max_freq, max_freq)).
power (float) – inverse of power to stretch the MTF to/by, e.g. power=2 will plot MTF^(1/2)
fig (matplotlib.figure.Figure, optional:) – Figure to draw plot in
ax (matplotlib.axes.Axis, optional:) – Axis to draw plot in
- Returns
fig (matplotlib.figure.Figure) – Figure to draw plot in
ax (matplotlib.axes.Axis) – Axis to draw plot in
-
plot_tan_sag
(max_freq=200, lw=3, zorder=3, fig=None, ax=None, labels=('Tangential', 'Sagittal'))¶ Create a plot of the tangential and sagittal MTF.
- Parameters
max_freq (float) – Maximum frequency to plot to. Axis limits will be ((-max_freq, max_freq), (-max_freq, max_freq))
lw (float, optional) – line width
zorder (int) – zorder
fig (matplotlib.figure.Figure, optional:) – Figure to draw plot in
ax (matplotlib.axes.Axis, optional:) – Axis to draw plot in
labels (iterable) – set of labels for the two lines that will be plotted
- Returns
fig (matplotlib.figure.Figure) – Figure to draw plot in
ax (matplotlib.axes.Axis) – Axis to draw plot in
-
plot_azimuthal_average
(max_freq=200, lw=3, zorder=3, fig=None, ax=None)¶ Create a plot of the azimuthally averaged MTF.
- Parameters
max_freq (float) – Maximum frequency to plot to. Axis limits will be ((-max_freq, max_freq), (-max_freq, max_freq))
lw (float, optional) – line width
zorder (int, optional) –
fig (matplotlib.figure.Figure, optional:) – Figure to draw plot in
ax (matplotlib.axes.Axis, optional:) – Axis to draw plot in
labels (iterable) – set of labels for the two lines that will be plotted
- Returns
fig (matplotlib.figure.Figure) – Figure to draw plot in
ax (matplotlib.axes.Axis) – Axis to draw plot in
-
static
from_psf
(psf)¶ Generate an MTF from a PSF.
- Parameters
psf (PSF) – PSF to compute an MTF from
- Returns
A new MTF instance
- Return type
MTF
-
static
from_pupil
(pupil, efl, Q=2)¶ Generate an MTF from a pupil, given a focal length (propagation distance).
- Parameters
pupil (Pupil) – A pupil to propagate to a PSF, and convert to an MTF
efl (float) – Effective focal length or propagation distance of the wavefunction
Q (number) – ratio of pupil sample count to PSF sample count. Q > 2 satisfies nyquist
- Returns
A new MTF instance
- Return type
MTF
-
center_x
¶ Center “pixel” in x.
-
center_y
¶ Center “pixel” in y.
-
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)
-
-
prysm.otf.
diffraction_limited_mtf
(fno, wavelength, frequencies=None, samples=128)¶ Give the diffraction limited MTF for a circular pupil and the given parameters.
- Parameters
fno (float) – f/# of the lens.
wavelength (float) – wavelength of light, in microns.
frequencies (numpy.ndarray) – spatial frequencies of interest, in cy/mm if frequencies are given, samples is ignored.
samples (int) – number of points in the output array, if frequencies not given.
- Returns
if frequencies not given –
- frequenciesnumpy.ndarray
array of ordinate data
- mtfnumpy.ndarray
array of coordinate data
else –
- mtfnumpy.ndarray
array of MTF data
Notes
If frequencies are given, just returns the MTF. If frequencies are not given, returns both the frequencies and the MTF.
-
prysm.otf.
longexposure_otf
(nu, Cn, z, f, lambdabar, h_z_by_r=2.91)¶ Compute the long exposure OTF for given parameters.
- Parameters
nu (numpy.ndarray) – spatial frequencies, cy/mm
Cn (float) – atmospheric structure constant of refractive index, ranges ~ 10^-13 - 10^-17
z (float) – propagation distance through atmosphere, m
f (float) – effective focal length of the optical system, mm
lambdabar (float) – mean wavelength, microns
h_z_by_r (float, optional) – constant for h[z/r] – see Eq. 8.5-37 & 8.5-38 in Statistical Optics, J. Goodman, 2nd ed.
- Returns
the OTF
- Return type
numpy.ndarray
-
prysm.otf.
estimate_Cn
(P=1013, T=273.15, Ct=0.0001)¶ Use Weng et al to estimate Cn from meteorological data.
- Parameters
P (float) – atmospheric pressure in hPa
T (float) – temperature in Kelvin
Ct (float) – atmospheric struction constant of temperature, typically 10^-5 - 10^-2 near the surface
- Returns
Cn
- Return type
float