FORCASTImagingReduction

class sofia_redux.pipeline.sofia.forcast_imaging_reduction.FORCASTImagingReduction[source]

Bases: FORCASTReduction

FORCAST imaging reduction steps.

Primary image reduction algorithms are defined in the DRIP package (sofia_redux.instruments.forcast). Calibration-related algorithms are pulled from the sofia_redux.calibration package, and some utilities come from the sofia_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.

baseheadastropy.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 sofia_redux.calibration pipecal_config function.

Initialize the reduction object.

Methods Summary

coadd()

Combine registered images.

filter_shift()

For early data, shift reference pixels for filter offsets.

fluxcal()

Calibrate flux to physical units.

imgmap()

Generate a quick-look image map.

load(data[, param_class])

Load input data to make it available to reduction steps.

load_fits([intermediate])

Load FITS data into memory.

merge()

Merge on-array chops/nods.

register()

Register frames to a reference coordinate system.

reorganize_c2nc2()

Fix old-style C2NC2 files to newer data organization.

tellcor()

Correct for atmospheric absorption.

undistort()

Correct for optical distortion.

Methods Documentation

coadd()[source]

Combine registered images.

Calls sofia_redux.toolkit.image.combine.combine_images for image coaddition. For standards, photometry is run on the coadded image with sofia_redux.calibration.pipecal_util.run_photometry. Input headers are merged with sofia_redux.instruments.forcast.hdmerge.hdmerge.

The combination method may be configured in parameters, or coadd may be skipped entirely if desired. In this case, a COA file is written to disk for each input file.

filter_shift()[source]

For early data, shift reference pixels for filter offsets.

Header keywords CRPIX1 and CRPIX2 for all files in self.input are updated with specified offset values.

Pixel offsets by filter are listed in the sofia_redux.instruments.forcast/data/filtershift.txt file. After 2015, filter offsets were applied by the instrument software, so this step is not required.

fluxcal()[source]

Calibrate flux to physical units.

Calls sofia_redux.calibration.pipecal_util.apply_fluxcal. For standards, photometry may optionally be re-run, using sofia_redux.calibration.pipecal_util.run_photometry. The pipecal config is determined individually for each file, so that different calibration factors may be applied to each file if necessary.

imgmap()[source]

Generate a quick-look image map.

Calls sofia_redux.visualization.quicklook.make_image.

The output from this step is identical to the input, so is not saved. As a side effect, a PNG file is saved to disk to the same base name as the input file, with a ‘.png’ extension.

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.

  • Use the base header to load a calibration configuration (sofia_redux.calibration.pipecal_config).

  • 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 FORCASTImagingParameters. Initialization arguments must match.

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.

merge()[source]

Merge on-array chops/nods.

Calls sofia_redux.instruments.forcast.merge.merge. Merging algorithm may be specified in parameters.

register()[source]

Register frames to a reference coordinate system.

Calls sofia_redux.instruments.forcast.register_datasets.get_shifts. Registration algorithm may be specified in parameters.

reorganize_c2nc2()[source]

Fix old-style C2NC2 files to newer data organization.

Early science flights took C2NC2 data in C2 mode, with nods separated into separate files. The nod pattern was: A B A A B A A B. Later flights used the same nod pattern, but repackaged B nods with the A nods into 5 files: AB BA AB BA AB. This function performs the same function for old-style data, so that all further steps may be run in the same way as for the new-style data.

tellcor()[source]

Correct for atmospheric absorption.

Calls sofia_redux.calibration.pipecal_config.pipecal_config and sofia_redux.calibration.pipecal_util.apply_tellcor. For standards, photometry is performed with sofia_redux.calibration.pipecal_util.run_photometry.

undistort()[source]

Correct for optical distortion.

Calls sofia_redux.instruments.forcast.undistort.undistort. Detailed pinhole model parameters should be specified in the DRIP config file.