readraw

sofia_redux.instruments.exes.readraw.readraw(data, header, do_lincor=False, algorithm=None, toss_nint=0, copy_int=True)[source]

Correct for nonlinearity combine individual readouts.

First corrects nonlinearity for each readout frame (exes.lincor), then determines the readout pattern from the OTPAT keyword.

For readout coadding methods, this step currently has support for Fowler mode, simple destructive read, and equally spaced sample-up-the-ramp patterns. Frames are combined and variance is calculated based on the readout pattern, using algorithms from the following paper:

Nonlinearity Corrections and Statistical Uncertainties Associated with Near-Infrared Arrays, William D. Vacca, Michael C. Cushing and John T. Rayner (2004, PASP 116, 352).

The readout algorithm may also be directly specified by the algorithm parameter, which takes the following possible integer values:

  • 0 : Use the last destructive frame only

  • 1 : Simple destructive mode

  • 2 : Use the first and last frames only

  • 3 : Use the second and penultimate frames only

  • 4 : Fowler mode

  • 5 : Sample-up-the-ramp mode

After readout coadd, multiple frames taken at the same nod position (as indicated by the NINT keyword) are averaged. Extra frames that do not match the OTPAT or NINT pattern are dropped.

Parameters:
datanumpy.ndarray

[nframe, nspec, nspat] array of float values.

headerfits.Header

FITS header produced by exes.readhdr. Note that the header will be updated in-place.

do_lincorbool, optional

If True, do the nonlinear correction. If False, no check is performed on data quality: the output mask will be all False (no bad pixels).

algorithmint, optional

Used to select processing mode. If None, defaults to that determined by check_readout_pattern.

toss_nintint, optional

If provided and greater than 0 but less than the number of integrations present in the data, toss_nint integrations will be discarded from the beginning of the data array. If the number equals the number of integrations, the first nod is a B nod, and there is another B nod in the data array, the first integrations are instead replaced with a copy of the second B nod.

copy_intbool, optional

If toss_nint is greater than 0 and copy_int is True, replacement integrations are always copied from the next B nod, regardless of the number of integrations available.

Returns:
coadd_data, variance, mask3-tuple of numpy.ndarray

The coadded data, variance, and good data mask. The coadd_data and variance have shape (nframes, ny, nx). The mask has shape (ny, nx) and Boolean data type, where True indicates a good pixel; False indicates a bad pixel.