class lentil.Grism(trace, dispersion, pixelscale=None, amplitude=1, phase=0, mask=None)[source]

Class for representing a grism.

A grism is an optical element that can be inserted into a collimated beam to disperse incoming light according to its wavelength.

Light is dispersed along a line called the the spectral trace. The position along the trace is determined by the dispersion function of the grism. The local origin of the spectral trace is anchored relative to the undispersed position of the source. This basic geometry is illustrated in the figure below:


The spectral trace is parameterized by a polynomial of the form

\[y = a_n x^n + \cdots + a_2 x^2 + a_1 x + a_0\]

and should return units of meters on the focal plane provided an input in meters on the focal plane.

Similarly, the wavelength along the trace is parameterized by a polynomial of the form

\[\lambda = a_n d^n + \cdots + a_2 d^2 + a_1 d + a_0\]

and should return units of meters of wavelength provided an input distance along the spectral trace.


Lentil supports trace and dispersion functions with any arbitrary polynomial order. While a simple analytic solution exists for modeling first-order trace and/or dispersion, there is no general solution for higher order functions.

As a result, trace and/or dispersion polynomials with order > 1 are evaluated numerically. Although the effects are small, this approach impacts both the speed and precision of modeling grisms with higher order trace and/or dispersion functions. In cases where speed or accuracy are extremely important, a custom solution may be required.

  • trace (array_like) – Polynomial coefficients describing the spectral trace produced by the grism in decreasing powers (i.e. trace[0] represents the highest order coefficient and trace[-1] represents the lowest).

  • dispersion (array_like) – Polynomial coefficients describing the dispersion produced by the grism in decreasing powers (i.e. dispersion[0] represents the highest order coefficient and dispersion[-1] represents the lowest.)



Electric field amplitude transmission


Number of independent masks (segments) in mask


Flattened view of mask


Binary mask


Electric field phase shift


Physical (row, col) sampling of each pixel in the Plane.


2D vector representing piston and tilt in x and y.


Plane dimensions computed from mask.



List of additional Tilt terms associated wirth this Plane



Make a copy of this object.


Fit and remove tilt from Plane phase via least squares.

multiply(wavefront[, inplace])

Multiply with a wavefront

resample(pixelscale[, inplace])

Resample a plane via interpolation.

rescale(scale[, inplace])

Rescale a plane via interpolation.

shift(wavelength[, xs, ys])