stack_map

sofia_redux.instruments.forcast.stack.stack_map(data, header, variance=None, bglevel=None, extra=None)[source]

Run the stacking algorithm on MAP (Mapping mode) data

Calculates the chop and nod-subtracted frames. For each frame in a set of 4 using scale s, the algorithm would be:

  1. chop1 = frame1 - (frame2 * s1/s2)

  2. chop2 = frame3 - (frame4 * s3/s4)

  3. nod = chop1 - (chop2 * s1/s3)

  4. result = sum(nods from each set of 4)

  5. if NODBEAM = ‘B’, multiply by -1

If the number of frames is not divisible by four, frames at the end will be clipped from any reductions. e.g., in the above algorithm, if there were 10 frames, only frames 1-8 would be included. i.e. steps 1-3 would be run on frames 1-4, then on frames 5-8, and then the sum would be returned.

Parameters:
datanumpy.ndarray

(npos, nrow, ncol)

headerastropy.io.fits.header.Header

FITS header to update with HISTORY messages

variancenumpy.ndarray, optional

variance array to propagate (npos, nrow, ncol)

bglevelarray_like, optional

should be of length npos

extradict, optional
If set will be updated with:
chopsub -> numpy.ndarray (npos / 2, nrow, ncol)

chop-subtracted data

nodsub -> numpy.ndarray (npos / 4, nrow, ncol)

nod-subtracted data

Returns:
2-tuple

numpy.ndarray : The stacked data array (nrow, ncol) numpy.ndarray : The propagated variance array (nrow, ncol)