FORCASTReduction¶
- class sofia_redux.pipeline.sofia.forcast_reduction.FORCASTReduction[source]¶
Bases:
Reduction
FORCAST reduction steps.
Primary image reduction algorithms are defined in the DRIP package (
sofia_redux.instruments.forcast
). Calibration-related algorithms are pulled from thesofia_redux.calibration
package, and some utilities come from thesofia_redux.toolkit
package. This reduction object requires that all three packages be installed.This reduction object defines a method for each pipeline step, that calls the appropriate algorithm from its source packages.
- Attributes:
- prodtype_mapdict
Maps the pipeline step to a product type, to assign to the PRODTYPE key. Keys are pipeline step function names.
- prodnamesdict
3-letter file type code, to assign to the output of a pipeline step. Keys are the product types (as defined in prodtype_map).
- step_mapdict
Inverse of the prodtype_map, for looking up pipeline step names from product types. Keys are the product types.
- prodtypeslist
List of product types, corresponding to the currently loaded recipe. This list is populated whenever the recipe attribute is set.
- slit_image_recipelist
Alternate processing recipe to use when input data is marked as a slit image (SLIT!=NONE). Calibration and coaddition steps are skipped.
- mosaic_recipelist
Alternate processing recipe to use when input is telluric- corrected or calibrated. Only calibration, registration, and coaddition are applied.
- basehead
astropy.io.fits.Header
Header for the first raw input file loaded, used for calibration configuration.
- calresdict-like
Reduction mode and auxiliary file configuration mapping, as returned from the sofia_redux.instruments.forcast
getcalpath
function.- cal_confdict-like
Flux calibration and atmospheric correction configuration, as returned from the pipecal
pipecal_config
function.
Initialize the reduction object.
Methods Summary
Check input headers.
clean
()Clean bad pixels from image data.
droop
()Correct for 'droop' detector response effect.
getfilename
(header[, update, prodtype, filenum])Create an output filename from an input header.
getfilenum
(filename)Get the file number from a file name.
load
(data[, param_class])Load input data to make it available to reduction steps.
load_fits
([intermediate])Load FITS data into memory.
nonlin
()Correct for detector nonlinearity.
Return a new QADViewer.
set_display_data
([raw, filenames])Store display data for QAD viewer.
stack
()Stack chop/nod frames.
update_output
(hdul, filenum, prodtype)Update output FITS file after a pipeline step.
update_sofia_keys
(header)Update required SOFIA header keywords.
write_output
(hdul, outname)Write an output FITS file to disk.
Methods Documentation
- checkhead()[source]¶
Check input headers.
Calls sofia_redux.instruments.forcast.hdcheck.hdcheck to compare header keywords to requirements. Halts reduction if the abort parameter is True and the headers do not meet requirements.
- clean()[source]¶
Clean bad pixels from image data.
Calls
sofia_redux.instruments.forcast.check_readout_shift
to determine if the 16-pixel readout error is present, and corrects for it if desired.Calls
sofia_redux.instruments.forcast.clean
to clean bad pixels identified in a bad pixel mask. Bad pixels may be either interpolated over or propagated as NaN values.
- droop()[source]¶
Correct for ‘droop’ detector response effect.
Calls
sofia_redux.instruments.forcast.droop.droop
. The droop correction may be tuned with the fracdroop parameter.
- getfilename(header, update=True, prodtype='RAW', filenum='UNKNOWN')[source]¶
Create an output filename from an input header.
Requires calibration data to be loaded (self.calres).
- Parameters:
- headerastropy.io.fits.Header
Header to create filename from.
- updatebool, optional
If set, FILENAME key will be added or updated in the header.
- prodtypestr, optional
Three letter product type designator.
- filenumstr or list, optional
List of file numbers to concatenate for filename.
- Returns:
- str
The output name.
- getfilenum(filename)[source]¶
Get the file number from a file name.
Returns UNKNOWN if file number can’t be parsed.
- Parameters:
- filenamestr
File name to parse. Assumed to be *_[filenum].fits.
- Returns:
- str or list
File number(s), formatted to 4 digits.
- load(data, param_class=None)[source]¶
Load input data to make it available to reduction steps.
The process is:
Call the parent load method to initialize data reduction variables.
Use the first loaded FITS header to determine and load the DRIP configuration (
sofia_redux.instruments.forcast.getcalpath
,sofia_redux.instruments.forcast.configuration
).Use the loaded configuration and the product type in the base header to determine the data processing recipe.
Load parameters for all steps.
Load the data immediately if starting from an intermediate step; otherwise, just load the raw headers and defer loading the data from the FITS files.
After this step, the input attribute is populated as required for the first pipeline step in the recipe.
- Parameters:
- datalist of str or str
Input file paths to load.
- param_classclass, optional
Parameters to instantiate, if not FORCASTParameters.
- load_fits(intermediate=False)[source]¶
Load FITS data into memory.
Handles raw data, as well as intermediate data. Intermediate data may have been produced by the current pipeline version (multiple HDUs expected), or from the v1 IDL pipeline (single HDU expected).
Loaded data are stored in the input attribute.
- Parameters:
- intermediatebool
If False, the
sofia_redux.instruments.forcast.readfits.readfits
function will be used to read in the data and calculate the associated error images. If True, the data will just be read in from disk.
- nonlin()[source]¶
Correct for detector nonlinearity.
Calls
sofia_redux.instruments.forcast.imgnonlin.imgnonlin
. The image section that determines the background levels for the correction may be specified in parameters.
- set_display_data(raw=False, filenames=None)[source]¶
Store display data for QAD viewer.
- Parameters:
- rawbool
If True, display data is taken from self.rawfiles. If False, display data is taken from self.input
- filenameslist of str, optional
If provided and
raw
is False, file names will be passed to QADViewer instead of self.input.
- stack()[source]¶
Stack chop/nod frames.
Calls
sofia_redux.instruments.forcast.stack.stack
. Images are chop- and nod-subtracted and cleaned of “jailbar” artifacts.
- update_output(hdul, filenum, prodtype)[source]¶
Update output FITS file after a pipeline step.
Sets the PRODTYPE key, adds a HISTORY message with the pipeline step name, and updates the FILENAME key with a new filename, appropriate to the prodtype. The new filename is returned from the function.
- Parameters:
- hdul
astropy.io.fits.HDUList
Output FITS HDUList.
- filenumstr or list
File number(s) to use in the filename.
- prodtypestr
Product type for the completed step.
- hdul
- Returns:
- str
File base name for the output product.
- update_sofia_keys(header)[source]¶
Update required SOFIA header keywords.
Keywords added or updated are:
PROCSTAT: set to LEVEL_2
ASSC_AOR: copied from AOR_ID
ASSC_OBS: copied from OBS_ID
ASSC_MSN: copied from MISSN-ID
OBS_ID: prepended with ‘P_’
PIPELINE: set to pipe_name
PIPEVERS: set to pipe_version
- Parameters:
- header
astropy.io.fits.Header
Header to update.
- header
- write_output(hdul, outname)[source]¶
Write an output FITS file to disk.
Outname is joined to self.output_directory, before writing.
- Parameters:
- hdul
astropy.io.fits.HDUList
FITS HDUList to write.
- outnamestr
File basename to write.
- hdul
- Returns:
- str
Full path to the output file.