Algorithms for calwebb_spec3, which is stage 3 of the JWST Science Calibration Pipeline for spectroscopic data, are used to process data from calibrated slope images to combined spectral data (2-D or 3-D) and extracted spectra.
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.
1 Step is off in the default calibration pipeline
Steps for both NIR and MIR
Moving target WCS
Software documentation outside JDox: Moving Target WCS
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.
Master background subtraction
Software documentation outside JDox: Master Background Subtraction
The background can be improved over 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 1D 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 several factors, including the specifics of the science case, hence this step is an optimal science calibration pipeline step.
Software documentation outside JDox: Outlier Detection
Outlier detection is done using the overlapping regions observed in different exposures. The majority of the outliers will be due to cosmic rays undetected during the jump detection step done in calwebb_detector1. The presence of an outlier results in a pixel flag being set.
Resample slit spectra
Software documentation outside JDox: Resampling
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).
Software documentation outside JDox: Cube Building
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.
Software documentation outside JDox: extract_1d
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.
For extended sources, the extraction is done with rectangular apertures with no local background subtraction.
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.
Update exposure level products
Software documentation outside JDox: Resampling
The exposure level products are re-created 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. It should also be noted 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.
Software documentation outside JDox: MRS Sky Matching
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 IFU observations, but is disabled by default as preliminary analysis of flight data has indicated that such a correction is unnecessary.