rectifyorder

sofia_redux.spectroscopy.rectifyorder.rectifyorder(image, ordermask, wavecal, spatcal, order, header=None, variance=None, mask=None, bitmask=None, x=None, y=None, dw=None, ds=None, badfrac=0.1, ybuffer=3, xbuffer=None, poly_order=3)[source]

Construct average spatial profiles for a single order

See sofia_redux.spectroscopy.mkspatprof and sofia_redux.spectroscopy.extspec for algorithm description.

Parameters:
imagenumpy.ndarray of float (nrow, ncol)

2-d image

ordermasknumpy.ndarray of int (nrow, ncol)

Order number of each pixel

wavecalnumpy.ndarray of float (nrow, ncol)

Wavelength of each pixel

spatcalnumpy.ndarray of float (nrow, ncol)

Spatial coordinates of each pixel

orderint

order to process

headerfits.Header

Header to update with spectral WCS.

variancenumpy.ndarray of float (nrow, ncol), optional

Variance to rectify parallel to the image.

masknumpy.ndarray of bool (nrow, ncol), optional

Mask indicating good (True) and bad (False) pixels.

bitmasknumpy.ndarray of int (nrow, ncol), optional

bit-set flags of each pixel.

xnumpy.array, optional

(nrow, ncol) x-coordinates

ynumpy.array, optional

(nrow, ncol) y-coordinates

dwfloat, optional

Delta lambda based on the span of the order in pixels and wavelengths.

dsfloat, optional

The spatial sampling of the resampling slit in arcseconds, typically given by slth_arc / slth_pix.

xbufferint, optional

The number of pixels to ignore near the left and right of the slit.

ybufferint, optional

The number of pixels to ignore near the top and bottom of the slit.

badfracfloat, optional

If defines the maximum area of a pixel to be missing before that pixel should be considered bad. For example, a badfrac of 0.1 means that output flux of a pixel must be the sum of at least 0.9 input pixels.

poly_orderint, optional

Polynomial order to use when converting wavecal and spatcal to rectified values.

Returns:
dict

image -> numpy.ndarray (ns, nw) wave -> numpy.ndarray (nw,) spatial -> numpy.ndarray (ns,) mask -> numpy.ndarray (ns, nw) bitmask -> numpy.ndarray (ns, nw) pixsum -> numpy.ndarray (ns, nw) variance -> numpy.ndarray (ns, nw) header -> fits.Header