# lentil.Grism¶

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.

Note

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.

Parameters
• 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.)

Attributes

 amplitude Electric field amplitude transmission depth Number of independent masks (segments) in mask global_mask Flattened view of mask mask Binary mask phase Electric field phase shift pixelscale Physical (row, col) sampling of each pixel in the Plane. ptt_vector 2D vector representing piston and tilt in x and y. shape Plane dimensions computed from mask. slice tilt List of additional Tilt terms associated wirth this Plane

Methods

 Make a copy of this object. fit_tilt([inplace]) 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])