JDox will be unavailable from Friday, April 12th, starting at noon through Sunday, April 14th, due to a planned outage. We apologize for any inconvenience.

The calwebb_spec3 module is stage 3 of the JWST Science Calibration Pipeline for spectroscopic data. The inputs to this stage are the calibrated slope images (calwebb_spec2 output) grouped into an association file (ASN), which is required for this step, and the output is combined 2-D images/3-D spectral cubes and extracted spectra. The steps are listed in Figure 1 with the flow from the top to the bottom.

On this page

Words in bold are GUI menus/
panels or data software packages; 
bold italics are buttons in GUI
tools or package parameters.

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

A brief description of each of the steps within calwebb_spec3 can be found below, along with links to further details (e.g., the relevant reference files) that can be found on the corresponding ReadTheDocs pages. Note, however, that the reference files themselves are all provided via CRDS. For instrument mode-specific notes on these pipeline steps see the corresponding known issues with JWST data articles.

Figure 1. calwebb_spec3

Click on the image for a larger view.

Graphical representation of all the steps in the calwebb_spec3 module. Checkmarks indicate which steps are applicable to which modes, for NIR and MIR observations.

Moving target WCS

ReadTheDocs documentation: Moving Target WCS
Package name:

The step runs only for moving target data, where it takes the original WCS and modifies it such that the output frame of the final WCS is centered at the average location of the moving target.

Background matching (MIRI MRS only)

ReadTheDocs documentation: MRS Sky Matching 
Package name:

The background levels in observations may vary as a function of time due to the thermal telescope emission, zodiacal emission, etc. This step corrects the overall level of each spectral cube so that the overlapping regions between exposures have the same background. This step is only relevant for MIRI MRS observations. However, this step is skipped by default as analysis of flight data to date has indicated that the correction is unnecessary over the small IFU field of view and can sometimes produce artifacts in the data.

Master background subtraction

ReadTheDocs documentation: Master Background Subtraction 
Package name:

The background can sometimes be improved over that from the calwebb_spec2 step under the assumption that the background does not change across the field of view. With this assumption, a high signal-to-noise 1-D spectrum of the background can be measured by averaging over the spatial dimensions from one or more input images (or the background can be supplied by the user). This spectrum is then projected into the 2-D space based on the wavelength of each pixel, to create the master background spectrum which is subtracted from the target exposures. This step would be done instead of the calwebb_spec2 background subtraction step. When to do master background subtraction versus background subtraction can depend on the instrument mode in use, the science target and observing strategy, and the severity of uncorrected cosmic ray showers.

For MIRI MRS, see the MRS known issues discussion of the relative merits of performing pixel-based background subtraction in calwebb_spec2, master background subtraction in calwebb_spec3, or annular background subtraction during spectral extraction.

Outlier detection

ReadTheDocs documentation: Outlier Detection
Package name:

While the majority of cosmic ray events will be flagged in calwebb_detector1 and rejected when building the uncalibrated slope image, some outliers nonethess make it through both the calwebb_detector1 and calwebb_spec2 pipelines. This dedicated step therefore looks for any such outliers, resulting in a pixel data quality flag being set where such outliers are detected.

For non-IFU spectroscopic modes, outlier detection uses overlapping sky regions between different exposures to search for outliers.

For IFU modes (NIRSpec IFU and MIRI MRS) outlier detection is particularly challenging as the significant undersampling of the IFU slicers means that unresolved point sources can appear to be outliers when resampled to a common grid. IFU outlier detection therefore performs a detector-based analysis that looks for 2-D artifacts whose edges are sharper than would be expected given the known detector point spread function. This method primarily detects new bad pixels that have not yet been flagged by the corresponding bad pixel mask.

Resample slit spectra

ReadTheDocs documentation: Resampling 
Package name:

This step produces a rectified 2-D image of slit observations, for all observations that map in single spatial dimension. In this case, 2-D corresponds to one spatial (along slit) and one spectral dimension.  2-D images (spectral versus spatial) are created for:

  • NIRSpec fixed slit/MIRI LRS nodded observations,

  • NIRSpec MSA data taken with shutters above/below, and

  • NIRISS/NIRCam WFSS dithered observations (hence these are not 3-D "cubes" as such, but they share some aspects of the processing in common with cubes).

Cube creation

ReadTheDocs documentation: Cube Building 
Package name:

Combinations of dithered spectral observations are done in 2-D and 3-D as appropriate. Note that the WFSS spectra from dithered observations are combined using the combine_1d step. The 3-D cubes (spectral versus RA/Dec) are created for NIRSpec and MIRI IFU and MIRI LRS observations taken with cross-slit steps. The combination is done in a single step/interpolation to avoid propagating noise through multiple interpolations.

Note that moving targets are supported and the cubes are created in the moving target reference frame.

Spectral extraction

ReadTheDocs documentation: Extract 1-D Spectra 
Package name:

For point sources, the extraction is done using a boxcar (2-D data) or circular aperture (3-D data) with local background subtraction measured from apertures outside the extraction aperture. Spectral extraction can optionally use annular background subtraction and apply aperture correction factors to account for the finite aperture size.

For extended sources, the extraction is done with rectangular apertures with no local background subtraction. For IFU mode observations extended source extraction will sum the entire field of view of the corresponding data cube at each wavelength.

The extraction of spectra is done from the rectified observations for the baseline science calibration pipeline. An optimal version of spectral extraction that extracts directly from the unrectified data is under investigation.

Note that 1-D spectral extraction has many optional parameters that may be of use to certain science cases, particularly for IFU mode observations.  For the MIRI MRS, for instance, see MRS Known Issues.

Spectral leak correction (MIRI MRS only)

ReadTheDocs documentation: Spectral Leak
Package name:

As covered in the MRS Known Issues article, a small fraction of second-order dispersed 6 µm light leaks into the 12µm MRS bandpass. For point sources, this step corrects the extracted 1-D spectra by subtracting a scaled copy of the 6µm spectrum (if available). Note that this step was recently added to the pipeline in version 1.13.0.

Update exposure level products

ReadTheDocs documentation: Resampling 
Package name:

The exposure level products are recreated at this stage to provide the highest quality products that include the results of the ensemble processing (updated WCS, matching backgrounds, a 2nd pass outlier detection). These products are for the Archive and include the rectified 2-D (spatial versus spectral, all except IFUs) or 3-D (spectral cubes, IFUs) products. For MOS-mode data, note that the output products from this step are "source-based": while calwebb_spec2 outputs have spectra of individual sources in different extensions of the exposure files, the outputs from calwebb_spec3, on the other hand, have files for individual sources, and the spectra from different exposures for a given source are available in the extensions of the source-based file.

Notable updates


  • Updated figure 1 
Originally published