mkspecimg

sofia_redux.instruments.flitecam.mkspecimg.mkspecimg(infiles, pair_subtract=True, flatfile=None, filenum=None)[source]

Rotate and pair-subtract spectral images.

The process is:

  • Divide by the flat if provided.

  • If subtraction is desired, sort infiles by date-obs, then subtract all pairs in order.

  • Rotate the image 90 degrees counter-clockwise to align the spectral direction along the x-axis.

  • Propagate variance accordingly.

Parameters:
infileslist of fits.HDUList

Input data. Should have FLUX, ERROR, and BADMASK extensions.

pair_subtractbool, optional

If True, data will be subtracted in pairs, in order by time observed. If an odd number of files is specified, the last one will be dropped from the reduction.

flatfilestr, optional

Path to FITS file containing flat data to divide into the image. Should be in Spextool format, readable by sofia_redux.spectroscopy.readflat.readflat.

filenumlist of int or str, optional

List of file numbers corresponding to the input. Will be updated to match the order and pairs of file numbers corresponding to the output, and returned as a secondary output.

Returns:
outfileslist of fits.HDUList

Pair-subtracted spectral images.

filenumlist of int or str, optional

If an input filenum list is specified, the output is tuple(outfiles, filenum), where filenum is a list of file numbers matching the output order, if no pair subtraction is done. If pair subtraction was done, filenum is a list of lists of file numbers, where each element is the pair of input file numbers.