StepPrepare¶
- class sofia_redux.instruments.hawc.steps.stepprepare.StepPrepare[source]¶
Bases:
StepParent
Prepare input file for processing.
This step separates the flux column into separate columns for R and T arrays. It may also fill in missing columns, and reformat or rename existing columns to conventions expected by subsequent pipeline steps.
Currently steprepare assumes the input array has dimensions 64 x 41, and just splits it into two 32 x 41 sub-arrays which are named ‘R Array’ (columns 1-32) and ‘T Array’ (columns 33-64) in the output file. If a column named ‘Chop Offset’ is not present in the input data, it is created, replicating the column given in the parameter ‘chpoff’. If a column named ‘HWP Angle’ is not present, then it is generated by multiplying the ‘hwpcounts’ column by a conversion factor obtained from the parameter ‘hwpconv’.
Input for this step is a raw FITS file, containing the primary HDU (with only the header), the Configuration HDU, and a binary table (‘Timestream’) containing the arrays, chop and HWP signals, etc. The output for this step is the same as the input, with the original flux array removed and ‘R Array’, ‘T Array’ columns added in its place.
Methods Summary
Read a pixel scale value from the parameters.
run
()Run the data reduction algorithm.
setup
()Set parameters and metadata for the pipeline step.
Methods Documentation
- read_pixscal()[source]¶
Read a pixel scale value from the parameters.
The parameters are expected to be defined as a list, with one entry for each HAWC band. The correct value for the input data is selected from the list.
- Returns:
- float
The pixel scale.
- run()[source]¶
Run the data reduction algorithm.
Because this step is single-in, single-out (SISO), self.datain must be a DataFits object. The output is also a DataFits object, stored in self.dataout.
The process is:
Read the input data table.
Split the flux array into R and T subarrays.
Rename columns specified in the ‘colrename’ parameter.
Remove any columns specified in the ‘coldelete’ parameter.
Add any columns necessary from a housekeeping data file.
Calculate chop and nod offsets and HWP angles as necessary.
Shift metadata columns to match flux samples if necessary.
Store the data. Input data is modified in place.
- setup()[source]¶
Set parameters and metadata for the pipeline step.
Output files have PRODTYPE = ‘prepare’, and are named with the step abbreviation ‘PRE’.
Parameters defined for this step are:
- detcountsstr
Name of the table column containing the detector flux values for R/T arrays. Usually set to ‘SQ1 Feedback’.
- hwpcountsstr
Name of the table column containing the HWP counts (only used if column ‘HWP Angle’ is not present).
- hwpconvfloat
Value to convert hwpcounts to HWP Angle (only used if column ‘HWP Angle’ is not present).
- labmodebool
If set, data is assumed to be missing header keywords and data columns for on-sky data. These columns are filled in with default values to allow processing to continue.
- replacenodbool
If set, the ‘Nod Offset’ column will be replaced by a calculation based on RA/DEC. If not set, the original column will be used. replacenod=True is recommended.
- chpoffsofiarsbool
If set, the ‘Chop Offset’ column will be calculated from the SofiaChopR/S columns.
- colrenamestr
List of data columns to rename, as a ‘|’ separated string. The format is: ‘oldname1->newname1|oldname2->newname2|…’.
- coldeletelist of str
List of data columns to delete.
- pixscalistlist of float
List of PIXSCAL values, one for each HAWC waveband. Used to write a FITS header keyword.
- traceshiftint
Number of samples to shift the data by. If non-zero, all columns except Timestamp, R Array, and T Array will by shifted by this amount, in order to align the instrument readouts with the metadata.
- removedropoutsbool
If set, data dropouts (with RA = Dec = 0) will be removed from the file.