split_grating_and_chop¶
- sofia_redux.instruments.fifi_ls.split_grating_and_chop.split_grating_and_chop(filename, write=False, outdir=None)[source]¶
Split FIFI-LS raw data file into separate FITS files.
Files are split based on the chop cycle, with each of the grating positions in a separate FITS extension in each file.
The procedure is:
Read a raw data FITS file
(optional) Check header for compliance with SOFIA requirements. Abort if failure.
Reorganize data according to chopper phase and inductosyn position.
(optional) Write output files to disk
FITS files written to disk will each contain data from a single chopper phase. The typical case is a 2-point chop, for which two FITS files are written. No-chop mode is also supported, in which case one file is written to disk. The zeroth extension in the output file contains the prime header only. There are n_scan image extensions, containing a header (includes the keyword INDPOS, indicating the inductosyn positions of the scan) and a data array, with dimensions [26, 18] x (readout frames).
For A nods taken in OTF (scanning) mode, an additional binary table is attached to the file, containing the on-sky position for each readout sample. The table has columns DLAM_MAP, DBET_MAP, FLAG, and UNIXTIME, where DLAM_MAP and DBET_MAP indicate the RA and Dec offset from the base position, respectively, and UNIXTIME indicates the time in UNIX seconds for the readout. The FLAG column holds a Boolean value indicating scanning status: if True, the telescope was in scanning motion for the readout; if False, scanning motion had either not begun, or had stopped prior to the readout. Readouts for which the FLAG is False may not have accurate position data.
Only 2-point chopper schemes are allowed (C_SCHEME=’2POINT’). If the chop amplitude (C_AMP) is zero, it will be treated as a no-chop (“total power”) observation.
The output file name is generated from the flight number, AOR-ID, detector channel, and raw file number, as:
chop 0 = <FLIGHT>_FI_IFS_<AOR-ID>_<DETCHAN>_CP0_<FILENUM>.fits chop 1 = <FLIGHT>_FI_IFS_<AOR-ID>_<DETCHAN>_CP1_<FILENUM>.fits
The prime header is also modified from the original, to conform to SOFIA standards (via fifi_ls.make_header).
- Parameters:
- filenamestr
File path to the raw FITS data file.
- writebool, optional
If True, write generated HDU Lists to file
- outdirstr, optional
Name of the output path. By default new files will be saved to the same directory as
filename
.
- Returns:
- tuple of fits.HDUList or tuple of str
Contains HDULists is write is False, otherwise paths to output files