The algorithms for CALWEBB_SPEC2, the 2nd stage of the JWST calibration pipeline for spectroscopic data, are described.  These algorithms process the data from uncalibrated slope images to calibrated slope images.

On this page

The CALWEBB_SPEC2 module is the 2nd stage in the calibration pipeline for all spectroscopic observations. The input to this stage is the uncalibrated slope images (CALWEBB_DETECTOR1 output) and the output is calibrated slope images.The steps are listed in Figure 1 with the flow from the top to the bottom.

Unless otherwise stated, the algorithms described are the baseline version.


The steps in the CALWEBB_SPEC2 module are shown. The common steps are shown in cyan with the NIR and MIR specific steps shown in blue and green respectively. The steps used for Time Series Observations (TSO) are labeled on the far left. The specific instrument modes are listed for some of the steps in the right column.

NIR/MIR steps

WCS information

The information to transfer the pixel coordinates to astronomical coordinates (e.g., ra, dec, and wavelength) is added to the data with this step. The needed information is described in the World Coordinate System (WCS) format. The WCS information and distortion model are provided by instrument and detector specific calibration reference files (all) and an instrument model (NIRSpec only). The data itself is not modified by this step.

Background subtraction

An observed or modeled background image is subtracted from the target exposure. 

If an APT specified background target was observed, a combined background image constructed from all exposures of that target is subtracted from the science target exposure.

For NIRISS WFSS, NIRISS SOSS, and NIRCam WFSS, a master version of the dispersed background is used, scaled to match the background in the science target exposure.

For NIRSpec MSA, NIRSpec IFU, NIRSpec Fixed Slit, and MIRI LRS, if observations were taken at two or more nod positions, the associated nod position or sum of nod positions is subtracted.

Flat field correction

The flat field corrects for the pixel-to-pixel variations and large scale variations in the instrument+telescope responsivity. The flat field image is taken from instrument and detector specific calibration reference files. For NIRSpec, the flat field is created on-the-fly from reference files and the instrument model.

Point vs extended decision

Some of the pipeline steps rely on knowing if the target is a point or extended source (e.g., spectral extraction). The determination of a source as point or extended can be informed by setting the extended tag in APT (see APT Targets), from simultaneous imaging (NIRISS and NIRCam WFSS), from the NIRSpec MSA tool output, or if no other information is available, by using defaults by instrument mode. The default is to assume a point source except for NIRSpec MSA backgrounds and MIRI IFU observations. This decision is attached to the data and used by later steps in the pipeline.  When manually rerunning the calibration pipeline, this step can be set by the user.

Path-loss correction

The loss of signal in the path is corrected here. The causes of signal loss include the slit (NIRSpec, MIRI), the diffracted slit image being larger than the gratings (NIRSpec), the MSA bar shadow (NIRSpec MSA), and subarrays smaller than diffracted slit image (NIRISS SOSS). The correction values are provided by instrument and mode specific calibration reference files

Flux calibration

The multiplicative conversion factor between counts/sec and MJy/sr as a function of wavelength is attached to the data. A second conversion factor between counts/sec and micro-Jy/sq arc sec as a function of wavelength is also attached. Basically, these are FITS keywords. The pixel area reference file will be attached to the data allowing conversion between surface brightness and flux density for each pixel. Details of the calculation of these calibration factors can be found at Absolute Flux Calibration.

Rectified 2D/3D product

As a product for the archive, rectified 2D (all except IFUs) or 3D (IFUs) products are created using the attached WCS information. These rectified 2D/3D product are not used in the pipeline itself, and are created as they are useful for visual browsing of the data.

NIR steps

Imprint subtraction

The MSA shutters are not completely dark allowing a small amount of light to leak through causing an imprint. When there is a dedicated imprint exposure taken (all MSA shutters closed and IFU closed), this will be subtracted from the target exposure.

MSA failed open flagging

The MSA failed open shutters will result in an elevated level of light to fall on the detectors. This step flags the pixels that are affected by these failed open shutters. This step uses the list of failed open shutters and the NIRSpec instrument model to flag the affected pixels.

Subwindow extraction

The region of interest for each source is extracted for NIRISS/NIRCam WFSS, NIRISS SOSS, and NIRSpec MSA/Fixed Slit data. The location of the sources for the WFSS observations is provided using the direct imaging observations taken as part of the observations. The NIRSpec MSA configuration file provides the location of the sources for this MOS mode. The other modes have fixed locations for sources. This subwindow extraction assumes that sources are isolated and not confused with other sources (such confused sources will need to be extracted with a post-pipeline tool). The main impact of this step is to provide single sources to the rest of the pipeline providing a uniform treatment of all spectra from the observation modes listed.

MIR steps

Stray light subtraction

There is stray light present in between the slices in the MIRI IFU observations. This stray light is subtracted by linearly interpolating the measured surface brightnesses between the inter-slice regions.

Fringing removal

There are significant fringes in the MIRI IFU data. These fringes are removed (to first order) by dividing the exposures by the detector specific calibration reference file.



Latest updates