# evaldisp¶

stistools.evaldisp.evalDisp(coeff, wl)

Return the pixel corresponding to wavelength wl.

Parameters:
coeffarray_like object

a list of eight elements containing the dispersion coefficients as read from a STIS _dsp.fits table

wlfloat or ndarray

a single wavelength or an array (numarray) of wavelengths, in Angstroms

Returns:
pix_numberfloat or ndarray

the pixel number (or array of pixel numbers) corresponding to the input wavelength(s); note that these are zero indexed

Notes

The expression in the calstis code is:

```x = coeff[0] +
coeff[1] * m * wl +
coeff[2] * m**2 * wl**2 +
coeff[3] * m +
coeff[4] * wl +
coeff[5] * m**2 * wl +
coeff[6] * m * wl**2 +
coeff[7] * m**3 * wl**3
```

This version of the function to evaluate the dispersion relation assumes that the grating is first order, i.e. m = 1. The dispersion coefficients give one-indexed pixel coordinates (reference pixels), but this function converts to zero-indexed pixels.

stistools.evaldisp.newton(x, coeff, cenwave, niter=4)

Return the wavelength corresponding to pixel x.

The dispersion solution is evaluated iteratively, and the slope (dispersion) for Newton's method is determined numerically, using a difference in wavelength of one Angstrom. Note that the evalDisp in this file assumes that the grating is first order.

Parameters:
xfloat or ndarray

a single pixel number or an array of pixel numbers

coeffarray_like object

a list of eight elements containing the dispersion coefficients as read from a STIS _dsp.fits table

cenwaveint or float

central wavelength, in Angstroms

niterint

number of iterations

Returns:
wavelengthfloat or ndarray

a single wavelength or an array (numarray) of wavelengths, in Angstroms