prysm.mtf_utils#

Utilities for working with MTF data.

class prysm.mtf_utils.MTFvFvF(data, focus, field, freq, azimuth)#

Bases: object

Abstract object representing a cube of MTF vs Field vs Focus data.

azimuth#

Azimuth associated with the data

Type

str

data#

3D array of data in shape (focus, field, freq)

Type

numpy.ndarray

field#

array of fields associated with the field axis of data

Type

numpy.ndarray

focus#

array of focus associated with the focus axis of data

Type

numpy.ndarray

freq#

array of frequencies associated with the frequency axis of data

Type

numpy.ndarray

plot2d(freq, symmetric=False, contours=True, interp_method='lanczos', fig=None, ax=None)#

Create a 2D plot of the cube, an “MTF vs Field vs Focus” plot.

Parameters
  • freq (float) – frequency to plot, will be rounded to the closest value present in the self.freq iterable

  • symmetric (bool) – make the plot symmetric by mirroring it about the x-axis origin

  • contours (bool) – plot contours

  • interp_method (string) – interpolation method used for the plot

  • fig (matplotlib.figure.Figure, optional:) – Figure to plot inside

  • ax (matplotlib.axes.Axis, optional:) – Axis to plot inside

Returns

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

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

plot_thrufocus_singlefield(field, freqs=(10, 20, 30, 40, 50), _range=100, fig=None, ax=None)#

Create a plot of Thru-Focus MTF for a single field point.

Parameters
  • field (float) – which field point to plot, in same units as self.field

  • freqs (iterable) – frequencies to plot, will be rounded to the closest values present in the self.freq iterable

  • _range (float) – +/- focus range to plot, symmetric

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

  • ax (matplotlib.axes.Axis) – Axis to plot inside

Returns

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

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

trace_focus(algorithm='avg')#

Find the focus position in each field.

This is, in effect, the “field curvature” for this azimuth.

Parameters

algorithm (str) – algorithm to use to trace focus, currently only supports ‘0.5’, see notes for a description of this technique

Returns

  • field (numpy.ndarray) – array of field values, mm

  • focus (numpy.ndarray) – array of focus values, microns

Notes

Algorithm ‘0.5’ uses the frequency that has its peak closest to 0.5 on-axis to estimate the focus coresponding to the minimum RMS WFE condition. This is based on the following assumptions:

  • Any combination of third, fifth, and seventh order spherical

    aberration will produce a focus shift that depends on frequency, and this dependence can be well fit by an equation of the form y(x) = ax^2 + bx + c. If this is true, then the frequency which peaks at 0.5 will be near the vertex of the quadratic, which converges to the min RMS WFE condition.

  • Coma, while it enhances depth of field, does not shift the

    focus peak.

  • Astigmatism and field curvature are the dominant cause of any

    shift in best focus with field.

  • Chromatic aberrations do not influence the thru-focus MTF peak

    in a way that varies with field.

Raises

ValueError – if an unsupported algorithm is entered

static from_dataframe(df)#

Return a pair of MTFvFvF objects for the tangential and one for the sagittal MTF.

Parameters

df (pandas.DataFrame) – a dataframe with columns Focus, Field, Freq, Azimuth, MTF

Returns

  • t_cube (MTFvFvF) – tangential MTFvFvF

  • s_cube (MTFvFvF) – sagittal MTFvFvF

static from_trioptics_file(file_path)#

Create a new MTFvFvF object from a trioptics file.

Parameters

file_path (path_like) – path to a file

Returns

new MTFvFvF object

Return type

MTFvFvF

prysm.mtf_utils.plot_mtf_vs_field(data_dict, fig=None, ax=None, labels=('MTF', 'Freq [lp/mm]', 'Field [mm]', 'Az'), palette=None)#

Plot MTF vs Field.

Parameters
  • data_dict (dict) – dictionary with keys tan, sag, fields, freq

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

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

Returns

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

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