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.
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.
See also: Assign WCS (more detailed software module documentation)
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.
See also: Background Image Subtraction (more detailed software module documentation)
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
See also: Flat field correction (more detailed software module documentation)
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
See also: Source Type (more detailed software module documentation)
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 calibration pipeline. When manually rerunning the calibration pipeline, this step can be set by the user.
See also: Pathloss Correction (more detailed software module documentation)
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.
See also: Photometric Calibration (more detailed software module documentation)
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 arcsec 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.
The extracted spectrum for every targeted source is the primary output of the spectroscopic observations. The spectrum is extracted by summing the signal in an aperture centered on the sky coordinates (ra & dec) of the targets. When the extractions are done from individual unrectified images, the WCS information is used to map the projected aperture from the sky to detector coordinates. If the extraction is done from a cube created from multiple rectified images, the apertures are directly taken from the sky coordinates.
Rectified 2D/3D product
See also: Resampling (more detailed software module documentation)
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 products are not used in the pipeline itself and are created as they are useful for visual browsing of the data.
See also: Imprint Subtraction (more detailed software module documentation)
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
See also: MSA Flag Open Correction (more detailed software module documentation)
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.
MSA Bar Shadow correction
See also: MSA Bar Shadow Correction (more detailed software module documentation)
For NIRSpec MSA observations, there are losses in the case of extended sources arising from the imperfect profile of the shutter. The shadow bar correction is derived from the instrumental mode for the target shutter and adjacent shutters, and is applied to the 2D cutouts.
See also: Extract 2D (more detailed software module documentation)
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.
Stray light subtraction
See also: Stray Light Correction (more detailed software module documentation)
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.
See also: Fringe Correction (more detailed software module documentation)