stack

sofia_redux.instruments.forcast.stack.stack(data, header, variance=None, mask=None, extra=None, stat='mode')[source]

Subtracts chop/nod pairs to remove astronomical/telescope background

This function uses sofia_redux.instruments.forcast.readmode to read the chop/nod mode from the header; this determines how the frames are subtracted. If the BGSUB keyword is set to True in the configuration file, then any residual background level will be subtracted from the stacked data. If the BGSCALE keyword is set to True in the configuration file, the individual frames will be multiplicatively scaled to the same level before subtraction. If the JBCLEAN keyword is set to median, sofia_redux.instruments.forcast.jbclean will be called on the stacked data. At the end of the function, the units will be converted to mega-electrons per second, using FRMRATE and EPERADU keywords in the header.

Parameters:
datanumpy.ndarray

Input data array (nimage, nrow, ncol)

headerastropy.io.fits.header.Header

Input FITS header; will be updated with HISTORY message

variancenumpy.ndarray, optional

Variance array (nimage, nrow, ncol) to update in parallel with the data array.

masknumpy.ndarray, optional

(col, row) Illumination mask to indicate regions of the image to use in calculating the background (True = good)

extradict, optional
If provided, will be updated with:

posdata -> numpy.ndarray: summed stacks chopsub -> numpy.ndarray: chop-subtracted data nodsub -> numpy.ndarray: nod-subtracted data

stat{‘mode’, ‘median’}

Statistic to use in calculating the residual background.

Returns:
2-tuple
  • numpy.ndarray (nrow, ncol) stacked data

  • numpy.ndarray (nrow, ncol)