Cleaning Residual 1/f Noise in NIRSpec IFU Products with NSClean#


Notebook Goal#

The goal of this notebook is to generate cleaned IFU (_rate.fits) files by removing residual 1/f noise. These cleaned files will be used as input for the level 3 (Spec3Pipeline) pipeline.

Table of Contents#

1. Introduction #


The JWST NIRSpec instrument has a number of features and characteristics that observers should be aware of when planning observations and interpreting data. One notable feature seen in NIRSpec pipeline products is negative and/or surplus flux in the extracted 1-D spectrum, typically with an irregular wavelength-dependent undulation. The cause of this artifact is correlated noise, known as 1/f noise, from low-level detector thermal instabilities, seen as vertical banding in 2-D count rate images, particularly in exposures of the NRS2 detector. While the IRS2 readout mode reduces this effect, it is not completely eliminated.

To address this issue, the JWST Science Calibration Pipeline has integrated an external package developed by Bernard Rauscher, known as NSClean, within the Spec2Pipeline under NSCleanStep. This algorithm uses dark areas of the detector to fit a background model to the data in Fourier space. It requires an input mask to identify all dark areas of the detector. The more thorough and complete this mask is, the better the background fit.

In this notebook, we will use the NSClean algorithm integrated into the pipeline, utilizing a mask generated on-the-fly with default parameters to remove 1/f noise. In some cases, this mask may not be complete enough/too restrictive for the best possible noise removal. To address this, we demonstrate how one can manually modify the default mask, as well as how to create an alternative mask by adjusting the NSCleanStep parameters. If needed, see the NSClean documentation for some suggestions on manually creating a custom mask.

This notebook utilizes IFU observation of quasar XID2028 with grating/filter G140H/F100LP as part of JWST Early Release Science program ERS-1335 observation 4, as an example.

2. Import Library #


# ---------- Set CRDS environment variables ----------
import os
import jwst
# Set CRDS context if you'd like a version other than the default
# os.environ['CRDS_CONTEXT'] = 'jwst_1210.pmap'
os.environ['CRDS_PATH'] = os.environ['HOME']+'/crds_cache'
os.environ['CRDS_SERVER_URL'] = 'https://jwst-crds.stsci.edu'
print(f'CRDS cache location: {os.environ["CRDS_PATH"]}')

print("JWST Calibration Pipeline Version={}".format(jwst.__version__))
# print("Current Operational CRDS Context = {}".format(crds.get_default_context()))
CRDS cache location: /home/runner/crds_cache
JWST Calibration Pipeline Version=1.20.2
# ------ General Imports ------
import numpy as np
import time as tt
import logging
import warnings

# ------ JWST Calibration Pipeline Imports ------
from jwst.pipeline.calwebb_spec2 import Spec2Pipeline

# ------ Plotting/Stats Imports ------
from matplotlib import pyplot as plt
from astropy.io import fits

from utils import get_jwst_file, plot_dark_data, plot_cleaned_data, plot_spectra

# Hide all log and warning messages.
logging.disable(logging.ERROR)
warnings.simplefilter("ignore", RuntimeWarning)

3. Download the Data #


The input data for this notebook features an IFU observation of quasar XID2028 with grating/filter G140H/F100LP. The dataset is part of the JWST Early Release Science program ERS-1335, specifically observation 4. It consists of 9 integrations (9 dither points) with 16 groups each. This notebook focuses on the second dithered exposure (00002) as an example. However, it’s important to note that before proceeding to the Spec3Pipeline, all exposures must first be processed through the Spec2Pipeline.

# Define a downloads directory.
mast_products_dir = "./mast_products/"
# Check if the directory exists.
if not os.path.exists(mast_products_dir):
    # Create the directory if it doesn't exist.
    os.makedirs(mast_products_dir)
# This notebook focuses on the second dithered exposure.
obs_ids = ["jw01335004001_03101_00002"]
detectors = [1, 2]  # Both Detectors NRS1 and NRS2.

# Specify the countrate products.
rate_names = []

for obs_id in obs_ids:
    for detector in detectors:
        rate_names.append(f"{obs_id}_nrs{detector}_rate.fits")

# Download all the FITS files.
for name in rate_names:
    print(f"Downloading {name}")
    get_jwst_file(name, mast_api_token=None, save_directory=mast_products_dir)
Downloading jw01335004001_03101_00002_nrs1_rate.fits
The file jw01335004001_03101_00002_nrs1_rate.fits already exists in the directory. Skipping download.
Downloading jw01335004001_03101_00002_nrs2_rate.fits
The file jw01335004001_03101_00002_nrs2_rate.fits already exists in the directory. Skipping download.

4. Running Spec2Pipeline without NSClean (Original Data) #


The cell below executes the Spec2Pipeline, explicitly skipping the NSClean step during processing. The level 2 products generated will serve as a reference point to illustrate how the countrate images and final extracted spectra appear without the removal of 1/f noise.

# Set up directory for running the pipeline without NSClean.
stage2_nsclean_skipped_dir = "./stage2_nsclean_skipped/"
if not os.path.exists(stage2_nsclean_skipped_dir):
    os.makedirs(stage2_nsclean_skipped_dir)  # Create the directory if it doesn't exist.
# Original data (no NSClean Applied).
# Estimated run-time: 132 minutes (may vary).
start = tt.time()

for i in rate_names:
    print(f"Processing {i}...")

    Spec2Pipeline.call(
        mast_products_dir + i,
        save_results=True,
        steps={
            "nsclean": {
                "skip": True
            },  # Removes correlated read noise (1/f noise) from NIRSpec images.
        },
        output_dir=stage2_nsclean_skipped_dir,
    )

    print(f"Saved {i[:-9]}" + "cal.fits")
    print(f"Saved {i[:-9]}" + "x1d.fits")


end = tt.time()
print("Run time: ", round(end - start, 1) / 60.0, " min")
Processing jw01335004001_03101_00002_nrs1_rate.fits...
Saved jw01335004001_03101_00002_nrs1_cal.fits
Saved jw01335004001_03101_00002_nrs1_x1d.fits
Processing jw01335004001_03101_00002_nrs2_rate.fits...
Saved jw01335004001_03101_00002_nrs2_cal.fits
Saved jw01335004001_03101_00002_nrs2_x1d.fits
Run time:  3.335  min

5. Clean up 1/f Noise with NSClean (Default Pipeline Mask) #


If a user-supplied mask file is not provided to the NSClean step in the Spec2Pipeline, the pipeline will generate a mask based on default parameters. This mask will identify any pixel that is unilluminated. That is, the mask must contain True and False values, where True indicates that the pixel is dark, and False indicates that the pixel is illuminated (not dark).

By default, the pipeline marks the following detector areas as illuminated, non-dark areas (False):

  • Pixels designated as science areas for IFU data.

  • Traces from failed-open MSA shutters.

  • 5-sigma outliers (default value).

  • Any pixel set to NaN in the rate data.

To tune the outlier detection in the mask, try modifying the n_sigma parameter (explored in the next section). A higher value will identify fewer outliers. A lower value will identify more.

The default generated mask is saved and analyzed below.

# Set up directory for running NSClean with default parameters.
stage2_nsclean_default_dir = "./stage2_nsclean_default/"
if not os.path.exists(stage2_nsclean_default_dir):
    os.makedirs(stage2_nsclean_default_dir)  # Create the directory if it doesn't exist.
# 1/f noise cleaned data (default NSClean pipeline mask).
# Estimated run time: 105 minutes (may vary).
start = tt.time()

for i in rate_names:
    print(f"Processing {i}...")

    Spec2Pipeline.call(
        mast_products_dir + i,
        save_results=True,
        steps={
            "nsclean": {
                "skip": False,
                "save_mask": True,
                "save_results": True,
            },  # Removes correlated read noise (1/f noise) from NIRSpec images.
        },
        output_dir=stage2_nsclean_default_dir,
    )

    print(f"Saved {i[:-9]}" + "mask.fits")
    print(f"Saved {i[:-9]}" + "nsclean.fits")
    print(f"Saved {i[:-9]}" + "cal.fits")
    print(f"Saved {i[:-9]}" + "x1d.fits")


end = tt.time()
print("Run time: ", round(end - start, 1) / 60.0, " min")
Processing jw01335004001_03101_00002_nrs1_rate.fits...
2026-03-27 13:42:20,919 - jwst.clean_flicker_noise.clean_flicker_noise - INFO - Creating mask
2026-03-27 13:42:20,920 - jwst.clean_flicker_noise.clean_flicker_noise - INFO - Finding slice pixels for an IFU image
2026-03-27 13:42:22,865 - jwst.clean_flicker_noise.clean_flicker_noise - INFO - Masking the fixed slit region for IFU data.
2026-03-27 13:42:23,085 - jwst.clean_flicker_noise.clean_flicker_noise - INFO - Cleaning image jw01335004001_03101_00002_nrs1_rate.fits
2026-03-27 13:42:24,568 - jwst.nsclean.nsclean_step - INFO - Saving mask file ./stage2_nsclean_default/jw01335004001_03101_00002_nrs1_mask.fits
2026-03-27 13:42:27,028 - stpipe.step - INFO - Saved model in ./stage2_nsclean_default/jw01335004001_03101_00002_nrs1_nsclean.fits
2026-03-27 13:42:27,029 - stpipe.step - INFO - Step nsclean done
2026-03-27 13:42:27,672 - stpipe.step - INFO - Step imprint_subtract running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>, []).
2026-03-27 13:42:27,674 - stpipe.step - INFO - Step skipped.
2026-03-27 13:42:28,038 - stpipe.step - INFO - Step bkg_subtract running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>, []).
2026-03-27 13:42:28,039 - stpipe.step - INFO - Step skipped.
2026-03-27 13:42:28,415 - stpipe.step - INFO - Step srctype running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:42:30,875 - jwst.srctype.srctype - INFO - Input EXP_TYPE is NRS_IFU
2026-03-27 13:42:30,876 - jwst.srctype.srctype - INFO - Input SRCTYAPT = EXTENDED
2026-03-27 13:42:30,876 - jwst.srctype.srctype - INFO - Using input source type = EXTENDED
2026-03-27 13:42:30,878 - stpipe.step - INFO - Step srctype done
2026-03-27 13:42:31,351 - stpipe.step - INFO - Step straylight running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:42:31,352 - stpipe.step - INFO - Step skipped.
2026-03-27 13:42:31,834 - stpipe.step - INFO - Step flat_field running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:42:31,866 - jwst.flatfield.flat_field_step - INFO - No reference found for type FLAT
2026-03-27 13:42:31,931 - jwst.flatfield.flat_field_step - INFO - Using FFLAT reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fflat_0170.fits
2026-03-27 13:42:32,032 - jwst.flatfield.flat_field_step - INFO - Using SFLAT reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_sflat_0216.fits
2026-03-27 13:42:32,178 - jwst.flatfield.flat_field_step - INFO - Using DFLAT reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_dflat_0001.fits
2026-03-27 13:42:42,560 - stpipe.step - INFO - Step flat_field done
2026-03-27 13:42:43,416 - stpipe.step - INFO - Step fringe running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:42:43,418 - stpipe.step - INFO - Step skipped.
2026-03-27 13:42:43,867 - stpipe.step - INFO - Step pathloss running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:42:43,889 - jwst.pathloss.pathloss_step - INFO - Using PATHLOSS reference file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pathloss_0003.fits
2026-03-27 13:42:43,924 - jwst.pathloss.pathloss - INFO - Input exposure type is NRS_IFU
2026-03-27 13:42:49,293 - stpipe.step - INFO - Step pathloss done
2026-03-27 13:42:50,125 - stpipe.step - INFO - Step barshadow running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:42:50,126 - stpipe.step - INFO - Step skipped.
2026-03-27 13:42:50,621 - stpipe.step - INFO - Step photom running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:42:50,645 - jwst.photom.photom_step - INFO - Using photom reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_photom_0016.fits
2026-03-27 13:42:50,646 - jwst.photom.photom_step - INFO - Using area reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_area_0046.fits
2026-03-27 13:42:53,266 - jwst.photom.photom - INFO - Using instrument: NIRSPEC
2026-03-27 13:42:53,267 - jwst.photom.photom - INFO -  detector: NRS1
2026-03-27 13:42:53,268 - jwst.photom.photom - INFO -  exp_type: NRS_IFU
2026-03-27 13:42:53,269 - jwst.photom.photom - INFO -  filter: F100LP
2026-03-27 13:42:53,269 - jwst.photom.photom - INFO -  grating: G140H
2026-03-27 13:42:53,315 - jwst.photom.photom - INFO - PHOTMJSR value: 3.83761e+12
2026-03-27 13:42:55,465 - stpipe.step - INFO - Step photom done
2026-03-27 13:42:56,195 - stpipe.step - INFO - Step residual_fringe running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:42:56,197 - stpipe.step - INFO - Step skipped.
2026-03-27 13:42:59,406 - stpipe.step - INFO - Step pixel_replace running with args (<IFUImageModel(2048, 2048) from ./stage2_nsclean_default/jw01335004001_03101_00002_nrs1_cal.fits>,).
2026-03-27 13:42:59,407 - stpipe.step - INFO - Step skipped.
2026-03-27 13:42:59,957 - stpipe.step - INFO - Step cube_build running with args (<IFUImageModel(2048, 2048) from ./stage2_nsclean_default/jw01335004001_03101_00002_nrs1_cal.fits>,).
2026-03-27 13:42:59,959 - jwst.cube_build.cube_build_step - INFO - Starting IFU Cube Building Step
2026-03-27 13:42:59,959 - jwst.cube_build.cube_build_step - INFO - Input interpolation: drizzle
2026-03-27 13:42:59,960 - jwst.cube_build.cube_build_step - INFO - Coordinate system to use: skyalign
2026-03-27 13:42:59,977 - jwst.cube_build.cube_build_step - INFO - Setting output type to: band
2026-03-27 13:43:00,010 - jwst.cube_build.cube_build - INFO - Reading cube parameter file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_cubepar_0009.fits
2026-03-27 13:43:00,466 - jwst.cube_build.cube_build - INFO - Output Cubes are single grating, single filter IFU Cubes
2026-03-27 13:43:00,467 - jwst.cube_build.cube_build_step - INFO - Number of IFU cubes produced by this run = 1
2026-03-27 13:43:00,468 - jwst.cube_build.ifu_cube - INFO - Increasing spatial region of interest default value set for 4 dithers nan
2026-03-27 13:43:00,471 - jwst.cube_build.ifu_cube - INFO - Cube Geometry:
2026-03-27 13:43:00,472 - jwst.cube_build.ifu_cube - INFO - axis#  Naxis  CRPIX    CRVAL       CDELT(arcsec)  Min & Max (xi, eta arcsec)
2026-03-27 13:43:00,473 - jwst.cube_build.ifu_cube - INFO - Axis 1    47  24.00 150.54697983   0.10000000  -2.35000004   2.35000004
2026-03-27 13:43:00,473 - jwst.cube_build.ifu_cube - INFO - Axis 2    45  23.00   1.61841714   0.10000000  -2.25000003   2.25000003
2026-03-27 13:43:00,474 - jwst.cube_build.ifu_cube - INFO - axis#  Naxis  CRPIX    CRVAL      CDELT(microns)  Min & Max (microns)
2026-03-27 13:43:00,475 - jwst.cube_build.ifu_cube - INFO - Axis 3  3915   1.00   0.97011753   0.00023500   0.97000003   1.89002503
2026-03-27 13:43:00,476 - jwst.cube_build.ifu_cube - INFO - Cube covers grating, filter: g140h, f100lp
2026-03-27 13:43:00,477 - jwst.cube_build.ifu_cube - INFO - Output Name: ./stage2_nsclean_default/jw01335004001_03101_00002_nrs1_s3d.fits
2026-03-27 13:43:03,138 - jwst.cube_build.ifu_cube - INFO - Mapping each NIRSpec slice to sky for input file: ./stage2_nsclean_default/jw01335004001_03101_00002_nrs1_cal.fits
2026-03-27 13:43:13,707 - jwst.cube_build.ifu_cube - INFO - # of detector pixels not mapped to output plane: 11068 with wavelength below 0.9696408152516496
2026-03-27 13:43:31,239 - jwst.cube_build.ifu_cube - INFO - Average # of holes/wavelength plane is < 1
2026-03-27 13:43:31,240 - jwst.cube_build.ifu_cube - INFO - Total # of holes for IFU cube is : 0
2026-03-27 13:43:31,539 - stcal.alignment.util - INFO - Update S_REGION to POLYGON ICRS  150.546340684 1.617806033 150.546340684 1.619028255 150.547618972 1.619028255 150.547618972 1.617806033
2026-03-27 13:43:31,542 - stpipe.step - INFO - Step cube_build done
2026-03-27 13:43:31,665 - stpipe.step - INFO - Saved model in ./stage2_nsclean_default/jw01335004001_03101_00002_nrs1_s3d.fits
2026-03-27 13:43:32,467 - stpipe.step - INFO - Step extract_1d running with args (<jwst.datamodels.container.ModelContainer object at 0x7fc4154e2e10>,).
2026-03-27 13:43:32,482 - jwst.extract_1d.extract_1d_step - INFO - Using EXTRACT1D reference file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_extract1d_0002.asdf
2026-03-27 13:43:32,485 - jwst.extract_1d.extract_1d_step - INFO - Using APCORR file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_apcorr_0009.asdf
2026-03-27 13:43:32,488 - jwst.extract_1d.extract_1d_step - INFO - Turning off residual fringe correction because it only works on MIRI MRS data
2026-03-27 13:43:32,489 - jwst.extract_1d.ifu - INFO - Source type = EXTENDED
2026-03-27 13:43:32,678 - jwst.extract_1d.ifu - INFO - Input model does not break out variance information. Passing only generalized errors.
2026-03-27 13:43:47,423 - stpipe.step - INFO - Saved model in ./stage2_nsclean_default/jw01335004001_03101_00002_nrs1_x1d.fits
2026-03-27 13:43:47,424 - stpipe.step - INFO - Step extract_1d done
2026-03-27 13:43:47,425 - jwst.pipeline.calwebb_spec2 - INFO - Finished processing product mast_products/jw01335004001_03101_00002_nrs1
2026-03-27 13:43:47,427 - jwst.pipeline.calwebb_spec2 - INFO - Ending calwebb_spec2
2026-03-27 13:43:47,427 - jwst.stpipe.core - INFO - Results used CRDS context: jwst_1464.pmap
2026-03-27 13:43:49,083 - stpipe.step - INFO - Saved model in ./stage2_nsclean_default/jw01335004001_03101_00002_nrs1_cal.fits
2026-03-27 13:43:49,084 - stpipe.step - INFO - Step Spec2Pipeline done
2026-03-27 13:43:49,084 - jwst.stpipe.core - INFO - Results used jwst version: 1.20.2
2026-03-27 13:43:49,116 - stpipe.step - INFO - PARS-RESAMPLESPECSTEP parameters found: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pars-resamplespecstep_0001.asdf
2026-03-27 13:43:49,133 - stpipe.step - INFO - PARS-RESAMPLESPECSTEP parameters found: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pars-resamplespecstep_0001.asdf
2026-03-27 13:43:49,157 - stpipe.step - INFO - Spec2Pipeline instance created.
2026-03-27 13:43:49,158 - stpipe.step - INFO - AssignWcsStep instance created.
2026-03-27 13:43:49,159 - stpipe.step - INFO - BadpixSelfcalStep instance created.
2026-03-27 13:43:49,160 - stpipe.step - INFO - MSAFlagOpenStep instance created.
2026-03-27 13:43:49,161 - stpipe.step - INFO - NSCleanStep instance created.
2026-03-27 13:43:49,162 - stpipe.step - INFO - BackgroundStep instance created.
2026-03-27 13:43:49,163 - stpipe.step - INFO - ImprintStep instance created.
2026-03-27 13:43:49,164 - stpipe.step - INFO - Extract2dStep instance created.
2026-03-27 13:43:49,169 - stpipe.step - INFO - MasterBackgroundMosStep instance created.
2026-03-27 13:43:49,169 - stpipe.step - INFO - FlatFieldStep instance created.
2026-03-27 13:43:49,170 - stpipe.step - INFO - PathLossStep instance created.
2026-03-27 13:43:49,171 - stpipe.step - INFO - BarShadowStep instance created.
2026-03-27 13:43:49,172 - stpipe.step - INFO - PhotomStep instance created.
2026-03-27 13:43:49,173 - stpipe.step - INFO - PixelReplaceStep instance created.
2026-03-27 13:43:49,174 - stpipe.step - INFO - ResampleSpecStep instance created.
2026-03-27 13:43:49,176 - stpipe.step - INFO - Extract1dStep instance created.
2026-03-27 13:43:49,176 - stpipe.step - INFO - WavecorrStep instance created.
2026-03-27 13:43:49,177 - stpipe.step - INFO - FlatFieldStep instance created.
2026-03-27 13:43:49,178 - stpipe.step - INFO - SourceTypeStep instance created.
2026-03-27 13:43:49,179 - stpipe.step - INFO - StraylightStep instance created.
2026-03-27 13:43:49,180 - stpipe.step - INFO - FringeStep instance created.
2026-03-27 13:43:49,181 - stpipe.step - INFO - ResidualFringeStep instance created.
2026-03-27 13:43:49,182 - stpipe.step - INFO - PathLossStep instance created.
2026-03-27 13:43:49,183 - stpipe.step - INFO - BarShadowStep instance created.
2026-03-27 13:43:49,184 - stpipe.step - INFO - WfssContamStep instance created.
2026-03-27 13:43:49,185 - stpipe.step - INFO - PhotomStep instance created.
2026-03-27 13:43:49,185 - stpipe.step - INFO - PixelReplaceStep instance created.
2026-03-27 13:43:49,186 - stpipe.step - INFO - ResampleSpecStep instance created.
2026-03-27 13:43:49,188 - stpipe.step - INFO - CubeBuildStep instance created.
2026-03-27 13:43:49,190 - stpipe.step - INFO - Extract1dStep instance created.
Saved jw01335004001_03101_00002_nrs1_mask.fits
Saved jw01335004001_03101_00002_nrs1_nsclean.fits
Saved jw01335004001_03101_00002_nrs1_cal.fits
Saved jw01335004001_03101_00002_nrs1_x1d.fits
Processing jw01335004001_03101_00002_nrs2_rate.fits...
2026-03-27 13:43:50,205 - stpipe.step - INFO - Step Spec2Pipeline running with args ('./mast_products/jw01335004001_03101_00002_nrs2_rate.fits',).
2026-03-27 13:43:50,242 - stpipe.step - INFO - Step Spec2Pipeline parameters are:
  pre_hooks: []
  post_hooks: []
  output_file: None
  output_dir: ./stage2_nsclean_default/
  output_ext: .fits
  output_use_model: False
  output_use_index: True
  save_results: True
  skip: False
  suffix: None
  search_output_file: True
  input_dir: ''
  save_bsub: False
  fail_on_exception: True
  save_wfss_esec: False
  steps:
    assign_wcs:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      sip_approx: True
      sip_max_pix_error: 0.01
      sip_degree: None
      sip_max_inv_pix_error: 0.01
      sip_inv_degree: None
      sip_npoints: 12
      slit_y_low: -0.55
      slit_y_high: 0.55
      nrs_ifu_slice_wcs: False
    badpix_selfcal:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: True
      suffix: None
      search_output_file: True
      input_dir: ''
      flagfrac_lower: 0.001
      flagfrac_upper: 0.001
      kernel_size: 15
      force_single: False
      save_flagged_bkg: False
    msa_flagging:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
    nsclean:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: True
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      fit_method: fft
      fit_by_channel: False
      background_method: None
      background_box_size: None
      mask_spectral_regions: True
      n_sigma: 5.0
      fit_histogram: False
      single_mask: False
      user_mask: None
      save_mask: True
      save_background: False
      save_noise: False
    bkg_subtract:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      bkg_list: None
      save_combined_background: False
      sigma: 3.0
      maxiters: None
      soss_source_percentile: 35.0
      soss_bkg_percentile: None
      wfss_mmag_extract: None
      wfss_maxiter: 5
      wfss_rms_stop: 0.0
      wfss_outlier_percent: 1.0
    imprint_subtract:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
    extract_2d:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      slit_names: None
      source_ids: None
      extract_orders: None
      grism_objects: None
      tsgrism_extract_height: None
      wfss_extract_half_height: 5
      wfss_mmag_extract: None
      wfss_nbright: 1000
    master_background_mos:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: True
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      sigma_clip: 3.0
      median_kernel: 1
      force_subtract: False
      save_background: False
      user_background: None
      inverse: False
      steps:
        flat_field:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          save_interpolated_flat: False
          user_supplied_flat: None
          inverse: False
        pathloss:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          inverse: False
          source_type: None
          user_slit_loc: None
        barshadow:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          inverse: False
          source_type: None
        photom:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          inverse: False
          source_type: None
          apply_time_correction: True
        pixel_replace:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: True
          output_use_index: True
          save_results: False
          skip: True
          suffix: None
          search_output_file: True
          input_dir: ''
          algorithm: fit_profile
          n_adjacent_cols: 3
        resample_spec:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          pixfrac: 1.0
          kernel: square
          fillval: NaN
          weight_type: exptime
          output_shape: None
          pixel_scale_ratio: 1.0
          pixel_scale: None
          output_wcs: ''
          single: False
          blendheaders: True
          in_memory: True
        extract_1d:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          subtract_background: None
          apply_apcorr: True
          extraction_type: box
          use_source_posn: None
          position_offset: 0.0
          model_nod_pair: True
          optimize_psf_location: True
          smoothing_length: None
          bkg_fit: None
          bkg_order: None
          log_increment: 50
          save_profile: False
          save_scene_model: False
          save_residual_image: False
          center_xy: None
          ifu_autocen: False
          bkg_sigma_clip: 3.0
          ifu_rfcorr: True
          ifu_set_srctype: None
          ifu_rscale: None
          ifu_covar_scale: 1.0
          soss_atoca: True
          soss_threshold: 0.01
          soss_n_os: 2
          soss_wave_grid_in: None
          soss_wave_grid_out: None
          soss_estimate: None
          soss_rtol: 0.0001
          soss_max_grid_size: 20000
          soss_tikfac: None
          soss_width: 40.0
          soss_bad_pix: masking
          soss_modelname: None
          soss_order_3: True
    wavecorr:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
    flat_field:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      save_interpolated_flat: False
      user_supplied_flat: None
      inverse: False
    srctype:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      source_type: None
    straylight:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      clean_showers: False
      shower_plane: 3
      shower_x_stddev: 18.0
      shower_y_stddev: 5.0
      shower_low_reject: 0.1
      shower_high_reject: 99.9
      save_shower_model: False
    fringe:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
    residual_fringe:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: True
      suffix: residual_fringe
      search_output_file: False
      input_dir: ''
      save_intermediate_results: False
      ignore_region_min: None
      ignore_region_max: None
    pathloss:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      inverse: False
      source_type: None
      user_slit_loc: None
    barshadow:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      inverse: False
      source_type: None
    wfss_contam:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: True
      suffix: None
      search_output_file: True
      input_dir: ''
      save_simulated_image: False
      save_contam_images: False
      maximum_cores: none
      orders: None
      magnitude_limit: None
      wl_oversample: 2
      max_pixels_per_chunk: 50000
    photom:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      inverse: False
      source_type: None
      apply_time_correction: True
    pixel_replace:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: True
      output_use_index: True
      save_results: False
      skip: True
      suffix: None
      search_output_file: True
      input_dir: ''
      algorithm: fit_profile
      n_adjacent_cols: 3
    resample_spec:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      pixfrac: 1.0
      kernel: square
      fillval: NaN
      weight_type: exptime
      output_shape: None
      pixel_scale_ratio: 1.0
      pixel_scale: None
      output_wcs: ''
      single: False
      blendheaders: True
      in_memory: True
    cube_build:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: True
      output_use_index: True
      save_results: False
      skip: False
      suffix: s3d
      search_output_file: False
      input_dir: ''
      pipeline: 3
      channel: all
      band: all
      grating: all
      filter: all
      output_type: None
      scalexy: 0.0
      scalew: 0.0
      weighting: drizzle
      coord_system: skyalign
      ra_center: None
      dec_center: None
      cube_pa: None
      nspax_x: None
      nspax_y: None
      rois: 0.0
      roiw: 0.0
      weight_power: 2.0
      wavemin: None
      wavemax: None
      single: False
      skip_dqflagging: False
      offset_file: None
      debug_spaxel: -1 -1 -1
    extract_1d:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      subtract_background: None
      apply_apcorr: True
      extraction_type: box
      use_source_posn: None
      position_offset: 0.0
      model_nod_pair: True
      optimize_psf_location: True
      smoothing_length: None
      bkg_fit: None
      bkg_order: None
      log_increment: 50
      save_profile: False
      save_scene_model: False
      save_residual_image: False
      center_xy: None
      ifu_autocen: False
      bkg_sigma_clip: 3.0
      ifu_rfcorr: True
      ifu_set_srctype: None
      ifu_rscale: None
      ifu_covar_scale: 1.0
      soss_atoca: True
      soss_threshold: 0.01
      soss_n_os: 2
      soss_wave_grid_in: None
      soss_wave_grid_out: None
      soss_estimate: None
      soss_rtol: 0.0001
      soss_max_grid_size: 20000
      soss_tikfac: None
      soss_width: 40.0
      soss_bad_pix: masking
      soss_modelname: None
      soss_order_3: True
2026-03-27 13:43:50,276 - stpipe.pipeline - INFO - Prefetching reference files for dataset: 'jw01335004001_03101_00002_nrs2_rate.fits' reftypes = ['apcorr', 'area', 'barshadow', 'bkg', 'camera', 'collimator', 'cubepar', 'dflat', 'disperser', 'distortion', 'extract1d', 'fflat', 'filteroffset', 'flat', 'fore', 'fpa', 'fringe', 'ifufore', 'ifupost', 'ifuslicer', 'mrsxartcorr', 'msa', 'msaoper', 'ote', 'pastasoss', 'pathloss', 'photom', 'psf', 'regions', 'sflat', 'speckernel', 'specprofile', 'specwcs', 'wavecorr', 'wavelengthrange']
2026-03-27 13:43:50,281 - stpipe.pipeline - INFO - Prefetch for APCORR reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_apcorr_0009.asdf'.
2026-03-27 13:43:50,282 - stpipe.pipeline - INFO - Prefetch for AREA reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_area_0046.fits'.
2026-03-27 13:43:50,283 - stpipe.pipeline - INFO - Prefetch for BARSHADOW reference file is 'N/A'.
2026-03-27 13:43:50,283 - stpipe.pipeline - INFO - Prefetch for BKG reference file is 'N/A'.
2026-03-27 13:43:50,284 - stpipe.pipeline - INFO - Prefetch for CAMERA reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_camera_0008.asdf'.
2026-03-27 13:43:50,284 - stpipe.pipeline - INFO - Prefetch for COLLIMATOR reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_collimator_0008.asdf'.
2026-03-27 13:43:50,285 - stpipe.pipeline - INFO - Prefetch for CUBEPAR reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_cubepar_0009.fits'.
2026-03-27 13:43:50,286 - stpipe.pipeline - INFO - Prefetch for DFLAT reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_dflat_0002.fits'.
2026-03-27 13:43:50,286 - stpipe.pipeline - INFO - Prefetch for DISPERSER reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_disperser_0066.asdf'.
2026-03-27 13:43:50,287 - stpipe.pipeline - INFO - Prefetch for DISTORTION reference file is 'N/A'.
2026-03-27 13:43:50,287 - stpipe.pipeline - INFO - Prefetch for EXTRACT1D reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_extract1d_0002.asdf'.
2026-03-27 13:43:50,288 - stpipe.pipeline - INFO - Prefetch for FFLAT reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fflat_0170.fits'.
2026-03-27 13:43:50,289 - stpipe.pipeline - INFO - Prefetch for FILTEROFFSET reference file is 'N/A'.
2026-03-27 13:43:50,290 - stpipe.pipeline - INFO - Prefetch for FLAT reference file is 'N/A'.
2026-03-27 13:43:50,290 - stpipe.pipeline - INFO - Prefetch for FORE reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fore_0050.asdf'.
2026-03-27 13:43:50,291 - stpipe.pipeline - INFO - Prefetch for FPA reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fpa_0009.asdf'.
2026-03-27 13:43:50,292 - stpipe.pipeline - INFO - Prefetch for FRINGE reference file is 'N/A'.
2026-03-27 13:43:50,293 - stpipe.pipeline - INFO - Prefetch for IFUFORE reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifufore_0013.asdf'.
2026-03-27 13:43:50,293 - stpipe.pipeline - INFO - Prefetch for IFUPOST reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifupost_0014.asdf'.
2026-03-27 13:43:50,294 - stpipe.pipeline - INFO - Prefetch for IFUSLICER reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifuslicer_0012.asdf'.
2026-03-27 13:43:50,295 - stpipe.pipeline - INFO - Prefetch for MRSXARTCORR reference file is 'N/A'.
2026-03-27 13:43:50,295 - stpipe.pipeline - INFO - Prefetch for MSA reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_msa_0009.asdf'.
2026-03-27 13:43:50,296 - stpipe.pipeline - INFO - Prefetch for MSAOPER reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_msaoper_0006.json'.
2026-03-27 13:43:50,297 - stpipe.pipeline - INFO - Prefetch for OTE reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ote_0011.asdf'.
2026-03-27 13:43:50,297 - stpipe.pipeline - INFO - Prefetch for PASTASOSS reference file is 'N/A'.
2026-03-27 13:43:50,298 - stpipe.pipeline - INFO - Prefetch for PATHLOSS reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pathloss_0003.fits'.
2026-03-27 13:43:50,299 - stpipe.pipeline - INFO - Prefetch for PHOTOM reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_photom_0016.fits'.
2026-03-27 13:43:50,299 - stpipe.pipeline - INFO - Prefetch for PSF reference file is 'N/A'.
2026-03-27 13:43:50,300 - stpipe.pipeline - INFO - Prefetch for REGIONS reference file is 'N/A'.
2026-03-27 13:43:50,300 - stpipe.pipeline - INFO - Prefetch for SFLAT reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_sflat_0212.fits'.
2026-03-27 13:43:50,301 - stpipe.pipeline - INFO - Prefetch for SPECKERNEL reference file is 'N/A'.
2026-03-27 13:43:50,302 - stpipe.pipeline - INFO - Prefetch for SPECPROFILE reference file is 'N/A'.
2026-03-27 13:43:50,302 - stpipe.pipeline - INFO - Prefetch for SPECWCS reference file is 'N/A'.
2026-03-27 13:43:50,303 - stpipe.pipeline - INFO - Prefetch for WAVECORR reference file is 'N/A'.
2026-03-27 13:43:50,303 - stpipe.pipeline - INFO - Prefetch for WAVELENGTHRANGE reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_wavelengthrange_0006.asdf'.
2026-03-27 13:43:50,304 - jwst.pipeline.calwebb_spec2 - INFO - Starting calwebb_spec2 ...
2026-03-27 13:43:50,305 - jwst.pipeline.calwebb_spec2 - INFO - Processing product mast_products/jw01335004001_03101_00002_nrs2
2026-03-27 13:43:50,306 - jwst.pipeline.calwebb_spec2 - INFO - Working on input ./mast_products/jw01335004001_03101_00002_nrs2_rate.fits ...
2026-03-27 13:43:50,515 - stpipe.step - INFO - Step assign_wcs running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_rate.fits>,).
2026-03-27 13:43:50,582 - jwst.assign_wcs.nirspec - INFO - gwa_ytilt is 0.133357972 deg
2026-03-27 13:43:50,582 - jwst.assign_wcs.nirspec - INFO - gwa_xtilt is 0.3564805 deg
2026-03-27 13:43:50,583 - jwst.assign_wcs.nirspec - INFO - theta_y correction: 0.0052787810844296245 deg
2026-03-27 13:43:50,585 - jwst.assign_wcs.nirspec - INFO - theta_x correction: 0.00014063512894183975 deg
2026-03-27 13:43:50,660 - jwst.assign_wcs.nirspec - INFO - Applied Barycentric velocity correction : 1.0000997975589527
2026-03-27 13:43:52,249 - jwst.assign_wcs.nirspec - INFO - Created a NIRSPEC nrs_ifu pipeline with references {'distortion': None, 'filteroffset': None, 'specwcs': None, 'regions': None, 'wavelengthrange': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_wavelengthrange_0006.asdf', 'camera': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_camera_0008.asdf', 'collimator': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_collimator_0008.asdf', 'disperser': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_disperser_0066.asdf', 'fore': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fore_0050.asdf', 'fpa': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fpa_0009.asdf', 'msa': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_msa_0009.asdf', 'ote': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ote_0011.asdf', 'ifupost': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifupost_0014.asdf', 'ifufore': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifufore_0013.asdf', 'ifuslicer': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifuslicer_0012.asdf'}
2026-03-27 13:43:57,775 - stcal.alignment.util - INFO - Update S_REGION to POLYGON ICRS  150.546368565 1.617854367 150.547591077 1.617854367 150.547591077 1.618979922 150.546368565 1.618979922
2026-03-27 13:44:02,050 - jwst.assign_wcs.assign_wcs - INFO - COMPLETED assign_wcs
2026-03-27 13:44:02,055 - stpipe.step - INFO - Step assign_wcs done
2026-03-27 13:44:02,358 - stpipe.step - INFO - Step badpix_selfcal running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_rate.fits>, [], []).
2026-03-27 13:44:02,359 - stpipe.step - INFO - Step skipped.
2026-03-27 13:44:02,633 - stpipe.step - INFO - Step msa_flagging running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_rate.fits>,).
2026-03-27 13:44:05,484 - jwst.msaflagopen.msaflagopen_step - INFO - Using reference file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_msaoper_0006.json
2026-03-27 13:44:05,548 - jwst.msaflagopen.msaflag_open - INFO - 24 failed open shutters
2026-03-27 13:44:12,688 - stpipe.step - INFO - Step msa_flagging done
2026-03-27 13:44:13,420 - stpipe.step - INFO - Step nsclean running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_rate.fits>,).
2026-03-27 13:44:13,422 - jwst.nsclean.nsclean_step - WARNING - The 'nsclean' step is a deprecated alias to 'clean_flicker_noise' and will be removed in future builds.
2026-03-27 13:44:13,439 - jwst.clean_flicker_noise.clean_flicker_noise - INFO - Input exposure type is NRS_IFU, detector=NRS2
2026-03-27 13:44:16,531 - jwst.clean_flicker_noise.clean_flicker_noise - INFO - Flagging failed-open MSA shutters for scene masking
2026-03-27 13:44:16,532 - stpipe.step - INFO - MSAFlagOpenStep instance created.
2026-03-27 13:44:26,689 - jwst.clean_flicker_noise.clean_flicker_noise - INFO - Creating mask
2026-03-27 13:44:26,690 - jwst.clean_flicker_noise.clean_flicker_noise - INFO - Finding slice pixels for an IFU image
2026-03-27 13:44:28,877 - jwst.clean_flicker_noise.clean_flicker_noise - INFO - Masking the fixed slit region for IFU data.
2026-03-27 13:44:29,119 - jwst.clean_flicker_noise.clean_flicker_noise - INFO - Cleaning image jw01335004001_03101_00002_nrs2_rate.fits
2026-03-27 13:44:31,023 - jwst.nsclean.nsclean_step - INFO - Saving mask file ./stage2_nsclean_default/jw01335004001_03101_00002_nrs2_mask.fits
2026-03-27 13:44:33,561 - stpipe.step - INFO - Saved model in ./stage2_nsclean_default/jw01335004001_03101_00002_nrs2_nsclean.fits
2026-03-27 13:44:33,562 - stpipe.step - INFO - Step nsclean done
2026-03-27 13:44:34,088 - stpipe.step - INFO - Step imprint_subtract running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>, []).
2026-03-27 13:44:34,090 - stpipe.step - INFO - Step skipped.
2026-03-27 13:44:34,448 - stpipe.step - INFO - Step bkg_subtract running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>, []).
2026-03-27 13:44:34,449 - stpipe.step - INFO - Step skipped.
2026-03-27 13:44:34,825 - stpipe.step - INFO - Step srctype running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:44:37,320 - jwst.srctype.srctype - INFO - Input EXP_TYPE is NRS_IFU
2026-03-27 13:44:37,321 - jwst.srctype.srctype - INFO - Input SRCTYAPT = EXTENDED
2026-03-27 13:44:37,322 - jwst.srctype.srctype - INFO - Using input source type = EXTENDED
2026-03-27 13:44:37,324 - stpipe.step - INFO - Step srctype done
2026-03-27 13:44:37,803 - stpipe.step - INFO - Step straylight running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:44:37,805 - stpipe.step - INFO - Step skipped.
2026-03-27 13:44:38,263 - stpipe.step - INFO - Step flat_field running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:44:38,291 - jwst.flatfield.flat_field_step - INFO - No reference found for type FLAT
2026-03-27 13:44:38,355 - jwst.flatfield.flat_field_step - INFO - Using FFLAT reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fflat_0170.fits
2026-03-27 13:44:38,452 - jwst.flatfield.flat_field_step - INFO - Using SFLAT reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_sflat_0212.fits
2026-03-27 13:44:38,596 - jwst.flatfield.flat_field_step - INFO - Using DFLAT reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_dflat_0002.fits
2026-03-27 13:44:48,103 - stpipe.step - INFO - Step flat_field done
2026-03-27 13:44:48,770 - stpipe.step - INFO - Step fringe running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:44:48,772 - stpipe.step - INFO - Step skipped.
2026-03-27 13:44:49,219 - stpipe.step - INFO - Step pathloss running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:44:49,239 - jwst.pathloss.pathloss_step - INFO - Using PATHLOSS reference file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pathloss_0003.fits
2026-03-27 13:44:49,275 - jwst.pathloss.pathloss - INFO - Input exposure type is NRS_IFU
2026-03-27 13:44:54,301 - stpipe.step - INFO - Step pathloss done
2026-03-27 13:44:54,995 - stpipe.step - INFO - Step barshadow running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:44:54,997 - stpipe.step - INFO - Step skipped.
2026-03-27 13:44:55,485 - stpipe.step - INFO - Step photom running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:44:55,506 - jwst.photom.photom_step - INFO - Using photom reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_photom_0016.fits
2026-03-27 13:44:55,507 - jwst.photom.photom_step - INFO - Using area reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_area_0046.fits
2026-03-27 13:44:58,049 - jwst.photom.photom - INFO - Using instrument: NIRSPEC
2026-03-27 13:44:58,050 - jwst.photom.photom - INFO -  detector: NRS2
2026-03-27 13:44:58,050 - jwst.photom.photom - INFO -  exp_type: NRS_IFU
2026-03-27 13:44:58,051 - jwst.photom.photom - INFO -  filter: F100LP
2026-03-27 13:44:58,051 - jwst.photom.photom - INFO -  grating: G140H
2026-03-27 13:44:58,097 - jwst.photom.photom - INFO - PHOTMJSR value: 3.83761e+12
2026-03-27 13:45:00,462 - stpipe.step - INFO - Step photom done
2026-03-27 13:45:01,164 - stpipe.step - INFO - Step residual_fringe running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:45:01,166 - stpipe.step - INFO - Step skipped.
2026-03-27 13:45:04,322 - stpipe.step - INFO - Step pixel_replace running with args (<IFUImageModel(2048, 2048) from ./stage2_nsclean_default/jw01335004001_03101_00002_nrs2_cal.fits>,).
2026-03-27 13:45:04,323 - stpipe.step - INFO - Step skipped.
2026-03-27 13:45:04,850 - stpipe.step - INFO - Step cube_build running with args (<IFUImageModel(2048, 2048) from ./stage2_nsclean_default/jw01335004001_03101_00002_nrs2_cal.fits>,).
2026-03-27 13:45:04,851 - jwst.cube_build.cube_build_step - INFO - Starting IFU Cube Building Step
2026-03-27 13:45:04,852 - jwst.cube_build.cube_build_step - INFO - Input interpolation: drizzle
2026-03-27 13:45:04,853 - jwst.cube_build.cube_build_step - INFO - Coordinate system to use: skyalign
2026-03-27 13:45:04,870 - jwst.cube_build.cube_build_step - INFO - Setting output type to: band
2026-03-27 13:45:04,895 - jwst.cube_build.cube_build - INFO - Reading cube parameter file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_cubepar_0009.fits
2026-03-27 13:45:05,348 - jwst.cube_build.cube_build - INFO - Output Cubes are single grating, single filter IFU Cubes
2026-03-27 13:45:05,348 - jwst.cube_build.cube_build_step - INFO - Number of IFU cubes produced by this run = 1
2026-03-27 13:45:05,350 - jwst.cube_build.ifu_cube - INFO - Increasing spatial region of interest default value set for 4 dithers nan
2026-03-27 13:45:05,352 - jwst.cube_build.ifu_cube - INFO - Cube Geometry:
2026-03-27 13:45:05,353 - jwst.cube_build.ifu_cube - INFO - axis#  Naxis  CRPIX    CRVAL       CDELT(arcsec)  Min & Max (xi, eta arcsec)
2026-03-27 13:45:05,354 - jwst.cube_build.ifu_cube - INFO - Axis 1    47  24.00 150.54697982   0.10000000  -2.35000004   2.35000004
2026-03-27 13:45:05,354 - jwst.cube_build.ifu_cube - INFO - Axis 2    45  23.00   1.61841714   0.10000000  -2.25000003   2.25000003
2026-03-27 13:45:05,355 - jwst.cube_build.ifu_cube - INFO - axis#  Naxis  CRPIX    CRVAL      CDELT(microns)  Min & Max (microns)
2026-03-27 13:45:05,356 - jwst.cube_build.ifu_cube - INFO - Axis 3  3915   1.00   0.97011753   0.00023500   0.97000003   1.89002503
2026-03-27 13:45:05,357 - jwst.cube_build.ifu_cube - INFO - Cube covers grating, filter: g140h, f100lp
2026-03-27 13:45:05,357 - jwst.cube_build.ifu_cube - INFO - Output Name: ./stage2_nsclean_default/jw01335004001_03101_00002_nrs2_s3d.fits
2026-03-27 13:45:07,984 - jwst.cube_build.ifu_cube - INFO - Mapping each NIRSpec slice to sky for input file: ./stage2_nsclean_default/jw01335004001_03101_00002_nrs2_cal.fits
2026-03-27 13:45:17,946 - jwst.cube_build.ifu_cube - INFO - # of detector pixels not mapped to output plane: 9178 with wavelength above 1.890381051178193
2026-03-27 13:45:34,443 - jwst.cube_build.ifu_cube - INFO - Average # of holes/wavelength plane is < 1
2026-03-27 13:45:34,444 - jwst.cube_build.ifu_cube - INFO - Total # of holes for IFU cube is : 0
2026-03-27 13:45:34,751 - stcal.alignment.util - INFO - Update S_REGION to POLYGON ICRS  150.546340677 1.617806033 150.546340677 1.619028256 150.547618965 1.619028256 150.547618965 1.617806033
2026-03-27 13:45:34,754 - stpipe.step - INFO - Step cube_build done
2026-03-27 13:45:34,880 - stpipe.step - INFO - Saved model in ./stage2_nsclean_default/jw01335004001_03101_00002_nrs2_s3d.fits
2026-03-27 13:45:35,750 - stpipe.step - INFO - Step extract_1d running with args (<jwst.datamodels.container.ModelContainer object at 0x7fc419d6ae10>,).
2026-03-27 13:45:35,755 - jwst.extract_1d.extract_1d_step - INFO - Using EXTRACT1D reference file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_extract1d_0002.asdf
2026-03-27 13:45:35,758 - jwst.extract_1d.extract_1d_step - INFO - Using APCORR file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_apcorr_0009.asdf
2026-03-27 13:45:35,762 - jwst.extract_1d.extract_1d_step - INFO - Turning off residual fringe correction because it only works on MIRI MRS data
2026-03-27 13:45:35,763 - jwst.extract_1d.ifu - INFO - Source type = EXTENDED
2026-03-27 13:45:35,972 - jwst.extract_1d.ifu - INFO - Input model does not break out variance information. Passing only generalized errors.
2026-03-27 13:45:50,358 - stpipe.step - INFO - Saved model in ./stage2_nsclean_default/jw01335004001_03101_00002_nrs2_x1d.fits
2026-03-27 13:45:50,359 - stpipe.step - INFO - Step extract_1d done
2026-03-27 13:45:50,360 - jwst.pipeline.calwebb_spec2 - INFO - Finished processing product mast_products/jw01335004001_03101_00002_nrs2
2026-03-27 13:45:50,361 - jwst.pipeline.calwebb_spec2 - INFO - Ending calwebb_spec2
2026-03-27 13:45:50,362 - jwst.stpipe.core - INFO - Results used CRDS context: jwst_1464.pmap
2026-03-27 13:45:52,039 - stpipe.step - INFO - Saved model in ./stage2_nsclean_default/jw01335004001_03101_00002_nrs2_cal.fits
2026-03-27 13:45:52,040 - stpipe.step - INFO - Step Spec2Pipeline done
2026-03-27 13:45:52,041 - jwst.stpipe.core - INFO - Results used jwst version: 1.20.2
Saved jw01335004001_03101_00002_nrs2_mask.fits
Saved jw01335004001_03101_00002_nrs2_nsclean.fits
Saved jw01335004001_03101_00002_nrs2_cal.fits
Saved jw01335004001_03101_00002_nrs2_x1d.fits
Run time:  4.133333333333334  min
Warning:

In some situations, the NSClean step may fail to find a fit to the background noise. This failure may occur if the mask does not contain enough dark data (marked True). In particular, every column in the mask except for the first and last 4 columns must contain some pixels marked True. The background fitting procedure considers each column, one at a time, so it will crash if there is no data in a column to fit. If failure occurs, check that your mask in the image below has at least some True values in every column.

5.1 Verify the Mask (Default Pipeline Mask) #


Check the mask against the rate data to make sure it keeps only dark areas of the detector.

Note that there are still some remaining illuminated areas, primarily due to transient artifacts like cosmic rays and snowballs.

# Plot the rate data with masked areas blocked.

# List of on-the-fly built masks from the pipeline.
nsclean_default_masks = [
    stage2_nsclean_default_dir + "jw01335004001_03101_00002_nrs1_mask.fits",
    stage2_nsclean_default_dir + "jw01335004001_03101_00002_nrs2_mask.fits",
]

# Plot each associated set of rateint data and mask file.
for rate_file, mask_file in zip(rate_names, nsclean_default_masks):
    plot_dark_data(mast_products_dir + rate_file, mask_file, layout="columns", scale=9)
../../../_images/89def9b6c4ba5eabffd4dde7518e919612b516f4422c1f0138727f5736bffba2.png ../../../_images/faeeda09c5051a42777d2f4a68e2ad0fbdbfdd985cef0db6708c9b15f715024e.png

5.2 Comparing Original vs. Cleaned Data (Default Pipeline Mask) #


We can now compare the cleaned data (with the default pipeline mask) to the original rate file and verify that the 1/f noise has been reduced.

In many cases, the cleaning process introduces new artifacts to the rate file. These should be carefully examined and weighed against the benefits of noise reduction. If transient artifacts, like snowballs, are interfering with the cleaning process, it may be beneficial to manually edit the mask to remove these areas from consideration in the background fit. To do so, try varying the outlier detection threshold or editing specific pixels in the mask array directly (explored in the next few sections). Otherwise, refer to the NSClean documentation for additional suggestions on manual editing.

Note that in the images below, there are scattered values with large relative differences from the original rate file (shown in the relative difference image below). These are artifacts of the cleaning process.

There are also broader low-level residual background effects (shown in the relative difference image on the right, below, with scattered outliers, identified with sigma clipping, hidden by masking). These include the background patterns we are trying to remove: the 1/f noise variations in the dispersion direction and the picture frame effect at the top and bottom of the frame (for full-frame data). However, there may also be low-level artifacts introduced by over-fitting the dark data in the cleaning process.

Check both residual images carefully to understand the impact of the cleaning process on your data.

# Plot the original and cleaned data, as well as a residual map.

cleaned_default_masks = [
    stage2_nsclean_default_dir + "jw01335004001_03101_00002_nrs1_nsclean.fits",
    stage2_nsclean_default_dir + "jw01335004001_03101_00002_nrs2_nsclean.fits",
]

# Plot each associated set of rateint data and cleaned file.
for rate_file, cleaned_file in zip(rate_names, cleaned_default_masks):
    plot_cleaned_data(
        mast_products_dir + rate_file, cleaned_file, layout="columns", scale=9
    )
../../../_images/6624339cbe0a2000f8da7d2563a72ff9557e837a023666268456b0cb387698ed.png ../../../_images/d24a2ab05feab354daaa8352043cb53d338ef01f75dda4625f331d23cc3c03ba.png

Compare the extracted spectrum from the cleaned data to the spectrum extracted from the original rate file.

# 1D extracted spectra.
x1d_nsclean_skipped = [
    stage2_nsclean_skipped_dir + "jw01335004001_03101_00002_nrs1_x1d.fits",
    stage2_nsclean_skipped_dir + "jw01335004001_03101_00002_nrs2_x1d.fits",
]
x1d_nsclean_default = [
    stage2_nsclean_default_dir + "jw01335004001_03101_00002_nrs1_x1d.fits",
    stage2_nsclean_default_dir + "jw01335004001_03101_00002_nrs2_x1d.fits",
]

# Wavelength region of interest.
wavelength_range = {"nrs1": [1.15, 1.25], "nrs2": [1.65, 1.75]}
for original, cleaned in zip(x1d_nsclean_skipped, x1d_nsclean_default):
    plot_spectra(
        [original, cleaned], scale_percent=4, wavelength_range=wavelength_range
    )
../../../_images/f843ae697134f495baadf404254e1ef6c5aca2c899fcd780cff4cecf0b6c7f8e.png ../../../_images/9585ef7a71d3c3b1f096354f5435f226f36b516dc458c956dc462f01dbf73b76.png

Notes:

  • The portion of the spectrum near 1.2um for NRS1 and 1.7um for NRS2, the excess flux due to 1/f noise is reduced.

  • There are several spikes in the difference between the cleaned and original spectra. These correspond to the scattered artifacts introduced by the cleaning process, above.

6. Clean up 1/f Noise with NSClean (Alternate Mask) #


For some data sets, masking the entire science region may excessively mask dark areas of the detector that could be used to improve the background fit. Excessive masking can introduce some high frequency noise in the cleaning process that appears as vertical striping over the spectral traces. Also, for some data sets, there may be several illuminated regions of the detector that are not masked by the IFU slice bounding boxes. This may include transient artifacts like cosmic rays or glow from saturated sources.

In some cases, it may be beneficial to build the mask with an alternate algorithm. Here, we do not use the bounding boxes and instead iteratively mask any data more than 1 sigma above the background. For bright sources, this might leave more dark data between the spectral traces and may improve the background fit.

Note, however, that excessive cleaning may impact the continuum level for the spectrum, if too much or too little illuminated data is included in the mask. Again, the generated mask and output spectra should be carefully examined to weigh the benefits of cleaning against the impact on the spectra.

To tune the illumination detection in this mask, try modifying the n_sigma parameter below. A higher value will identify less illumination. A lower value will identify more.

# Set up directory for running NSClean with user-supplied mask.
stage2_nsclean_alternate_dir = "./stage2_nsclean_alternate/"
if not os.path.exists(stage2_nsclean_alternate_dir):
    os.makedirs(
        stage2_nsclean_alternate_dir
    )  # Create the directory if it doesn't exist.
# 1/f noise cleaned data (alternate NSClean pipeline mask).
# Estimated run time: 87 minutes (may vary).
start = tt.time()

for indx, i in enumerate(rate_names):
    print(f"Processing {i}... ")

    Spec2Pipeline.call(
        mast_products_dir + i,
        save_results=True,
        steps={
            "nsclean": {
                "skip": False,
                "save_mask": True,
                "n_sigma": 1,
                "mask_spectral_regions": False,
                "save_results": True,
            },  # Removes correlated read noise (1/f noise) from NIRSpec images.
        },
        output_dir=stage2_nsclean_alternate_dir,
    )

    print(f"Saved {i[:-9]}" + "mask.fits")
    print(f"Saved {i[:-9]}" + "nsclean.fits")
    print(f"Saved {i[:-9]}" + "cal.fits")
    print(f"Saved {i[:-9]}" + "x1d.fits")

end = tt.time()
print("Run time: ", round(end - start, 1) / 60.0, " min")
2026-03-27 13:46:03,754 - stpipe.step - INFO - PARS-RESAMPLESPECSTEP parameters found: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pars-resamplespecstep_0001.asdf
2026-03-27 13:46:03,772 - stpipe.step - INFO - PARS-RESAMPLESPECSTEP parameters found: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pars-resamplespecstep_0001.asdf
2026-03-27 13:46:03,796 - stpipe.step - INFO - Spec2Pipeline instance created.
2026-03-27 13:46:03,797 - stpipe.step - INFO - AssignWcsStep instance created.
2026-03-27 13:46:03,799 - stpipe.step - INFO - BadpixSelfcalStep instance created.
2026-03-27 13:46:03,800 - stpipe.step - INFO - MSAFlagOpenStep instance created.
2026-03-27 13:46:03,800 - stpipe.step - INFO - NSCleanStep instance created.
2026-03-27 13:46:03,801 - stpipe.step - INFO - BackgroundStep instance created.
2026-03-27 13:46:03,802 - stpipe.step - INFO - ImprintStep instance created.
2026-03-27 13:46:03,803 - stpipe.step - INFO - Extract2dStep instance created.
2026-03-27 13:46:03,808 - stpipe.step - INFO - MasterBackgroundMosStep instance created.
2026-03-27 13:46:03,809 - stpipe.step - INFO - FlatFieldStep instance created.
2026-03-27 13:46:03,810 - stpipe.step - INFO - PathLossStep instance created.
2026-03-27 13:46:03,811 - stpipe.step - INFO - BarShadowStep instance created.
2026-03-27 13:46:03,811 - stpipe.step - INFO - PhotomStep instance created.
2026-03-27 13:46:03,812 - stpipe.step - INFO - PixelReplaceStep instance created.
2026-03-27 13:46:03,813 - stpipe.step - INFO - ResampleSpecStep instance created.
2026-03-27 13:46:03,815 - stpipe.step - INFO - Extract1dStep instance created.
2026-03-27 13:46:03,816 - stpipe.step - INFO - WavecorrStep instance created.
2026-03-27 13:46:03,817 - stpipe.step - INFO - FlatFieldStep instance created.
2026-03-27 13:46:03,818 - stpipe.step - INFO - SourceTypeStep instance created.
2026-03-27 13:46:03,819 - stpipe.step - INFO - StraylightStep instance created.
2026-03-27 13:46:03,820 - stpipe.step - INFO - FringeStep instance created.
2026-03-27 13:46:03,821 - stpipe.step - INFO - ResidualFringeStep instance created.
2026-03-27 13:46:03,821 - stpipe.step - INFO - PathLossStep instance created.
2026-03-27 13:46:03,822 - stpipe.step - INFO - BarShadowStep instance created.
2026-03-27 13:46:03,823 - stpipe.step - INFO - WfssContamStep instance created.
2026-03-27 13:46:03,824 - stpipe.step - INFO - PhotomStep instance created.
2026-03-27 13:46:03,825 - stpipe.step - INFO - PixelReplaceStep instance created.
2026-03-27 13:46:03,826 - stpipe.step - INFO - ResampleSpecStep instance created.
2026-03-27 13:46:03,828 - stpipe.step - INFO - CubeBuildStep instance created.
2026-03-27 13:46:03,830 - stpipe.step - INFO - Extract1dStep instance created.
Processing jw01335004001_03101_00002_nrs1_rate.fits... 
2026-03-27 13:46:04,978 - stpipe.step - INFO - Step Spec2Pipeline running with args ('./mast_products/jw01335004001_03101_00002_nrs1_rate.fits',).
2026-03-27 13:46:05,013 - stpipe.step - INFO - Step Spec2Pipeline parameters are:
  pre_hooks: []
  post_hooks: []
  output_file: None
  output_dir: ./stage2_nsclean_alternate/
  output_ext: .fits
  output_use_model: False
  output_use_index: True
  save_results: True
  skip: False
  suffix: None
  search_output_file: True
  input_dir: ''
  save_bsub: False
  fail_on_exception: True
  save_wfss_esec: False
  steps:
    assign_wcs:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      sip_approx: True
      sip_max_pix_error: 0.01
      sip_degree: None
      sip_max_inv_pix_error: 0.01
      sip_inv_degree: None
      sip_npoints: 12
      slit_y_low: -0.55
      slit_y_high: 0.55
      nrs_ifu_slice_wcs: False
    badpix_selfcal:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: True
      suffix: None
      search_output_file: True
      input_dir: ''
      flagfrac_lower: 0.001
      flagfrac_upper: 0.001
      kernel_size: 15
      force_single: False
      save_flagged_bkg: False
    msa_flagging:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
    nsclean:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: True
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      fit_method: fft
      fit_by_channel: False
      background_method: None
      background_box_size: None
      mask_spectral_regions: False
      n_sigma: 1
      fit_histogram: False
      single_mask: False
      user_mask: None
      save_mask: True
      save_background: False
      save_noise: False
    bkg_subtract:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      bkg_list: None
      save_combined_background: False
      sigma: 3.0
      maxiters: None
      soss_source_percentile: 35.0
      soss_bkg_percentile: None
      wfss_mmag_extract: None
      wfss_maxiter: 5
      wfss_rms_stop: 0.0
      wfss_outlier_percent: 1.0
    imprint_subtract:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
    extract_2d:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      slit_names: None
      source_ids: None
      extract_orders: None
      grism_objects: None
      tsgrism_extract_height: None
      wfss_extract_half_height: 5
      wfss_mmag_extract: None
      wfss_nbright: 1000
    master_background_mos:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: True
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      sigma_clip: 3.0
      median_kernel: 1
      force_subtract: False
      save_background: False
      user_background: None
      inverse: False
      steps:
        flat_field:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          save_interpolated_flat: False
          user_supplied_flat: None
          inverse: False
        pathloss:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          inverse: False
          source_type: None
          user_slit_loc: None
        barshadow:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          inverse: False
          source_type: None
        photom:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          inverse: False
          source_type: None
          apply_time_correction: True
        pixel_replace:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: True
          output_use_index: True
          save_results: False
          skip: True
          suffix: None
          search_output_file: True
          input_dir: ''
          algorithm: fit_profile
          n_adjacent_cols: 3
        resample_spec:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          pixfrac: 1.0
          kernel: square
          fillval: NaN
          weight_type: exptime
          output_shape: None
          pixel_scale_ratio: 1.0
          pixel_scale: None
          output_wcs: ''
          single: False
          blendheaders: True
          in_memory: True
        extract_1d:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          subtract_background: None
          apply_apcorr: True
          extraction_type: box
          use_source_posn: None
          position_offset: 0.0
          model_nod_pair: True
          optimize_psf_location: True
          smoothing_length: None
          bkg_fit: None
          bkg_order: None
          log_increment: 50
          save_profile: False
          save_scene_model: False
          save_residual_image: False
          center_xy: None
          ifu_autocen: False
          bkg_sigma_clip: 3.0
          ifu_rfcorr: True
          ifu_set_srctype: None
          ifu_rscale: None
          ifu_covar_scale: 1.0
          soss_atoca: True
          soss_threshold: 0.01
          soss_n_os: 2
          soss_wave_grid_in: None
          soss_wave_grid_out: None
          soss_estimate: None
          soss_rtol: 0.0001
          soss_max_grid_size: 20000
          soss_tikfac: None
          soss_width: 40.0
          soss_bad_pix: masking
          soss_modelname: None
          soss_order_3: True
    wavecorr:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
    flat_field:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      save_interpolated_flat: False
      user_supplied_flat: None
      inverse: False
    srctype:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      source_type: None
    straylight:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      clean_showers: False
      shower_plane: 3
      shower_x_stddev: 18.0
      shower_y_stddev: 5.0
      shower_low_reject: 0.1
      shower_high_reject: 99.9
      save_shower_model: False
    fringe:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
    residual_fringe:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: True
      suffix: residual_fringe
      search_output_file: False
      input_dir: ''
      save_intermediate_results: False
      ignore_region_min: None
      ignore_region_max: None
    pathloss:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      inverse: False
      source_type: None
      user_slit_loc: None
    barshadow:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      inverse: False
      source_type: None
    wfss_contam:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: True
      suffix: None
      search_output_file: True
      input_dir: ''
      save_simulated_image: False
      save_contam_images: False
      maximum_cores: none
      orders: None
      magnitude_limit: None
      wl_oversample: 2
      max_pixels_per_chunk: 50000
    photom:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      inverse: False
      source_type: None
      apply_time_correction: True
    pixel_replace:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: True
      output_use_index: True
      save_results: False
      skip: True
      suffix: None
      search_output_file: True
      input_dir: ''
      algorithm: fit_profile
      n_adjacent_cols: 3
    resample_spec:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      pixfrac: 1.0
      kernel: square
      fillval: NaN
      weight_type: exptime
      output_shape: None
      pixel_scale_ratio: 1.0
      pixel_scale: None
      output_wcs: ''
      single: False
      blendheaders: True
      in_memory: True
    cube_build:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: True
      output_use_index: True
      save_results: False
      skip: False
      suffix: s3d
      search_output_file: False
      input_dir: ''
      pipeline: 3
      channel: all
      band: all
      grating: all
      filter: all
      output_type: None
      scalexy: 0.0
      scalew: 0.0
      weighting: drizzle
      coord_system: skyalign
      ra_center: None
      dec_center: None
      cube_pa: None
      nspax_x: None
      nspax_y: None
      rois: 0.0
      roiw: 0.0
      weight_power: 2.0
      wavemin: None
      wavemax: None
      single: False
      skip_dqflagging: False
      offset_file: None
      debug_spaxel: -1 -1 -1
    extract_1d:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      subtract_background: None
      apply_apcorr: True
      extraction_type: box
      use_source_posn: None
      position_offset: 0.0
      model_nod_pair: True
      optimize_psf_location: True
      smoothing_length: None
      bkg_fit: None
      bkg_order: None
      log_increment: 50
      save_profile: False
      save_scene_model: False
      save_residual_image: False
      center_xy: None
      ifu_autocen: False
      bkg_sigma_clip: 3.0
      ifu_rfcorr: True
      ifu_set_srctype: None
      ifu_rscale: None
      ifu_covar_scale: 1.0
      soss_atoca: True
      soss_threshold: 0.01
      soss_n_os: 2
      soss_wave_grid_in: None
      soss_wave_grid_out: None
      soss_estimate: None
      soss_rtol: 0.0001
      soss_max_grid_size: 20000
      soss_tikfac: None
      soss_width: 40.0
      soss_bad_pix: masking
      soss_modelname: None
      soss_order_3: True
2026-03-27 13:46:05,048 - stpipe.pipeline - INFO - Prefetching reference files for dataset: 'jw01335004001_03101_00002_nrs1_rate.fits' reftypes = ['apcorr', 'area', 'barshadow', 'bkg', 'camera', 'collimator', 'cubepar', 'dflat', 'disperser', 'distortion', 'extract1d', 'fflat', 'filteroffset', 'flat', 'fore', 'fpa', 'fringe', 'ifufore', 'ifupost', 'ifuslicer', 'mrsxartcorr', 'msa', 'msaoper', 'ote', 'pastasoss', 'pathloss', 'photom', 'psf', 'regions', 'sflat', 'speckernel', 'specprofile', 'specwcs', 'wavecorr', 'wavelengthrange']
2026-03-27 13:46:05,053 - stpipe.pipeline - INFO - Prefetch for APCORR reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_apcorr_0009.asdf'.
2026-03-27 13:46:05,054 - stpipe.pipeline - INFO - Prefetch for AREA reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_area_0046.fits'.
2026-03-27 13:46:05,054 - stpipe.pipeline - INFO - Prefetch for BARSHADOW reference file is 'N/A'.
2026-03-27 13:46:05,055 - stpipe.pipeline - INFO - Prefetch for BKG reference file is 'N/A'.
2026-03-27 13:46:05,055 - stpipe.pipeline - INFO - Prefetch for CAMERA reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_camera_0008.asdf'.
2026-03-27 13:46:05,056 - stpipe.pipeline - INFO - Prefetch for COLLIMATOR reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_collimator_0008.asdf'.
2026-03-27 13:46:05,057 - stpipe.pipeline - INFO - Prefetch for CUBEPAR reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_cubepar_0009.fits'.
2026-03-27 13:46:05,057 - stpipe.pipeline - INFO - Prefetch for DFLAT reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_dflat_0001.fits'.
2026-03-27 13:46:05,058 - stpipe.pipeline - INFO - Prefetch for DISPERSER reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_disperser_0066.asdf'.
2026-03-27 13:46:05,059 - stpipe.pipeline - INFO - Prefetch for DISTORTION reference file is 'N/A'.
2026-03-27 13:46:05,059 - stpipe.pipeline - INFO - Prefetch for EXTRACT1D reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_extract1d_0002.asdf'.
2026-03-27 13:46:05,060 - stpipe.pipeline - INFO - Prefetch for FFLAT reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fflat_0170.fits'.
2026-03-27 13:46:05,061 - stpipe.pipeline - INFO - Prefetch for FILTEROFFSET reference file is 'N/A'.
2026-03-27 13:46:05,061 - stpipe.pipeline - INFO - Prefetch for FLAT reference file is 'N/A'.
2026-03-27 13:46:05,062 - stpipe.pipeline - INFO - Prefetch for FORE reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fore_0050.asdf'.
2026-03-27 13:46:05,062 - stpipe.pipeline - INFO - Prefetch for FPA reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fpa_0009.asdf'.
2026-03-27 13:46:05,063 - stpipe.pipeline - INFO - Prefetch for FRINGE reference file is 'N/A'.
2026-03-27 13:46:05,064 - stpipe.pipeline - INFO - Prefetch for IFUFORE reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifufore_0013.asdf'.
2026-03-27 13:46:05,065 - stpipe.pipeline - INFO - Prefetch for IFUPOST reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifupost_0014.asdf'.
2026-03-27 13:46:05,066 - stpipe.pipeline - INFO - Prefetch for IFUSLICER reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifuslicer_0012.asdf'.
2026-03-27 13:46:05,066 - stpipe.pipeline - INFO - Prefetch for MRSXARTCORR reference file is 'N/A'.
2026-03-27 13:46:05,067 - stpipe.pipeline - INFO - Prefetch for MSA reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_msa_0009.asdf'.
2026-03-27 13:46:05,068 - stpipe.pipeline - INFO - Prefetch for MSAOPER reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_msaoper_0006.json'.
2026-03-27 13:46:05,068 - stpipe.pipeline - INFO - Prefetch for OTE reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ote_0011.asdf'.
2026-03-27 13:46:05,069 - stpipe.pipeline - INFO - Prefetch for PASTASOSS reference file is 'N/A'.
2026-03-27 13:46:05,069 - stpipe.pipeline - INFO - Prefetch for PATHLOSS reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pathloss_0003.fits'.
2026-03-27 13:46:05,070 - stpipe.pipeline - INFO - Prefetch for PHOTOM reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_photom_0016.fits'.
2026-03-27 13:46:05,071 - stpipe.pipeline - INFO - Prefetch for PSF reference file is 'N/A'.
2026-03-27 13:46:05,071 - stpipe.pipeline - INFO - Prefetch for REGIONS reference file is 'N/A'.
2026-03-27 13:46:05,072 - stpipe.pipeline - INFO - Prefetch for SFLAT reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_sflat_0216.fits'.
2026-03-27 13:46:05,072 - stpipe.pipeline - INFO - Prefetch for SPECKERNEL reference file is 'N/A'.
2026-03-27 13:46:05,073 - stpipe.pipeline - INFO - Prefetch for SPECPROFILE reference file is 'N/A'.
2026-03-27 13:46:05,073 - stpipe.pipeline - INFO - Prefetch for SPECWCS reference file is 'N/A'.
2026-03-27 13:46:05,074 - stpipe.pipeline - INFO - Prefetch for WAVECORR reference file is 'N/A'.
2026-03-27 13:46:05,074 - stpipe.pipeline - INFO - Prefetch for WAVELENGTHRANGE reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_wavelengthrange_0006.asdf'.
2026-03-27 13:46:05,076 - jwst.pipeline.calwebb_spec2 - INFO - Starting calwebb_spec2 ...
2026-03-27 13:46:05,077 - jwst.pipeline.calwebb_spec2 - INFO - Processing product mast_products/jw01335004001_03101_00002_nrs1
2026-03-27 13:46:05,077 - jwst.pipeline.calwebb_spec2 - INFO - Working on input ./mast_products/jw01335004001_03101_00002_nrs1_rate.fits ...
2026-03-27 13:46:05,287 - stpipe.step - INFO - Step assign_wcs running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_rate.fits>,).
2026-03-27 13:46:05,354 - jwst.assign_wcs.nirspec - INFO - gwa_ytilt is 0.133357972 deg
2026-03-27 13:46:05,355 - jwst.assign_wcs.nirspec - INFO - gwa_xtilt is 0.3564805 deg
2026-03-27 13:46:05,356 - jwst.assign_wcs.nirspec - INFO - theta_y correction: 0.0052787810844296245 deg
2026-03-27 13:46:05,357 - jwst.assign_wcs.nirspec - INFO - theta_x correction: 0.00014063512894183975 deg
2026-03-27 13:46:05,430 - jwst.assign_wcs.nirspec - INFO - Applied Barycentric velocity correction : 1.0000997969250545
2026-03-27 13:46:07,035 - jwst.assign_wcs.nirspec - INFO - Created a NIRSPEC nrs_ifu pipeline with references {'distortion': None, 'filteroffset': None, 'specwcs': None, 'regions': None, 'wavelengthrange': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_wavelengthrange_0006.asdf', 'camera': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_camera_0008.asdf', 'collimator': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_collimator_0008.asdf', 'disperser': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_disperser_0066.asdf', 'fore': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fore_0050.asdf', 'fpa': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fpa_0009.asdf', 'msa': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_msa_0009.asdf', 'ote': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ote_0011.asdf', 'ifupost': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifupost_0014.asdf', 'ifufore': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifufore_0013.asdf', 'ifuslicer': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifuslicer_0012.asdf'}
2026-03-27 13:46:13,870 - stcal.alignment.util - INFO - Update S_REGION to POLYGON ICRS  150.546368583 1.617854363 150.547591073 1.617854363 150.547591073 1.618979925 150.546368583 1.618979925
2026-03-27 13:46:19,128 - jwst.assign_wcs.assign_wcs - INFO - COMPLETED assign_wcs
2026-03-27 13:46:19,134 - stpipe.step - INFO - Step assign_wcs done
2026-03-27 13:46:19,462 - stpipe.step - INFO - Step badpix_selfcal running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_rate.fits>, [], []).
2026-03-27 13:46:19,463 - stpipe.step - INFO - Step skipped.
2026-03-27 13:46:19,763 - stpipe.step - INFO - Step msa_flagging running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_rate.fits>,).
2026-03-27 13:46:23,464 - jwst.msaflagopen.msaflagopen_step - INFO - Using reference file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_msaoper_0006.json
2026-03-27 13:46:23,535 - jwst.msaflagopen.msaflag_open - INFO - 24 failed open shutters
2026-03-27 13:46:30,984 - stpipe.step - INFO - Step msa_flagging done
2026-03-27 13:46:31,691 - stpipe.step - INFO - Step nsclean running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_rate.fits>,).
2026-03-27 13:46:31,692 - jwst.nsclean.nsclean_step - WARNING - The 'nsclean' step is a deprecated alias to 'clean_flicker_noise' and will be removed in future builds.
2026-03-27 13:46:31,708 - jwst.clean_flicker_noise.clean_flicker_noise - INFO - Input exposure type is NRS_IFU, detector=NRS1
2026-03-27 13:46:35,805 - jwst.clean_flicker_noise.clean_flicker_noise - INFO - Creating mask
2026-03-27 13:46:36,376 - jwst.clean_flicker_noise.clean_flicker_noise - INFO - Cleaning image jw01335004001_03101_00002_nrs1_rate.fits
2026-03-27 13:46:39,161 - jwst.nsclean.nsclean_step - INFO - Saving mask file ./stage2_nsclean_alternate/jw01335004001_03101_00002_nrs1_mask.fits
2026-03-27 13:46:40,758 - stpipe.step - INFO - Saved model in ./stage2_nsclean_alternate/jw01335004001_03101_00002_nrs1_nsclean.fits
2026-03-27 13:46:40,759 - stpipe.step - INFO - Step nsclean done
2026-03-27 13:46:41,405 - stpipe.step - INFO - Step imprint_subtract running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>, []).
2026-03-27 13:46:41,406 - stpipe.step - INFO - Step skipped.
2026-03-27 13:46:41,804 - stpipe.step - INFO - Step bkg_subtract running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>, []).
2026-03-27 13:46:41,805 - stpipe.step - INFO - Step skipped.
2026-03-27 13:46:42,205 - stpipe.step - INFO - Step srctype running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:46:45,278 - jwst.srctype.srctype - INFO - Input EXP_TYPE is NRS_IFU
2026-03-27 13:46:45,279 - jwst.srctype.srctype - INFO - Input SRCTYAPT = EXTENDED
2026-03-27 13:46:45,279 - jwst.srctype.srctype - INFO - Using input source type = EXTENDED
2026-03-27 13:46:45,282 - stpipe.step - INFO - Step srctype done
2026-03-27 13:46:45,843 - stpipe.step - INFO - Step straylight running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:46:45,844 - stpipe.step - INFO - Step skipped.
2026-03-27 13:46:46,337 - stpipe.step - INFO - Step flat_field running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:46:46,362 - jwst.flatfield.flat_field_step - INFO - No reference found for type FLAT
2026-03-27 13:46:46,426 - jwst.flatfield.flat_field_step - INFO - Using FFLAT reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fflat_0170.fits
2026-03-27 13:46:46,524 - jwst.flatfield.flat_field_step - INFO - Using SFLAT reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_sflat_0216.fits
2026-03-27 13:46:46,668 - jwst.flatfield.flat_field_step - INFO - Using DFLAT reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_dflat_0001.fits
2026-03-27 13:46:56,942 - stpipe.step - INFO - Step flat_field done
2026-03-27 13:46:57,698 - stpipe.step - INFO - Step fringe running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:46:57,699 - stpipe.step - INFO - Step skipped.
2026-03-27 13:46:58,159 - stpipe.step - INFO - Step pathloss running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:46:58,179 - jwst.pathloss.pathloss_step - INFO - Using PATHLOSS reference file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pathloss_0003.fits
2026-03-27 13:46:58,214 - jwst.pathloss.pathloss - INFO - Input exposure type is NRS_IFU
2026-03-27 13:47:04,154 - stpipe.step - INFO - Step pathloss done
2026-03-27 13:47:04,807 - stpipe.step - INFO - Step barshadow running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:47:04,809 - stpipe.step - INFO - Step skipped.
2026-03-27 13:47:05,316 - stpipe.step - INFO - Step photom running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:47:05,337 - jwst.photom.photom_step - INFO - Using photom reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_photom_0016.fits
2026-03-27 13:47:05,338 - jwst.photom.photom_step - INFO - Using area reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_area_0046.fits
2026-03-27 13:47:08,803 - jwst.photom.photom - INFO - Using instrument: NIRSPEC
2026-03-27 13:47:08,804 - jwst.photom.photom - INFO -  detector: NRS1
2026-03-27 13:47:08,805 - jwst.photom.photom - INFO -  exp_type: NRS_IFU
2026-03-27 13:47:08,806 - jwst.photom.photom - INFO -  filter: F100LP
2026-03-27 13:47:08,806 - jwst.photom.photom - INFO -  grating: G140H
2026-03-27 13:47:08,858 - jwst.photom.photom - INFO - PHOTMJSR value: 3.83761e+12
2026-03-27 13:47:11,119 - stpipe.step - INFO - Step photom done
2026-03-27 13:47:11,981 - stpipe.step - INFO - Step residual_fringe running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:47:11,982 - stpipe.step - INFO - Step skipped.
2026-03-27 13:47:15,759 - stpipe.step - INFO - Step pixel_replace running with args (<IFUImageModel(2048, 2048) from ./stage2_nsclean_alternate/jw01335004001_03101_00002_nrs1_cal.fits>,).
2026-03-27 13:47:15,760 - stpipe.step - INFO - Step skipped.
2026-03-27 13:47:16,263 - stpipe.step - INFO - Step cube_build running with args (<IFUImageModel(2048, 2048) from ./stage2_nsclean_alternate/jw01335004001_03101_00002_nrs1_cal.fits>,).
2026-03-27 13:47:16,264 - jwst.cube_build.cube_build_step - INFO - Starting IFU Cube Building Step
2026-03-27 13:47:16,265 - jwst.cube_build.cube_build_step - INFO - Input interpolation: drizzle
2026-03-27 13:47:16,265 - jwst.cube_build.cube_build_step - INFO - Coordinate system to use: skyalign
2026-03-27 13:47:16,281 - jwst.cube_build.cube_build_step - INFO - Setting output type to: band
2026-03-27 13:47:16,307 - jwst.cube_build.cube_build - INFO - Reading cube parameter file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_cubepar_0009.fits
2026-03-27 13:47:16,760 - jwst.cube_build.cube_build - INFO - Output Cubes are single grating, single filter IFU Cubes
2026-03-27 13:47:16,760 - jwst.cube_build.cube_build_step - INFO - Number of IFU cubes produced by this run = 1
2026-03-27 13:47:16,761 - jwst.cube_build.ifu_cube - INFO - Increasing spatial region of interest default value set for 4 dithers nan
2026-03-27 13:47:16,764 - jwst.cube_build.ifu_cube - INFO - Cube Geometry:
2026-03-27 13:47:16,765 - jwst.cube_build.ifu_cube - INFO - axis#  Naxis  CRPIX    CRVAL       CDELT(arcsec)  Min & Max (xi, eta arcsec)
2026-03-27 13:47:16,766 - jwst.cube_build.ifu_cube - INFO - Axis 1    47  24.00 150.54697983   0.10000000  -2.35000004   2.35000004
2026-03-27 13:47:16,767 - jwst.cube_build.ifu_cube - INFO - Axis 2    45  23.00   1.61841714   0.10000000  -2.25000003   2.25000003
2026-03-27 13:47:16,768 - jwst.cube_build.ifu_cube - INFO - axis#  Naxis  CRPIX    CRVAL      CDELT(microns)  Min & Max (microns)
2026-03-27 13:47:16,768 - jwst.cube_build.ifu_cube - INFO - Axis 3  3915   1.00   0.97011753   0.00023500   0.97000003   1.89002503
2026-03-27 13:47:16,769 - jwst.cube_build.ifu_cube - INFO - Cube covers grating, filter: g140h, f100lp
2026-03-27 13:47:16,770 - jwst.cube_build.ifu_cube - INFO - Output Name: ./stage2_nsclean_alternate/jw01335004001_03101_00002_nrs1_s3d.fits
2026-03-27 13:47:20,440 - jwst.cube_build.ifu_cube - INFO - Mapping each NIRSpec slice to sky for input file: ./stage2_nsclean_alternate/jw01335004001_03101_00002_nrs1_cal.fits
2026-03-27 13:47:30,778 - jwst.cube_build.ifu_cube - INFO - # of detector pixels not mapped to output plane: 11068 with wavelength below 0.9696408152516496
2026-03-27 13:47:48,294 - jwst.cube_build.ifu_cube - INFO - Average # of holes/wavelength plane is < 1
2026-03-27 13:47:48,295 - jwst.cube_build.ifu_cube - INFO - Total # of holes for IFU cube is : 0
2026-03-27 13:47:48,594 - stcal.alignment.util - INFO - Update S_REGION to POLYGON ICRS  150.546340684 1.617806033 150.546340684 1.619028255 150.547618972 1.619028255 150.547618972 1.617806033
2026-03-27 13:47:48,597 - stpipe.step - INFO - Step cube_build done
2026-03-27 13:47:48,723 - stpipe.step - INFO - Saved model in ./stage2_nsclean_alternate/jw01335004001_03101_00002_nrs1_s3d.fits
2026-03-27 13:47:49,609 - stpipe.step - INFO - Step extract_1d running with args (<jwst.datamodels.container.ModelContainer object at 0x7fc406389550>,).
2026-03-27 13:47:49,614 - jwst.extract_1d.extract_1d_step - INFO - Using EXTRACT1D reference file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_extract1d_0002.asdf
2026-03-27 13:47:49,617 - jwst.extract_1d.extract_1d_step - INFO - Using APCORR file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_apcorr_0009.asdf
2026-03-27 13:47:49,620 - jwst.extract_1d.extract_1d_step - INFO - Turning off residual fringe correction because it only works on MIRI MRS data
2026-03-27 13:47:49,621 - jwst.extract_1d.ifu - INFO - Source type = EXTENDED
2026-03-27 13:47:49,812 - jwst.extract_1d.ifu - INFO - Input model does not break out variance information. Passing only generalized errors.
2026-03-27 13:48:04,539 - stpipe.step - INFO - Saved model in ./stage2_nsclean_alternate/jw01335004001_03101_00002_nrs1_x1d.fits
2026-03-27 13:48:04,540 - stpipe.step - INFO - Step extract_1d done
2026-03-27 13:48:04,541 - jwst.pipeline.calwebb_spec2 - INFO - Finished processing product mast_products/jw01335004001_03101_00002_nrs1
2026-03-27 13:48:04,543 - jwst.pipeline.calwebb_spec2 - INFO - Ending calwebb_spec2
2026-03-27 13:48:04,543 - jwst.stpipe.core - INFO - Results used CRDS context: jwst_1464.pmap
2026-03-27 13:48:06,186 - stpipe.step - INFO - Saved model in ./stage2_nsclean_alternate/jw01335004001_03101_00002_nrs1_cal.fits
2026-03-27 13:48:06,187 - stpipe.step - INFO - Step Spec2Pipeline done
2026-03-27 13:48:06,188 - jwst.stpipe.core - INFO - Results used jwst version: 1.20.2
2026-03-27 13:48:06,220 - stpipe.step - INFO - PARS-RESAMPLESPECSTEP parameters found: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pars-resamplespecstep_0001.asdf
2026-03-27 13:48:06,237 - stpipe.step - INFO - PARS-RESAMPLESPECSTEP parameters found: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pars-resamplespecstep_0001.asdf
2026-03-27 13:48:06,262 - stpipe.step - INFO - Spec2Pipeline instance created.
2026-03-27 13:48:06,263 - stpipe.step - INFO - AssignWcsStep instance created.
2026-03-27 13:48:06,264 - stpipe.step - INFO - BadpixSelfcalStep instance created.
2026-03-27 13:48:06,265 - stpipe.step - INFO - MSAFlagOpenStep instance created.
2026-03-27 13:48:06,266 - stpipe.step - INFO - NSCleanStep instance created.
2026-03-27 13:48:06,267 - stpipe.step - INFO - BackgroundStep instance created.
2026-03-27 13:48:06,268 - stpipe.step - INFO - ImprintStep instance created.
2026-03-27 13:48:06,269 - stpipe.step - INFO - Extract2dStep instance created.
2026-03-27 13:48:06,274 - stpipe.step - INFO - MasterBackgroundMosStep instance created.
2026-03-27 13:48:06,274 - stpipe.step - INFO - FlatFieldStep instance created.
2026-03-27 13:48:06,275 - stpipe.step - INFO - PathLossStep instance created.
2026-03-27 13:48:06,276 - stpipe.step - INFO - BarShadowStep instance created.
2026-03-27 13:48:06,277 - stpipe.step - INFO - PhotomStep instance created.
2026-03-27 13:48:06,278 - stpipe.step - INFO - PixelReplaceStep instance created.
2026-03-27 13:48:06,280 - stpipe.step - INFO - ResampleSpecStep instance created.
2026-03-27 13:48:06,281 - stpipe.step - INFO - Extract1dStep instance created.
2026-03-27 13:48:06,283 - stpipe.step - INFO - WavecorrStep instance created.
2026-03-27 13:48:06,284 - stpipe.step - INFO - FlatFieldStep instance created.
2026-03-27 13:48:06,284 - stpipe.step - INFO - SourceTypeStep instance created.
2026-03-27 13:48:06,285 - stpipe.step - INFO - StraylightStep instance created.
2026-03-27 13:48:06,286 - stpipe.step - INFO - FringeStep instance created.
2026-03-27 13:48:06,287 - stpipe.step - INFO - ResidualFringeStep instance created.
2026-03-27 13:48:06,288 - stpipe.step - INFO - PathLossStep instance created.
2026-03-27 13:48:06,289 - stpipe.step - INFO - BarShadowStep instance created.
2026-03-27 13:48:06,290 - stpipe.step - INFO - WfssContamStep instance created.
2026-03-27 13:48:06,291 - stpipe.step - INFO - PhotomStep instance created.
2026-03-27 13:48:06,292 - stpipe.step - INFO - PixelReplaceStep instance created.
2026-03-27 13:48:06,293 - stpipe.step - INFO - ResampleSpecStep instance created.
2026-03-27 13:48:06,295 - stpipe.step - INFO - CubeBuildStep instance created.
2026-03-27 13:48:06,297 - stpipe.step - INFO - Extract1dStep instance created.
Saved jw01335004001_03101_00002_nrs1_mask.fits
Saved jw01335004001_03101_00002_nrs1_nsclean.fits
Saved jw01335004001_03101_00002_nrs1_cal.fits
Saved jw01335004001_03101_00002_nrs1_x1d.fits
Processing jw01335004001_03101_00002_nrs2_rate.fits... 
2026-03-27 13:48:07,340 - stpipe.step - INFO - Step Spec2Pipeline running with args ('./mast_products/jw01335004001_03101_00002_nrs2_rate.fits',).
2026-03-27 13:48:07,375 - stpipe.step - INFO - Step Spec2Pipeline parameters are:
  pre_hooks: []
  post_hooks: []
  output_file: None
  output_dir: ./stage2_nsclean_alternate/
  output_ext: .fits
  output_use_model: False
  output_use_index: True
  save_results: True
  skip: False
  suffix: None
  search_output_file: True
  input_dir: ''
  save_bsub: False
  fail_on_exception: True
  save_wfss_esec: False
  steps:
    assign_wcs:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      sip_approx: True
      sip_max_pix_error: 0.01
      sip_degree: None
      sip_max_inv_pix_error: 0.01
      sip_inv_degree: None
      sip_npoints: 12
      slit_y_low: -0.55
      slit_y_high: 0.55
      nrs_ifu_slice_wcs: False
    badpix_selfcal:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: True
      suffix: None
      search_output_file: True
      input_dir: ''
      flagfrac_lower: 0.001
      flagfrac_upper: 0.001
      kernel_size: 15
      force_single: False
      save_flagged_bkg: False
    msa_flagging:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
    nsclean:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: True
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      fit_method: fft
      fit_by_channel: False
      background_method: None
      background_box_size: None
      mask_spectral_regions: False
      n_sigma: 1
      fit_histogram: False
      single_mask: False
      user_mask: None
      save_mask: True
      save_background: False
      save_noise: False
    bkg_subtract:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      bkg_list: None
      save_combined_background: False
      sigma: 3.0
      maxiters: None
      soss_source_percentile: 35.0
      soss_bkg_percentile: None
      wfss_mmag_extract: None
      wfss_maxiter: 5
      wfss_rms_stop: 0.0
      wfss_outlier_percent: 1.0
    imprint_subtract:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
    extract_2d:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      slit_names: None
      source_ids: None
      extract_orders: None
      grism_objects: None
      tsgrism_extract_height: None
      wfss_extract_half_height: 5
      wfss_mmag_extract: None
      wfss_nbright: 1000
    master_background_mos:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: True
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      sigma_clip: 3.0
      median_kernel: 1
      force_subtract: False
      save_background: False
      user_background: None
      inverse: False
      steps:
        flat_field:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          save_interpolated_flat: False
          user_supplied_flat: None
          inverse: False
        pathloss:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          inverse: False
          source_type: None
          user_slit_loc: None
        barshadow:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          inverse: False
          source_type: None
        photom:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          inverse: False
          source_type: None
          apply_time_correction: True
        pixel_replace:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: True
          output_use_index: True
          save_results: False
          skip: True
          suffix: None
          search_output_file: True
          input_dir: ''
          algorithm: fit_profile
          n_adjacent_cols: 3
        resample_spec:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          pixfrac: 1.0
          kernel: square
          fillval: NaN
          weight_type: exptime
          output_shape: None
          pixel_scale_ratio: 1.0
          pixel_scale: None
          output_wcs: ''
          single: False
          blendheaders: True
          in_memory: True
        extract_1d:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          subtract_background: None
          apply_apcorr: True
          extraction_type: box
          use_source_posn: None
          position_offset: 0.0
          model_nod_pair: True
          optimize_psf_location: True
          smoothing_length: None
          bkg_fit: None
          bkg_order: None
          log_increment: 50
          save_profile: False
          save_scene_model: False
          save_residual_image: False
          center_xy: None
          ifu_autocen: False
          bkg_sigma_clip: 3.0
          ifu_rfcorr: True
          ifu_set_srctype: None
          ifu_rscale: None
          ifu_covar_scale: 1.0
          soss_atoca: True
          soss_threshold: 0.01
          soss_n_os: 2
          soss_wave_grid_in: None
          soss_wave_grid_out: None
          soss_estimate: None
          soss_rtol: 0.0001
          soss_max_grid_size: 20000
          soss_tikfac: None
          soss_width: 40.0
          soss_bad_pix: masking
          soss_modelname: None
          soss_order_3: True
    wavecorr:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
    flat_field:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      save_interpolated_flat: False
      user_supplied_flat: None
      inverse: False
    srctype:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      source_type: None
    straylight:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      clean_showers: False
      shower_plane: 3
      shower_x_stddev: 18.0
      shower_y_stddev: 5.0
      shower_low_reject: 0.1
      shower_high_reject: 99.9
      save_shower_model: False
    fringe:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
    residual_fringe:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: True
      suffix: residual_fringe
      search_output_file: False
      input_dir: ''
      save_intermediate_results: False
      ignore_region_min: None
      ignore_region_max: None
    pathloss:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      inverse: False
      source_type: None
      user_slit_loc: None
    barshadow:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      inverse: False
      source_type: None
    wfss_contam:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: True
      suffix: None
      search_output_file: True
      input_dir: ''
      save_simulated_image: False
      save_contam_images: False
      maximum_cores: none
      orders: None
      magnitude_limit: None
      wl_oversample: 2
      max_pixels_per_chunk: 50000
    photom:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      inverse: False
      source_type: None
      apply_time_correction: True
    pixel_replace:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: True
      output_use_index: True
      save_results: False
      skip: True
      suffix: None
      search_output_file: True
      input_dir: ''
      algorithm: fit_profile
      n_adjacent_cols: 3
    resample_spec:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      pixfrac: 1.0
      kernel: square
      fillval: NaN
      weight_type: exptime
      output_shape: None
      pixel_scale_ratio: 1.0
      pixel_scale: None
      output_wcs: ''
      single: False
      blendheaders: True
      in_memory: True
    cube_build:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: True
      output_use_index: True
      save_results: False
      skip: False
      suffix: s3d
      search_output_file: False
      input_dir: ''
      pipeline: 3
      channel: all
      band: all
      grating: all
      filter: all
      output_type: None
      scalexy: 0.0
      scalew: 0.0
      weighting: drizzle
      coord_system: skyalign
      ra_center: None
      dec_center: None
      cube_pa: None
      nspax_x: None
      nspax_y: None
      rois: 0.0
      roiw: 0.0
      weight_power: 2.0
      wavemin: None
      wavemax: None
      single: False
      skip_dqflagging: False
      offset_file: None
      debug_spaxel: -1 -1 -1
    extract_1d:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      subtract_background: None
      apply_apcorr: True
      extraction_type: box
      use_source_posn: None
      position_offset: 0.0
      model_nod_pair: True
      optimize_psf_location: True
      smoothing_length: None
      bkg_fit: None
      bkg_order: None
      log_increment: 50
      save_profile: False
      save_scene_model: False
      save_residual_image: False
      center_xy: None
      ifu_autocen: False
      bkg_sigma_clip: 3.0
      ifu_rfcorr: True
      ifu_set_srctype: None
      ifu_rscale: None
      ifu_covar_scale: 1.0
      soss_atoca: True
      soss_threshold: 0.01
      soss_n_os: 2
      soss_wave_grid_in: None
      soss_wave_grid_out: None
      soss_estimate: None
      soss_rtol: 0.0001
      soss_max_grid_size: 20000
      soss_tikfac: None
      soss_width: 40.0
      soss_bad_pix: masking
      soss_modelname: None
      soss_order_3: True
2026-03-27 13:48:07,409 - stpipe.pipeline - INFO - Prefetching reference files for dataset: 'jw01335004001_03101_00002_nrs2_rate.fits' reftypes = ['apcorr', 'area', 'barshadow', 'bkg', 'camera', 'collimator', 'cubepar', 'dflat', 'disperser', 'distortion', 'extract1d', 'fflat', 'filteroffset', 'flat', 'fore', 'fpa', 'fringe', 'ifufore', 'ifupost', 'ifuslicer', 'mrsxartcorr', 'msa', 'msaoper', 'ote', 'pastasoss', 'pathloss', 'photom', 'psf', 'regions', 'sflat', 'speckernel', 'specprofile', 'specwcs', 'wavecorr', 'wavelengthrange']
2026-03-27 13:48:07,414 - stpipe.pipeline - INFO - Prefetch for APCORR reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_apcorr_0009.asdf'.
2026-03-27 13:48:07,415 - stpipe.pipeline - INFO - Prefetch for AREA reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_area_0046.fits'.
2026-03-27 13:48:07,416 - stpipe.pipeline - INFO - Prefetch for BARSHADOW reference file is 'N/A'.
2026-03-27 13:48:07,416 - stpipe.pipeline - INFO - Prefetch for BKG reference file is 'N/A'.
2026-03-27 13:48:07,417 - stpipe.pipeline - INFO - Prefetch for CAMERA reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_camera_0008.asdf'.
2026-03-27 13:48:07,418 - stpipe.pipeline - INFO - Prefetch for COLLIMATOR reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_collimator_0008.asdf'.
2026-03-27 13:48:07,418 - stpipe.pipeline - INFO - Prefetch for CUBEPAR reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_cubepar_0009.fits'.
2026-03-27 13:48:07,419 - stpipe.pipeline - INFO - Prefetch for DFLAT reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_dflat_0002.fits'.
2026-03-27 13:48:07,420 - stpipe.pipeline - INFO - Prefetch for DISPERSER reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_disperser_0066.asdf'.
2026-03-27 13:48:07,421 - stpipe.pipeline - INFO - Prefetch for DISTORTION reference file is 'N/A'.
2026-03-27 13:48:07,421 - stpipe.pipeline - INFO - Prefetch for EXTRACT1D reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_extract1d_0002.asdf'.
2026-03-27 13:48:07,422 - stpipe.pipeline - INFO - Prefetch for FFLAT reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fflat_0170.fits'.
2026-03-27 13:48:07,422 - stpipe.pipeline - INFO - Prefetch for FILTEROFFSET reference file is 'N/A'.
2026-03-27 13:48:07,423 - stpipe.pipeline - INFO - Prefetch for FLAT reference file is 'N/A'.
2026-03-27 13:48:07,424 - stpipe.pipeline - INFO - Prefetch for FORE reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fore_0050.asdf'.
2026-03-27 13:48:07,424 - stpipe.pipeline - INFO - Prefetch for FPA reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fpa_0009.asdf'.
2026-03-27 13:48:07,425 - stpipe.pipeline - INFO - Prefetch for FRINGE reference file is 'N/A'.
2026-03-27 13:48:07,425 - stpipe.pipeline - INFO - Prefetch for IFUFORE reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifufore_0013.asdf'.
2026-03-27 13:48:07,426 - stpipe.pipeline - INFO - Prefetch for IFUPOST reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifupost_0014.asdf'.
2026-03-27 13:48:07,427 - stpipe.pipeline - INFO - Prefetch for IFUSLICER reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifuslicer_0012.asdf'.
2026-03-27 13:48:07,428 - stpipe.pipeline - INFO - Prefetch for MRSXARTCORR reference file is 'N/A'.
2026-03-27 13:48:07,428 - stpipe.pipeline - INFO - Prefetch for MSA reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_msa_0009.asdf'.
2026-03-27 13:48:07,429 - stpipe.pipeline - INFO - Prefetch for MSAOPER reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_msaoper_0006.json'.
2026-03-27 13:48:07,429 - stpipe.pipeline - INFO - Prefetch for OTE reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ote_0011.asdf'.
2026-03-27 13:48:07,430 - stpipe.pipeline - INFO - Prefetch for PASTASOSS reference file is 'N/A'.
2026-03-27 13:48:07,430 - stpipe.pipeline - INFO - Prefetch for PATHLOSS reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pathloss_0003.fits'.
2026-03-27 13:48:07,431 - stpipe.pipeline - INFO - Prefetch for PHOTOM reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_photom_0016.fits'.
2026-03-27 13:48:07,432 - stpipe.pipeline - INFO - Prefetch for PSF reference file is 'N/A'.
2026-03-27 13:48:07,432 - stpipe.pipeline - INFO - Prefetch for REGIONS reference file is 'N/A'.
2026-03-27 13:48:07,433 - stpipe.pipeline - INFO - Prefetch for SFLAT reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_sflat_0212.fits'.
2026-03-27 13:48:07,433 - stpipe.pipeline - INFO - Prefetch for SPECKERNEL reference file is 'N/A'.
2026-03-27 13:48:07,435 - stpipe.pipeline - INFO - Prefetch for SPECPROFILE reference file is 'N/A'.
2026-03-27 13:48:07,435 - stpipe.pipeline - INFO - Prefetch for SPECWCS reference file is 'N/A'.
2026-03-27 13:48:07,436 - stpipe.pipeline - INFO - Prefetch for WAVECORR reference file is 'N/A'.
2026-03-27 13:48:07,436 - stpipe.pipeline - INFO - Prefetch for WAVELENGTHRANGE reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_wavelengthrange_0006.asdf'.
2026-03-27 13:48:07,437 - jwst.pipeline.calwebb_spec2 - INFO - Starting calwebb_spec2 ...
2026-03-27 13:48:07,438 - jwst.pipeline.calwebb_spec2 - INFO - Processing product mast_products/jw01335004001_03101_00002_nrs2
2026-03-27 13:48:07,439 - jwst.pipeline.calwebb_spec2 - INFO - Working on input ./mast_products/jw01335004001_03101_00002_nrs2_rate.fits ...
2026-03-27 13:48:07,658 - stpipe.step - INFO - Step assign_wcs running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_rate.fits>,).
2026-03-27 13:48:07,725 - jwst.assign_wcs.nirspec - INFO - gwa_ytilt is 0.133357972 deg
2026-03-27 13:48:07,726 - jwst.assign_wcs.nirspec - INFO - gwa_xtilt is 0.3564805 deg
2026-03-27 13:48:07,727 - jwst.assign_wcs.nirspec - INFO - theta_y correction: 0.0052787810844296245 deg
2026-03-27 13:48:07,728 - jwst.assign_wcs.nirspec - INFO - theta_x correction: 0.00014063512894183975 deg
2026-03-27 13:48:07,803 - jwst.assign_wcs.nirspec - INFO - Applied Barycentric velocity correction : 1.0000997975589527
2026-03-27 13:48:09,418 - jwst.assign_wcs.nirspec - INFO - Created a NIRSPEC nrs_ifu pipeline with references {'distortion': None, 'filteroffset': None, 'specwcs': None, 'regions': None, 'wavelengthrange': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_wavelengthrange_0006.asdf', 'camera': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_camera_0008.asdf', 'collimator': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_collimator_0008.asdf', 'disperser': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_disperser_0066.asdf', 'fore': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fore_0050.asdf', 'fpa': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fpa_0009.asdf', 'msa': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_msa_0009.asdf', 'ote': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ote_0011.asdf', 'ifupost': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifupost_0014.asdf', 'ifufore': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifufore_0013.asdf', 'ifuslicer': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifuslicer_0012.asdf'}
2026-03-27 13:48:15,581 - stcal.alignment.util - INFO - Update S_REGION to POLYGON ICRS  150.546368565 1.617854367 150.547591077 1.617854367 150.547591077 1.618979922 150.546368565 1.618979922
2026-03-27 13:48:20,113 - jwst.assign_wcs.assign_wcs - INFO - COMPLETED assign_wcs
2026-03-27 13:48:20,118 - stpipe.step - INFO - Step assign_wcs done
2026-03-27 13:48:20,440 - stpipe.step - INFO - Step badpix_selfcal running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_rate.fits>, [], []).
2026-03-27 13:48:20,441 - stpipe.step - INFO - Step skipped.
2026-03-27 13:48:20,734 - stpipe.step - INFO - Step msa_flagging running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_rate.fits>,).
2026-03-27 13:48:24,438 - jwst.msaflagopen.msaflagopen_step - INFO - Using reference file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_msaoper_0006.json
2026-03-27 13:48:24,512 - jwst.msaflagopen.msaflag_open - INFO - 24 failed open shutters
2026-03-27 13:48:32,715 - stpipe.step - INFO - Step msa_flagging done
2026-03-27 13:48:33,485 - stpipe.step - INFO - Step nsclean running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_rate.fits>,).
2026-03-27 13:48:33,487 - jwst.nsclean.nsclean_step - WARNING - The 'nsclean' step is a deprecated alias to 'clean_flicker_noise' and will be removed in future builds.
2026-03-27 13:48:33,503 - jwst.clean_flicker_noise.clean_flicker_noise - INFO - Input exposure type is NRS_IFU, detector=NRS2
2026-03-27 13:48:37,657 - jwst.clean_flicker_noise.clean_flicker_noise - INFO - Creating mask
2026-03-27 13:48:38,170 - jwst.clean_flicker_noise.clean_flicker_noise - INFO - Cleaning image jw01335004001_03101_00002_nrs2_rate.fits
2026-03-27 13:48:40,962 - jwst.nsclean.nsclean_step - INFO - Saving mask file ./stage2_nsclean_alternate/jw01335004001_03101_00002_nrs2_mask.fits
2026-03-27 13:48:42,577 - stpipe.step - INFO - Saved model in ./stage2_nsclean_alternate/jw01335004001_03101_00002_nrs2_nsclean.fits
2026-03-27 13:48:42,578 - stpipe.step - INFO - Step nsclean done
2026-03-27 13:48:43,138 - stpipe.step - INFO - Step imprint_subtract running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>, []).
2026-03-27 13:48:43,139 - stpipe.step - INFO - Step skipped.
2026-03-27 13:48:43,508 - stpipe.step - INFO - Step bkg_subtract running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>, []).
2026-03-27 13:48:43,509 - stpipe.step - INFO - Step skipped.
2026-03-27 13:48:43,876 - stpipe.step - INFO - Step srctype running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:48:46,804 - jwst.srctype.srctype - INFO - Input EXP_TYPE is NRS_IFU
2026-03-27 13:48:46,805 - jwst.srctype.srctype - INFO - Input SRCTYAPT = EXTENDED
2026-03-27 13:48:46,805 - jwst.srctype.srctype - INFO - Using input source type = EXTENDED
2026-03-27 13:48:46,807 - stpipe.step - INFO - Step srctype done
2026-03-27 13:48:47,295 - stpipe.step - INFO - Step straylight running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:48:47,296 - stpipe.step - INFO - Step skipped.
2026-03-27 13:48:47,767 - stpipe.step - INFO - Step flat_field running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:48:47,792 - jwst.flatfield.flat_field_step - INFO - No reference found for type FLAT
2026-03-27 13:48:47,855 - jwst.flatfield.flat_field_step - INFO - Using FFLAT reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fflat_0170.fits
2026-03-27 13:48:47,952 - jwst.flatfield.flat_field_step - INFO - Using SFLAT reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_sflat_0212.fits
2026-03-27 13:48:48,093 - jwst.flatfield.flat_field_step - INFO - Using DFLAT reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_dflat_0002.fits
2026-03-27 13:48:58,078 - stpipe.step - INFO - Step flat_field done
2026-03-27 13:48:58,753 - stpipe.step - INFO - Step fringe running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:48:58,754 - stpipe.step - INFO - Step skipped.
2026-03-27 13:48:59,194 - stpipe.step - INFO - Step pathloss running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:48:59,214 - jwst.pathloss.pathloss_step - INFO - Using PATHLOSS reference file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pathloss_0003.fits
2026-03-27 13:48:59,249 - jwst.pathloss.pathloss - INFO - Input exposure type is NRS_IFU
2026-03-27 13:49:05,234 - stpipe.step - INFO - Step pathloss done
2026-03-27 13:49:05,875 - stpipe.step - INFO - Step barshadow running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:49:05,877 - stpipe.step - INFO - Step skipped.
2026-03-27 13:49:06,358 - stpipe.step - INFO - Step photom running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:49:06,380 - jwst.photom.photom_step - INFO - Using photom reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_photom_0016.fits
2026-03-27 13:49:06,381 - jwst.photom.photom_step - INFO - Using area reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_area_0046.fits
2026-03-27 13:49:09,758 - jwst.photom.photom - INFO - Using instrument: NIRSPEC
2026-03-27 13:49:09,759 - jwst.photom.photom - INFO -  detector: NRS2
2026-03-27 13:49:09,759 - jwst.photom.photom - INFO -  exp_type: NRS_IFU
2026-03-27 13:49:09,760 - jwst.photom.photom - INFO -  filter: F100LP
2026-03-27 13:49:09,761 - jwst.photom.photom - INFO -  grating: G140H
2026-03-27 13:49:09,806 - jwst.photom.photom - INFO - PHOTMJSR value: 3.83761e+12
2026-03-27 13:49:11,902 - stpipe.step - INFO - Step photom done
2026-03-27 13:49:12,638 - stpipe.step - INFO - Step residual_fringe running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:49:12,639 - stpipe.step - INFO - Step skipped.
2026-03-27 13:49:16,432 - stpipe.step - INFO - Step pixel_replace running with args (<IFUImageModel(2048, 2048) from ./stage2_nsclean_alternate/jw01335004001_03101_00002_nrs2_cal.fits>,).
2026-03-27 13:49:16,433 - stpipe.step - INFO - Step skipped.
2026-03-27 13:49:16,925 - stpipe.step - INFO - Step cube_build running with args (<IFUImageModel(2048, 2048) from ./stage2_nsclean_alternate/jw01335004001_03101_00002_nrs2_cal.fits>,).
2026-03-27 13:49:16,926 - jwst.cube_build.cube_build_step - INFO - Starting IFU Cube Building Step
2026-03-27 13:49:16,926 - jwst.cube_build.cube_build_step - INFO - Input interpolation: drizzle
2026-03-27 13:49:16,927 - jwst.cube_build.cube_build_step - INFO - Coordinate system to use: skyalign
2026-03-27 13:49:16,944 - jwst.cube_build.cube_build_step - INFO - Setting output type to: band
2026-03-27 13:49:16,968 - jwst.cube_build.cube_build - INFO - Reading cube parameter file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_cubepar_0009.fits
2026-03-27 13:49:17,421 - jwst.cube_build.cube_build - INFO - Output Cubes are single grating, single filter IFU Cubes
2026-03-27 13:49:17,421 - jwst.cube_build.cube_build_step - INFO - Number of IFU cubes produced by this run = 1
2026-03-27 13:49:17,422 - jwst.cube_build.ifu_cube - INFO - Increasing spatial region of interest default value set for 4 dithers nan
2026-03-27 13:49:17,425 - jwst.cube_build.ifu_cube - INFO - Cube Geometry:
2026-03-27 13:49:17,426 - jwst.cube_build.ifu_cube - INFO - axis#  Naxis  CRPIX    CRVAL       CDELT(arcsec)  Min & Max (xi, eta arcsec)
2026-03-27 13:49:17,427 - jwst.cube_build.ifu_cube - INFO - Axis 1    47  24.00 150.54697982   0.10000000  -2.35000004   2.35000004
2026-03-27 13:49:17,428 - jwst.cube_build.ifu_cube - INFO - Axis 2    45  23.00   1.61841714   0.10000000  -2.25000003   2.25000003
2026-03-27 13:49:17,428 - jwst.cube_build.ifu_cube - INFO - axis#  Naxis  CRPIX    CRVAL      CDELT(microns)  Min & Max (microns)
2026-03-27 13:49:17,429 - jwst.cube_build.ifu_cube - INFO - Axis 3  3915   1.00   0.97011753   0.00023500   0.97000003   1.89002503
2026-03-27 13:49:17,430 - jwst.cube_build.ifu_cube - INFO - Cube covers grating, filter: g140h, f100lp
2026-03-27 13:49:17,430 - jwst.cube_build.ifu_cube - INFO - Output Name: ./stage2_nsclean_alternate/jw01335004001_03101_00002_nrs2_s3d.fits
2026-03-27 13:49:20,906 - jwst.cube_build.ifu_cube - INFO - Mapping each NIRSpec slice to sky for input file: ./stage2_nsclean_alternate/jw01335004001_03101_00002_nrs2_cal.fits
2026-03-27 13:49:30,723 - jwst.cube_build.ifu_cube - INFO - # of detector pixels not mapped to output plane: 9178 with wavelength above 1.890381051178193
2026-03-27 13:49:47,218 - jwst.cube_build.ifu_cube - INFO - Average # of holes/wavelength plane is < 1
2026-03-27 13:49:47,218 - jwst.cube_build.ifu_cube - INFO - Total # of holes for IFU cube is : 0
2026-03-27 13:49:47,518 - stcal.alignment.util - INFO - Update S_REGION to POLYGON ICRS  150.546340677 1.617806033 150.546340677 1.619028256 150.547618965 1.619028256 150.547618965 1.617806033
2026-03-27 13:49:47,521 - stpipe.step - INFO - Step cube_build done
2026-03-27 13:49:47,644 - stpipe.step - INFO - Saved model in ./stage2_nsclean_alternate/jw01335004001_03101_00002_nrs2_s3d.fits
2026-03-27 13:49:48,434 - stpipe.step - INFO - Step extract_1d running with args (<jwst.datamodels.container.ModelContainer object at 0x7fc4190935d0>,).
2026-03-27 13:49:48,438 - jwst.extract_1d.extract_1d_step - INFO - Using EXTRACT1D reference file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_extract1d_0002.asdf
2026-03-27 13:49:48,442 - jwst.extract_1d.extract_1d_step - INFO - Using APCORR file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_apcorr_0009.asdf
2026-03-27 13:49:48,445 - jwst.extract_1d.extract_1d_step - INFO - Turning off residual fringe correction because it only works on MIRI MRS data
2026-03-27 13:49:48,445 - jwst.extract_1d.ifu - INFO - Source type = EXTENDED
2026-03-27 13:49:48,635 - jwst.extract_1d.ifu - INFO - Input model does not break out variance information. Passing only generalized errors.
2026-03-27 13:50:02,998 - stpipe.step - INFO - Saved model in ./stage2_nsclean_alternate/jw01335004001_03101_00002_nrs2_x1d.fits
2026-03-27 13:50:02,998 - stpipe.step - INFO - Step extract_1d done
2026-03-27 13:50:02,999 - jwst.pipeline.calwebb_spec2 - INFO - Finished processing product mast_products/jw01335004001_03101_00002_nrs2
2026-03-27 13:50:03,001 - jwst.pipeline.calwebb_spec2 - INFO - Ending calwebb_spec2
2026-03-27 13:50:03,001 - jwst.stpipe.core - INFO - Results used CRDS context: jwst_1464.pmap
2026-03-27 13:50:04,668 - stpipe.step - INFO - Saved model in ./stage2_nsclean_alternate/jw01335004001_03101_00002_nrs2_cal.fits
2026-03-27 13:50:04,669 - stpipe.step - INFO - Step Spec2Pipeline done
2026-03-27 13:50:04,670 - jwst.stpipe.core - INFO - Results used jwst version: 1.20.2
Saved jw01335004001_03101_00002_nrs2_mask.fits
Saved jw01335004001_03101_00002_nrs2_nsclean.fits
Saved jw01335004001_03101_00002_nrs2_cal.fits
Saved jw01335004001_03101_00002_nrs2_x1d.fits
Run time:  4.015  min

6.1 Verify the Mask (Alternate Mask) #


Check the mask against the rate data to make sure it keeps only dark areas of the detector.

# Plot the rate data with masked areas blocked.

# List of on-the-fly built masks from the pipeline.
nsclean_alternate_masks = [
    stage2_nsclean_alternate_dir + "jw01335004001_03101_00002_nrs1_mask.fits",
    stage2_nsclean_alternate_dir + "jw01335004001_03101_00002_nrs2_mask.fits",
]

# Plot each associated set of rateint data and mask file.
for rate_file, mask_file in zip(rate_names, nsclean_alternate_masks):
    plot_dark_data(mast_products_dir + rate_file, mask_file, layout="columns", scale=9)
../../../_images/1f702ce81b84fb1275592d061f89a972049c72d999256b84bf2e66bbbe0e93bd.png ../../../_images/c600bf1bdf0eb0644027ae91d7b740a030f1bb4fdad6988dcbd90fbbdddb3081.png

6.2 Comparing Original vs. Cleaned Data (Alternate Mask) #


# Plot the original and cleaned data, as well as a residual map.

cleaned_alternate_masks = [
    stage2_nsclean_alternate_dir + "jw01335004001_03101_00002_nrs1_nsclean.fits",
    stage2_nsclean_alternate_dir + "jw01335004001_03101_00002_nrs2_nsclean.fits",
]

# Plot each associated set of rateint data and cleaned file.
for rate_file, cleaned_file in zip(rate_names, cleaned_alternate_masks):
    plot_cleaned_data(
        mast_products_dir + rate_file, cleaned_file, layout="columns", scale=9
    )
../../../_images/c0da28f79c63ac8758f3e6e8651e7b6971bd9e1169670c390c5bcdb32752e917.png ../../../_images/a910c333570532372b40ba6a035a52520b4342055939d59355ad0da142b00896.png

Compare the extracted spectrum from the cleaned data to the spectrum extracted from the original rate file.

x1d_nsclean_alternate = [
    stage2_nsclean_alternate_dir + "jw01335004001_03101_00002_nrs1_x1d.fits",
    stage2_nsclean_alternate_dir + "jw01335004001_03101_00002_nrs2_x1d.fits",
]

# Wavelength region of interest.
wavelength_range = {"nrs1": [1.15, 1.25], "nrs2": [1.65, 1.75]}
for original, cleaned in zip(x1d_nsclean_skipped, x1d_nsclean_alternate):
    plot_spectra(
        [original, cleaned], scale_percent=4, wavelength_range=wavelength_range
    )
../../../_images/ed4dac4793006bfe7b76a46571d4d714bbd556dc2650a619efc2419a9390dc38.png ../../../_images/b77ab75892234257fdc8a756d26ced8e636eccd25add512f2eae4842f9439f83.png

Notes:

  • The overall continuum level for the spectrum on NRS1 has changed after cleaning. This is because sigma-clipping, unlike the default method, only masks the bright outliers, rather than the entire science region. Consequently, some sky regions are included in the background model that gets subtracted from the data, which can result in changes to the continuum level.

  • The portion of the spectrum near 1.7um for NRS2, the excess flux due to 1/f noise is reduced.

  • There are several spikes in the difference between the cleaned and original spectra. These correspond to the scattered artifacts introduced by the cleaning process, above.

7. Clean up 1/f Noise with NSClean (Hand-Modified Mask) #


In certain scenarios, manual generation of a mask may be required. Here, we present one approach to manually modify the mask (excluding some large snowballs in NRS1/NRS2) starting with the default mask output from the pipeline. It is worth noting that the mask modified using this method may not necessarily outperform the two previous options.

# Set up directory for running NSClean with user-supplied mask.
stage2_nsclean_modified_dir = "./stage2_nsclean_modified/"
if not os.path.exists(stage2_nsclean_modified_dir):
    # Create the directory if it doesn't exist.
    os.makedirs(stage2_nsclean_modified_dir)
# Hand-modify certain mask regions
# Snowballs in NRS1/2.

# Define the list to store paths of modified masks.
nsclean_modified_masks = []

# Iterate through the list of original masks.
for mask in nsclean_default_masks:
    # New mask file name.
    output_file = os.path.basename(mask)[:-5] + "_modified.fits"

    # Open the FITS file.
    with fits.open(mask) as hdul:
        # Extract the mask data from the science extension.
        mask_data = hdul["SCI"].data.copy()  # Make a copy.

        if "nrs1" in mask:
            # Mask Snowballs.
            mask_data[10:50, 180:215] = False
            mask_data[560:580, 450:465] = False
            mask_data[1720:1810, 1150:1240] = False
            mask_data[1540:1580, 535:580] = False
            mask_data[1865:1910, 725:770] = False
        else:
            mask_data[200:250, 130:190] = False
            mask_data[1400:1420, 40:80] = False
            mask_data[1700:1730, 150:180] = False
            mask_data[630:710, 1100:1170] = False
            mask_data[520:570, 1770:1820] = False

        # Update the data within the science extension.
        hdul["SCI"].data = mask_data
        # Save the modified FITS file.
        output_path = os.path.join(stage2_nsclean_modified_dir, output_file)
        hdul_modified = hdul.copy()  # Make a copy.
        hdul_modified.writeto(output_path, overwrite=True)
        nsclean_modified_masks.append(output_path)
        print(f"Saved modified mask as: {output_path}")
Saved modified mask as: ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs1_mask_modified.fits
Saved modified mask as: ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs2_mask_modified.fits

7.1 Verify the Mask (Hand-Modified Mask) #


Check the mask against the rate data to make sure it keeps only dark areas of the detector.

# Plot the rate data with masked areas blocked.

# List of modified masks for the pipeline.
nsclean_modified_masks = [
    stage2_nsclean_modified_dir + "jw01335004001_03101_00002_nrs1_mask_modified.fits",
    stage2_nsclean_modified_dir + "jw01335004001_03101_00002_nrs2_mask_modified.fits",
]

# Plot each associated set of rateint data and mask file.
for rate_file, mask_file in zip(rate_names, nsclean_modified_masks):
    plot_dark_data(mast_products_dir + rate_file, mask_file, layout="columns", scale=9)
../../../_images/675a2d80134210c108ebded4133620b6efbb10471b92a71d4f466d1a38f46812.png ../../../_images/74660d7e9346012e8630d3f1844247470501b01a3d5ff8aa31914487386a75f1.png

# 1/f noise cleaned data (user-supplied mask).
# Estimated run time: 87 minutes (may vary).
start = tt.time()

for indx, i in enumerate(rate_names):
    print(f"Processing {i}... ")

    Spec2Pipeline.call(
        mast_products_dir + i,
        save_results=True,
        steps={
            "nsclean": {
                "skip": False,
                "save_mask": True,
                "save_results": True,
                "user_mask": nsclean_modified_masks[indx],
            },  # Removes correlated read noise (1/f noise) from NIRSpec images.
        },
        output_dir=stage2_nsclean_modified_dir,
    )

    print(f"Saved {i[:-9]}" + "mask.fits")
    print(f"Saved {i[:-9]}" + "nsclean.fits")
    print(f"Saved {i[:-9]}" + "cal.fits")
    print(f"Saved {i[:-9]}" + "x1d.fits")


end = tt.time()
print("Run time: ", round(end - start, 1) / 60.0, " min")
2026-03-27 13:50:22,058 - stpipe.step - INFO - PARS-RESAMPLESPECSTEP parameters found: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pars-resamplespecstep_0001.asdf
2026-03-27 13:50:22,076 - stpipe.step - INFO - PARS-RESAMPLESPECSTEP parameters found: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pars-resamplespecstep_0001.asdf
2026-03-27 13:50:22,101 - stpipe.step - INFO - Spec2Pipeline instance created.
2026-03-27 13:50:22,102 - stpipe.step - INFO - AssignWcsStep instance created.
2026-03-27 13:50:22,103 - stpipe.step - INFO - BadpixSelfcalStep instance created.
2026-03-27 13:50:22,104 - stpipe.step - INFO - MSAFlagOpenStep instance created.
2026-03-27 13:50:22,105 - stpipe.step - INFO - NSCleanStep instance created.
2026-03-27 13:50:22,106 - stpipe.step - INFO - BackgroundStep instance created.
2026-03-27 13:50:22,107 - stpipe.step - INFO - ImprintStep instance created.
2026-03-27 13:50:22,108 - stpipe.step - INFO - Extract2dStep instance created.
2026-03-27 13:50:22,112 - stpipe.step - INFO - MasterBackgroundMosStep instance created.
2026-03-27 13:50:22,113 - stpipe.step - INFO - FlatFieldStep instance created.
2026-03-27 13:50:22,114 - stpipe.step - INFO - PathLossStep instance created.
2026-03-27 13:50:22,115 - stpipe.step - INFO - BarShadowStep instance created.
2026-03-27 13:50:22,116 - stpipe.step - INFO - PhotomStep instance created.
2026-03-27 13:50:22,117 - stpipe.step - INFO - PixelReplaceStep instance created.
2026-03-27 13:50:22,118 - stpipe.step - INFO - ResampleSpecStep instance created.
2026-03-27 13:50:22,120 - stpipe.step - INFO - Extract1dStep instance created.
2026-03-27 13:50:22,121 - stpipe.step - INFO - WavecorrStep instance created.
2026-03-27 13:50:22,122 - stpipe.step - INFO - FlatFieldStep instance created.
2026-03-27 13:50:22,124 - stpipe.step - INFO - SourceTypeStep instance created.
2026-03-27 13:50:22,124 - stpipe.step - INFO - StraylightStep instance created.
2026-03-27 13:50:22,125 - stpipe.step - INFO - FringeStep instance created.
2026-03-27 13:50:22,126 - stpipe.step - INFO - ResidualFringeStep instance created.
2026-03-27 13:50:22,127 - stpipe.step - INFO - PathLossStep instance created.
2026-03-27 13:50:22,129 - stpipe.step - INFO - BarShadowStep instance created.
2026-03-27 13:50:22,130 - stpipe.step - INFO - WfssContamStep instance created.
2026-03-27 13:50:22,131 - stpipe.step - INFO - PhotomStep instance created.
2026-03-27 13:50:22,132 - stpipe.step - INFO - PixelReplaceStep instance created.
2026-03-27 13:50:22,133 - stpipe.step - INFO - ResampleSpecStep instance created.
2026-03-27 13:50:22,135 - stpipe.step - INFO - CubeBuildStep instance created.
2026-03-27 13:50:22,136 - stpipe.step - INFO - Extract1dStep instance created.
Processing jw01335004001_03101_00002_nrs1_rate.fits... 
2026-03-27 13:50:22,318 - stpipe.step - INFO - Step Spec2Pipeline running with args ('./mast_products/jw01335004001_03101_00002_nrs1_rate.fits',).
2026-03-27 13:50:22,351 - stpipe.step - INFO - Step Spec2Pipeline parameters are:
  pre_hooks: []
  post_hooks: []
  output_file: None
  output_dir: ./stage2_nsclean_modified/
  output_ext: .fits
  output_use_model: False
  output_use_index: True
  save_results: True
  skip: False
  suffix: None
  search_output_file: True
  input_dir: ''
  save_bsub: False
  fail_on_exception: True
  save_wfss_esec: False
  steps:
    assign_wcs:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      sip_approx: True
      sip_max_pix_error: 0.01
      sip_degree: None
      sip_max_inv_pix_error: 0.01
      sip_inv_degree: None
      sip_npoints: 12
      slit_y_low: -0.55
      slit_y_high: 0.55
      nrs_ifu_slice_wcs: False
    badpix_selfcal:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: True
      suffix: None
      search_output_file: True
      input_dir: ''
      flagfrac_lower: 0.001
      flagfrac_upper: 0.001
      kernel_size: 15
      force_single: False
      save_flagged_bkg: False
    msa_flagging:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
    nsclean:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: True
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      fit_method: fft
      fit_by_channel: False
      background_method: None
      background_box_size: None
      mask_spectral_regions: True
      n_sigma: 5.0
      fit_histogram: False
      single_mask: False
      user_mask: ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs1_mask_modified.fits
      save_mask: True
      save_background: False
      save_noise: False
    bkg_subtract:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      bkg_list: None
      save_combined_background: False
      sigma: 3.0
      maxiters: None
      soss_source_percentile: 35.0
      soss_bkg_percentile: None
      wfss_mmag_extract: None
      wfss_maxiter: 5
      wfss_rms_stop: 0.0
      wfss_outlier_percent: 1.0
    imprint_subtract:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
    extract_2d:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      slit_names: None
      source_ids: None
      extract_orders: None
      grism_objects: None
      tsgrism_extract_height: None
      wfss_extract_half_height: 5
      wfss_mmag_extract: None
      wfss_nbright: 1000
    master_background_mos:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: True
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      sigma_clip: 3.0
      median_kernel: 1
      force_subtract: False
      save_background: False
      user_background: None
      inverse: False
      steps:
        flat_field:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          save_interpolated_flat: False
          user_supplied_flat: None
          inverse: False
        pathloss:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          inverse: False
          source_type: None
          user_slit_loc: None
        barshadow:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          inverse: False
          source_type: None
        photom:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          inverse: False
          source_type: None
          apply_time_correction: True
        pixel_replace:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: True
          output_use_index: True
          save_results: False
          skip: True
          suffix: None
          search_output_file: True
          input_dir: ''
          algorithm: fit_profile
          n_adjacent_cols: 3
        resample_spec:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          pixfrac: 1.0
          kernel: square
          fillval: NaN
          weight_type: exptime
          output_shape: None
          pixel_scale_ratio: 1.0
          pixel_scale: None
          output_wcs: ''
          single: False
          blendheaders: True
          in_memory: True
        extract_1d:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          subtract_background: None
          apply_apcorr: True
          extraction_type: box
          use_source_posn: None
          position_offset: 0.0
          model_nod_pair: True
          optimize_psf_location: True
          smoothing_length: None
          bkg_fit: None
          bkg_order: None
          log_increment: 50
          save_profile: False
          save_scene_model: False
          save_residual_image: False
          center_xy: None
          ifu_autocen: False
          bkg_sigma_clip: 3.0
          ifu_rfcorr: True
          ifu_set_srctype: None
          ifu_rscale: None
          ifu_covar_scale: 1.0
          soss_atoca: True
          soss_threshold: 0.01
          soss_n_os: 2
          soss_wave_grid_in: None
          soss_wave_grid_out: None
          soss_estimate: None
          soss_rtol: 0.0001
          soss_max_grid_size: 20000
          soss_tikfac: None
          soss_width: 40.0
          soss_bad_pix: masking
          soss_modelname: None
          soss_order_3: True
    wavecorr:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
    flat_field:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      save_interpolated_flat: False
      user_supplied_flat: None
      inverse: False
    srctype:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      source_type: None
    straylight:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      clean_showers: False
      shower_plane: 3
      shower_x_stddev: 18.0
      shower_y_stddev: 5.0
      shower_low_reject: 0.1
      shower_high_reject: 99.9
      save_shower_model: False
    fringe:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
    residual_fringe:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: True
      suffix: residual_fringe
      search_output_file: False
      input_dir: ''
      save_intermediate_results: False
      ignore_region_min: None
      ignore_region_max: None
    pathloss:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      inverse: False
      source_type: None
      user_slit_loc: None
    barshadow:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      inverse: False
      source_type: None
    wfss_contam:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: True
      suffix: None
      search_output_file: True
      input_dir: ''
      save_simulated_image: False
      save_contam_images: False
      maximum_cores: none
      orders: None
      magnitude_limit: None
      wl_oversample: 2
      max_pixels_per_chunk: 50000
    photom:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      inverse: False
      source_type: None
      apply_time_correction: True
    pixel_replace:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: True
      output_use_index: True
      save_results: False
      skip: True
      suffix: None
      search_output_file: True
      input_dir: ''
      algorithm: fit_profile
      n_adjacent_cols: 3
    resample_spec:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      pixfrac: 1.0
      kernel: square
      fillval: NaN
      weight_type: exptime
      output_shape: None
      pixel_scale_ratio: 1.0
      pixel_scale: None
      output_wcs: ''
      single: False
      blendheaders: True
      in_memory: True
    cube_build:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: True
      output_use_index: True
      save_results: False
      skip: False
      suffix: s3d
      search_output_file: False
      input_dir: ''
      pipeline: 3
      channel: all
      band: all
      grating: all
      filter: all
      output_type: None
      scalexy: 0.0
      scalew: 0.0
      weighting: drizzle
      coord_system: skyalign
      ra_center: None
      dec_center: None
      cube_pa: None
      nspax_x: None
      nspax_y: None
      rois: 0.0
      roiw: 0.0
      weight_power: 2.0
      wavemin: None
      wavemax: None
      single: False
      skip_dqflagging: False
      offset_file: None
      debug_spaxel: -1 -1 -1
    extract_1d:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      subtract_background: None
      apply_apcorr: True
      extraction_type: box
      use_source_posn: None
      position_offset: 0.0
      model_nod_pair: True
      optimize_psf_location: True
      smoothing_length: None
      bkg_fit: None
      bkg_order: None
      log_increment: 50
      save_profile: False
      save_scene_model: False
      save_residual_image: False
      center_xy: None
      ifu_autocen: False
      bkg_sigma_clip: 3.0
      ifu_rfcorr: True
      ifu_set_srctype: None
      ifu_rscale: None
      ifu_covar_scale: 1.0
      soss_atoca: True
      soss_threshold: 0.01
      soss_n_os: 2
      soss_wave_grid_in: None
      soss_wave_grid_out: None
      soss_estimate: None
      soss_rtol: 0.0001
      soss_max_grid_size: 20000
      soss_tikfac: None
      soss_width: 40.0
      soss_bad_pix: masking
      soss_modelname: None
      soss_order_3: True
2026-03-27 13:50:22,385 - stpipe.pipeline - INFO - Prefetching reference files for dataset: 'jw01335004001_03101_00002_nrs1_rate.fits' reftypes = ['apcorr', 'area', 'barshadow', 'bkg', 'camera', 'collimator', 'cubepar', 'dflat', 'disperser', 'distortion', 'extract1d', 'fflat', 'filteroffset', 'flat', 'fore', 'fpa', 'fringe', 'ifufore', 'ifupost', 'ifuslicer', 'mrsxartcorr', 'msa', 'msaoper', 'ote', 'pastasoss', 'pathloss', 'photom', 'psf', 'regions', 'sflat', 'speckernel', 'specprofile', 'specwcs', 'wavecorr', 'wavelengthrange']
2026-03-27 13:50:22,391 - stpipe.pipeline - INFO - Prefetch for APCORR reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_apcorr_0009.asdf'.
2026-03-27 13:50:22,391 - stpipe.pipeline - INFO - Prefetch for AREA reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_area_0046.fits'.
2026-03-27 13:50:22,392 - stpipe.pipeline - INFO - Prefetch for BARSHADOW reference file is 'N/A'.
2026-03-27 13:50:22,392 - stpipe.pipeline - INFO - Prefetch for BKG reference file is 'N/A'.
2026-03-27 13:50:22,393 - stpipe.pipeline - INFO - Prefetch for CAMERA reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_camera_0008.asdf'.
2026-03-27 13:50:22,393 - stpipe.pipeline - INFO - Prefetch for COLLIMATOR reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_collimator_0008.asdf'.
2026-03-27 13:50:22,394 - stpipe.pipeline - INFO - Prefetch for CUBEPAR reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_cubepar_0009.fits'.
2026-03-27 13:50:22,395 - stpipe.pipeline - INFO - Prefetch for DFLAT reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_dflat_0001.fits'.
2026-03-27 13:50:22,396 - stpipe.pipeline - INFO - Prefetch for DISPERSER reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_disperser_0066.asdf'.
2026-03-27 13:50:22,397 - stpipe.pipeline - INFO - Prefetch for DISTORTION reference file is 'N/A'.
2026-03-27 13:50:22,397 - stpipe.pipeline - INFO - Prefetch for EXTRACT1D reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_extract1d_0002.asdf'.
2026-03-27 13:50:22,398 - stpipe.pipeline - INFO - Prefetch for FFLAT reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fflat_0170.fits'.
2026-03-27 13:50:22,399 - stpipe.pipeline - INFO - Prefetch for FILTEROFFSET reference file is 'N/A'.
2026-03-27 13:50:22,399 - stpipe.pipeline - INFO - Prefetch for FLAT reference file is 'N/A'.
2026-03-27 13:50:22,400 - stpipe.pipeline - INFO - Prefetch for FORE reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fore_0050.asdf'.
2026-03-27 13:50:22,401 - stpipe.pipeline - INFO - Prefetch for FPA reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fpa_0009.asdf'.
2026-03-27 13:50:22,401 - stpipe.pipeline - INFO - Prefetch for FRINGE reference file is 'N/A'.
2026-03-27 13:50:22,402 - stpipe.pipeline - INFO - Prefetch for IFUFORE reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifufore_0013.asdf'.
2026-03-27 13:50:22,402 - stpipe.pipeline - INFO - Prefetch for IFUPOST reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifupost_0014.asdf'.
2026-03-27 13:50:22,403 - stpipe.pipeline - INFO - Prefetch for IFUSLICER reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifuslicer_0012.asdf'.
2026-03-27 13:50:22,404 - stpipe.pipeline - INFO - Prefetch for MRSXARTCORR reference file is 'N/A'.
2026-03-27 13:50:22,404 - stpipe.pipeline - INFO - Prefetch for MSA reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_msa_0009.asdf'.
2026-03-27 13:50:22,405 - stpipe.pipeline - INFO - Prefetch for MSAOPER reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_msaoper_0006.json'.
2026-03-27 13:50:22,405 - stpipe.pipeline - INFO - Prefetch for OTE reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ote_0011.asdf'.
2026-03-27 13:50:22,406 - stpipe.pipeline - INFO - Prefetch for PASTASOSS reference file is 'N/A'.
2026-03-27 13:50:22,406 - stpipe.pipeline - INFO - Prefetch for PATHLOSS reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pathloss_0003.fits'.
2026-03-27 13:50:22,408 - stpipe.pipeline - INFO - Prefetch for PHOTOM reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_photom_0016.fits'.
2026-03-27 13:50:22,408 - stpipe.pipeline - INFO - Prefetch for PSF reference file is 'N/A'.
2026-03-27 13:50:22,409 - stpipe.pipeline - INFO - Prefetch for REGIONS reference file is 'N/A'.
2026-03-27 13:50:22,410 - stpipe.pipeline - INFO - Prefetch for SFLAT reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_sflat_0216.fits'.
2026-03-27 13:50:22,410 - stpipe.pipeline - INFO - Prefetch for SPECKERNEL reference file is 'N/A'.
2026-03-27 13:50:22,411 - stpipe.pipeline - INFO - Prefetch for SPECPROFILE reference file is 'N/A'.
2026-03-27 13:50:22,411 - stpipe.pipeline - INFO - Prefetch for SPECWCS reference file is 'N/A'.
2026-03-27 13:50:22,412 - stpipe.pipeline - INFO - Prefetch for WAVECORR reference file is 'N/A'.
2026-03-27 13:50:22,413 - stpipe.pipeline - INFO - Prefetch for WAVELENGTHRANGE reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_wavelengthrange_0006.asdf'.
2026-03-27 13:50:22,413 - jwst.pipeline.calwebb_spec2 - INFO - Starting calwebb_spec2 ...
2026-03-27 13:50:22,414 - jwst.pipeline.calwebb_spec2 - INFO - Processing product mast_products/jw01335004001_03101_00002_nrs1
2026-03-27 13:50:22,415 - jwst.pipeline.calwebb_spec2 - INFO - Working on input ./mast_products/jw01335004001_03101_00002_nrs1_rate.fits ...
2026-03-27 13:50:22,635 - stpipe.step - INFO - Step assign_wcs running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_rate.fits>,).
2026-03-27 13:50:22,701 - jwst.assign_wcs.nirspec - INFO - gwa_ytilt is 0.133357972 deg
2026-03-27 13:50:22,702 - jwst.assign_wcs.nirspec - INFO - gwa_xtilt is 0.3564805 deg
2026-03-27 13:50:22,703 - jwst.assign_wcs.nirspec - INFO - theta_y correction: 0.0052787810844296245 deg
2026-03-27 13:50:22,704 - jwst.assign_wcs.nirspec - INFO - theta_x correction: 0.00014063512894183975 deg
2026-03-27 13:50:22,779 - jwst.assign_wcs.nirspec - INFO - Applied Barycentric velocity correction : 1.0000997969250545
2026-03-27 13:50:24,405 - jwst.assign_wcs.nirspec - INFO - Created a NIRSPEC nrs_ifu pipeline with references {'distortion': None, 'filteroffset': None, 'specwcs': None, 'regions': None, 'wavelengthrange': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_wavelengthrange_0006.asdf', 'camera': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_camera_0008.asdf', 'collimator': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_collimator_0008.asdf', 'disperser': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_disperser_0066.asdf', 'fore': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fore_0050.asdf', 'fpa': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fpa_0009.asdf', 'msa': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_msa_0009.asdf', 'ote': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ote_0011.asdf', 'ifupost': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifupost_0014.asdf', 'ifufore': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifufore_0013.asdf', 'ifuslicer': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifuslicer_0012.asdf'}
2026-03-27 13:50:31,297 - stcal.alignment.util - INFO - Update S_REGION to POLYGON ICRS  150.546368583 1.617854363 150.547591073 1.617854363 150.547591073 1.618979925 150.546368583 1.618979925
2026-03-27 13:50:36,500 - jwst.assign_wcs.assign_wcs - INFO - COMPLETED assign_wcs
2026-03-27 13:50:36,505 - stpipe.step - INFO - Step assign_wcs done
2026-03-27 13:50:36,844 - stpipe.step - INFO - Step badpix_selfcal running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_rate.fits>, [], []).
2026-03-27 13:50:36,845 - stpipe.step - INFO - Step skipped.
2026-03-27 13:50:37,155 - stpipe.step - INFO - Step msa_flagging running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_rate.fits>,).
2026-03-27 13:50:41,068 - jwst.msaflagopen.msaflagopen_step - INFO - Using reference file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_msaoper_0006.json
2026-03-27 13:50:41,150 - jwst.msaflagopen.msaflag_open - INFO - 24 failed open shutters
2026-03-27 13:50:48,336 - stpipe.step - INFO - Step msa_flagging done
2026-03-27 13:50:49,101 - stpipe.step - INFO - Step nsclean running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_rate.fits>,).
2026-03-27 13:50:49,102 - jwst.nsclean.nsclean_step - WARNING - The 'nsclean' step is a deprecated alias to 'clean_flicker_noise' and will be removed in future builds.
2026-03-27 13:50:49,118 - jwst.clean_flicker_noise.clean_flicker_noise - INFO - Input exposure type is NRS_IFU, detector=NRS1
2026-03-27 13:50:53,173 - jwst.clean_flicker_noise.clean_flicker_noise - INFO - Cleaning image jw01335004001_03101_00002_nrs1_rate.fits
2026-03-27 13:50:55,013 - jwst.nsclean.nsclean_step - INFO - Saving mask file ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs1_mask.fits
2026-03-27 13:50:56,640 - stpipe.step - INFO - Saved model in ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs1_nsclean.fits
2026-03-27 13:50:56,641 - stpipe.step - INFO - Step nsclean done
2026-03-27 13:50:57,253 - stpipe.step - INFO - Step imprint_subtract running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>, []).
2026-03-27 13:50:57,254 - stpipe.step - INFO - Step skipped.
2026-03-27 13:50:57,642 - stpipe.step - INFO - Step bkg_subtract running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>, []).
2026-03-27 13:50:57,643 - stpipe.step - INFO - Step skipped.
2026-03-27 13:50:58,032 - stpipe.step - INFO - Step srctype running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:51:01,106 - jwst.srctype.srctype - INFO - Input EXP_TYPE is NRS_IFU
2026-03-27 13:51:01,107 - jwst.srctype.srctype - INFO - Input SRCTYAPT = EXTENDED
2026-03-27 13:51:01,108 - jwst.srctype.srctype - INFO - Using input source type = EXTENDED
2026-03-27 13:51:01,110 - stpipe.step - INFO - Step srctype done
2026-03-27 13:51:01,662 - stpipe.step - INFO - Step straylight running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:51:01,664 - stpipe.step - INFO - Step skipped.
2026-03-27 13:51:02,213 - stpipe.step - INFO - Step flat_field running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:51:02,239 - jwst.flatfield.flat_field_step - INFO - No reference found for type FLAT
2026-03-27 13:51:02,306 - jwst.flatfield.flat_field_step - INFO - Using FFLAT reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fflat_0170.fits
2026-03-27 13:51:02,406 - jwst.flatfield.flat_field_step - INFO - Using SFLAT reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_sflat_0216.fits
2026-03-27 13:51:02,600 - jwst.flatfield.flat_field_step - INFO - Using DFLAT reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_dflat_0001.fits
2026-03-27 13:51:13,837 - stpipe.step - INFO - Step flat_field done
2026-03-27 13:51:14,659 - stpipe.step - INFO - Step fringe running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:51:14,660 - stpipe.step - INFO - Step skipped.
2026-03-27 13:51:15,174 - stpipe.step - INFO - Step pathloss running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:51:15,195 - jwst.pathloss.pathloss_step - INFO - Using PATHLOSS reference file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pathloss_0003.fits
2026-03-27 13:51:15,232 - jwst.pathloss.pathloss - INFO - Input exposure type is NRS_IFU
2026-03-27 13:51:21,612 - stpipe.step - INFO - Step pathloss done
2026-03-27 13:51:22,345 - stpipe.step - INFO - Step barshadow running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:51:22,347 - stpipe.step - INFO - Step skipped.
2026-03-27 13:51:22,866 - stpipe.step - INFO - Step photom running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:51:22,888 - jwst.photom.photom_step - INFO - Using photom reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_photom_0016.fits
2026-03-27 13:51:22,889 - jwst.photom.photom_step - INFO - Using area reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_area_0046.fits
2026-03-27 13:51:26,304 - jwst.photom.photom - INFO - Using instrument: NIRSPEC
2026-03-27 13:51:26,305 - jwst.photom.photom - INFO -  detector: NRS1
2026-03-27 13:51:26,305 - jwst.photom.photom - INFO -  exp_type: NRS_IFU
2026-03-27 13:51:26,306 - jwst.photom.photom - INFO -  filter: F100LP
2026-03-27 13:51:26,307 - jwst.photom.photom - INFO -  grating: G140H
2026-03-27 13:51:26,353 - jwst.photom.photom - INFO - PHOTMJSR value: 3.83761e+12
2026-03-27 13:51:29,096 - stpipe.step - INFO - Step photom done
2026-03-27 13:51:29,800 - stpipe.step - INFO - Step residual_fringe running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs1_nsclean.fits>,).
2026-03-27 13:51:29,802 - stpipe.step - INFO - Step skipped.
2026-03-27 13:51:33,688 - stpipe.step - INFO - Step pixel_replace running with args (<IFUImageModel(2048, 2048) from ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs1_cal.fits>,).
2026-03-27 13:51:33,689 - stpipe.step - INFO - Step skipped.
2026-03-27 13:51:34,225 - stpipe.step - INFO - Step cube_build running with args (<IFUImageModel(2048, 2048) from ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs1_cal.fits>,).
2026-03-27 13:51:34,226 - jwst.cube_build.cube_build_step - INFO - Starting IFU Cube Building Step
2026-03-27 13:51:34,226 - jwst.cube_build.cube_build_step - INFO - Input interpolation: drizzle
2026-03-27 13:51:34,227 - jwst.cube_build.cube_build_step - INFO - Coordinate system to use: skyalign
2026-03-27 13:51:34,243 - jwst.cube_build.cube_build_step - INFO - Setting output type to: band
2026-03-27 13:51:34,269 - jwst.cube_build.cube_build - INFO - Reading cube parameter file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_cubepar_0009.fits
2026-03-27 13:51:34,717 - jwst.cube_build.cube_build - INFO - Output Cubes are single grating, single filter IFU Cubes
2026-03-27 13:51:34,718 - jwst.cube_build.cube_build_step - INFO - Number of IFU cubes produced by this run = 1
2026-03-27 13:51:34,719 - jwst.cube_build.ifu_cube - INFO - Increasing spatial region of interest default value set for 4 dithers nan
2026-03-27 13:51:34,722 - jwst.cube_build.ifu_cube - INFO - Cube Geometry:
2026-03-27 13:51:34,723 - jwst.cube_build.ifu_cube - INFO - axis#  Naxis  CRPIX    CRVAL       CDELT(arcsec)  Min & Max (xi, eta arcsec)
2026-03-27 13:51:34,723 - jwst.cube_build.ifu_cube - INFO - Axis 1    47  24.00 150.54697983   0.10000000  -2.35000004   2.35000004
2026-03-27 13:51:34,724 - jwst.cube_build.ifu_cube - INFO - Axis 2    45  23.00   1.61841714   0.10000000  -2.25000003   2.25000003
2026-03-27 13:51:34,725 - jwst.cube_build.ifu_cube - INFO - axis#  Naxis  CRPIX    CRVAL      CDELT(microns)  Min & Max (microns)
2026-03-27 13:51:34,726 - jwst.cube_build.ifu_cube - INFO - Axis 3  3915   1.00   0.97011753   0.00023500   0.97000003   1.89002503
2026-03-27 13:51:34,726 - jwst.cube_build.ifu_cube - INFO - Cube covers grating, filter: g140h, f100lp
2026-03-27 13:51:34,727 - jwst.cube_build.ifu_cube - INFO - Output Name: ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs1_s3d.fits
2026-03-27 13:51:38,339 - jwst.cube_build.ifu_cube - INFO - Mapping each NIRSpec slice to sky for input file: ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs1_cal.fits
2026-03-27 13:51:48,842 - jwst.cube_build.ifu_cube - INFO - # of detector pixels not mapped to output plane: 11068 with wavelength below 0.9696408152516496
2026-03-27 13:52:06,344 - jwst.cube_build.ifu_cube - INFO - Average # of holes/wavelength plane is < 1
2026-03-27 13:52:06,345 - jwst.cube_build.ifu_cube - INFO - Total # of holes for IFU cube is : 0
2026-03-27 13:52:06,646 - stcal.alignment.util - INFO - Update S_REGION to POLYGON ICRS  150.546340684 1.617806033 150.546340684 1.619028255 150.547618972 1.619028255 150.547618972 1.617806033
2026-03-27 13:52:06,649 - stpipe.step - INFO - Step cube_build done
2026-03-27 13:52:06,772 - stpipe.step - INFO - Saved model in ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs1_s3d.fits
2026-03-27 13:52:07,584 - stpipe.step - INFO - Step extract_1d running with args (<jwst.datamodels.container.ModelContainer object at 0x7fc408d7abd0>,).
2026-03-27 13:52:07,589 - jwst.extract_1d.extract_1d_step - INFO - Using EXTRACT1D reference file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_extract1d_0002.asdf
2026-03-27 13:52:07,592 - jwst.extract_1d.extract_1d_step - INFO - Using APCORR file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_apcorr_0009.asdf
2026-03-27 13:52:07,595 - jwst.extract_1d.extract_1d_step - INFO - Turning off residual fringe correction because it only works on MIRI MRS data
2026-03-27 13:52:07,596 - jwst.extract_1d.ifu - INFO - Source type = EXTENDED
2026-03-27 13:52:07,785 - jwst.extract_1d.ifu - INFO - Input model does not break out variance information. Passing only generalized errors.
2026-03-27 13:52:22,550 - stpipe.step - INFO - Saved model in ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs1_x1d.fits
2026-03-27 13:52:22,551 - stpipe.step - INFO - Step extract_1d done
2026-03-27 13:52:22,552 - jwst.pipeline.calwebb_spec2 - INFO - Finished processing product mast_products/jw01335004001_03101_00002_nrs1
2026-03-27 13:52:22,556 - jwst.pipeline.calwebb_spec2 - INFO - Ending calwebb_spec2
2026-03-27 13:52:22,556 - jwst.stpipe.core - INFO - Results used CRDS context: jwst_1464.pmap
2026-03-27 13:52:24,196 - stpipe.step - INFO - Saved model in ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs1_cal.fits
2026-03-27 13:52:24,197 - stpipe.step - INFO - Step Spec2Pipeline done
2026-03-27 13:52:24,198 - jwst.stpipe.core - INFO - Results used jwst version: 1.20.2
2026-03-27 13:52:24,228 - stpipe.step - INFO - PARS-RESAMPLESPECSTEP parameters found: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pars-resamplespecstep_0001.asdf
2026-03-27 13:52:24,245 - stpipe.step - INFO - PARS-RESAMPLESPECSTEP parameters found: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pars-resamplespecstep_0001.asdf
2026-03-27 13:52:24,269 - stpipe.step - INFO - Spec2Pipeline instance created.
2026-03-27 13:52:24,270 - stpipe.step - INFO - AssignWcsStep instance created.
2026-03-27 13:52:24,271 - stpipe.step - INFO - BadpixSelfcalStep instance created.
2026-03-27 13:52:24,272 - stpipe.step - INFO - MSAFlagOpenStep instance created.
2026-03-27 13:52:24,273 - stpipe.step - INFO - NSCleanStep instance created.
2026-03-27 13:52:24,274 - stpipe.step - INFO - BackgroundStep instance created.
2026-03-27 13:52:24,275 - stpipe.step - INFO - ImprintStep instance created.
2026-03-27 13:52:24,276 - stpipe.step - INFO - Extract2dStep instance created.
2026-03-27 13:52:24,281 - stpipe.step - INFO - MasterBackgroundMosStep instance created.
2026-03-27 13:52:24,281 - stpipe.step - INFO - FlatFieldStep instance created.
2026-03-27 13:52:24,282 - stpipe.step - INFO - PathLossStep instance created.
2026-03-27 13:52:24,284 - stpipe.step - INFO - BarShadowStep instance created.
2026-03-27 13:52:24,284 - stpipe.step - INFO - PhotomStep instance created.
2026-03-27 13:52:24,285 - stpipe.step - INFO - PixelReplaceStep instance created.
2026-03-27 13:52:24,286 - stpipe.step - INFO - ResampleSpecStep instance created.
2026-03-27 13:52:24,288 - stpipe.step - INFO - Extract1dStep instance created.
2026-03-27 13:52:24,289 - stpipe.step - INFO - WavecorrStep instance created.
2026-03-27 13:52:24,290 - stpipe.step - INFO - FlatFieldStep instance created.
2026-03-27 13:52:24,291 - stpipe.step - INFO - SourceTypeStep instance created.
2026-03-27 13:52:24,292 - stpipe.step - INFO - StraylightStep instance created.
2026-03-27 13:52:24,294 - stpipe.step - INFO - FringeStep instance created.
2026-03-27 13:52:24,294 - stpipe.step - INFO - ResidualFringeStep instance created.
2026-03-27 13:52:24,296 - stpipe.step - INFO - PathLossStep instance created.
2026-03-27 13:52:24,297 - stpipe.step - INFO - BarShadowStep instance created.
2026-03-27 13:52:24,298 - stpipe.step - INFO - WfssContamStep instance created.
2026-03-27 13:52:24,298 - stpipe.step - INFO - PhotomStep instance created.
2026-03-27 13:52:24,299 - stpipe.step - INFO - PixelReplaceStep instance created.
2026-03-27 13:52:24,300 - stpipe.step - INFO - ResampleSpecStep instance created.
2026-03-27 13:52:24,302 - stpipe.step - INFO - CubeBuildStep instance created.
2026-03-27 13:52:24,304 - stpipe.step - INFO - Extract1dStep instance created.
Saved jw01335004001_03101_00002_nrs1_mask.fits
Saved jw01335004001_03101_00002_nrs1_nsclean.fits
Saved jw01335004001_03101_00002_nrs1_cal.fits
Saved jw01335004001_03101_00002_nrs1_x1d.fits
Processing jw01335004001_03101_00002_nrs2_rate.fits... 
2026-03-27 13:52:25,275 - stpipe.step - INFO - Step Spec2Pipeline running with args ('./mast_products/jw01335004001_03101_00002_nrs2_rate.fits',).
2026-03-27 13:52:25,309 - stpipe.step - INFO - Step Spec2Pipeline parameters are:
  pre_hooks: []
  post_hooks: []
  output_file: None
  output_dir: ./stage2_nsclean_modified/
  output_ext: .fits
  output_use_model: False
  output_use_index: True
  save_results: True
  skip: False
  suffix: None
  search_output_file: True
  input_dir: ''
  save_bsub: False
  fail_on_exception: True
  save_wfss_esec: False
  steps:
    assign_wcs:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      sip_approx: True
      sip_max_pix_error: 0.01
      sip_degree: None
      sip_max_inv_pix_error: 0.01
      sip_inv_degree: None
      sip_npoints: 12
      slit_y_low: -0.55
      slit_y_high: 0.55
      nrs_ifu_slice_wcs: False
    badpix_selfcal:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: True
      suffix: None
      search_output_file: True
      input_dir: ''
      flagfrac_lower: 0.001
      flagfrac_upper: 0.001
      kernel_size: 15
      force_single: False
      save_flagged_bkg: False
    msa_flagging:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
    nsclean:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: True
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      fit_method: fft
      fit_by_channel: False
      background_method: None
      background_box_size: None
      mask_spectral_regions: True
      n_sigma: 5.0
      fit_histogram: False
      single_mask: False
      user_mask: ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs2_mask_modified.fits
      save_mask: True
      save_background: False
      save_noise: False
    bkg_subtract:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      bkg_list: None
      save_combined_background: False
      sigma: 3.0
      maxiters: None
      soss_source_percentile: 35.0
      soss_bkg_percentile: None
      wfss_mmag_extract: None
      wfss_maxiter: 5
      wfss_rms_stop: 0.0
      wfss_outlier_percent: 1.0
    imprint_subtract:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
    extract_2d:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      slit_names: None
      source_ids: None
      extract_orders: None
      grism_objects: None
      tsgrism_extract_height: None
      wfss_extract_half_height: 5
      wfss_mmag_extract: None
      wfss_nbright: 1000
    master_background_mos:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: True
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      sigma_clip: 3.0
      median_kernel: 1
      force_subtract: False
      save_background: False
      user_background: None
      inverse: False
      steps:
        flat_field:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          save_interpolated_flat: False
          user_supplied_flat: None
          inverse: False
        pathloss:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          inverse: False
          source_type: None
          user_slit_loc: None
        barshadow:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          inverse: False
          source_type: None
        photom:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          inverse: False
          source_type: None
          apply_time_correction: True
        pixel_replace:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: True
          output_use_index: True
          save_results: False
          skip: True
          suffix: None
          search_output_file: True
          input_dir: ''
          algorithm: fit_profile
          n_adjacent_cols: 3
        resample_spec:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          pixfrac: 1.0
          kernel: square
          fillval: NaN
          weight_type: exptime
          output_shape: None
          pixel_scale_ratio: 1.0
          pixel_scale: None
          output_wcs: ''
          single: False
          blendheaders: True
          in_memory: True
        extract_1d:
          pre_hooks: []
          post_hooks: []
          output_file: None
          output_dir: None
          output_ext: .fits
          output_use_model: False
          output_use_index: True
          save_results: False
          skip: False
          suffix: None
          search_output_file: True
          input_dir: ''
          subtract_background: None
          apply_apcorr: True
          extraction_type: box
          use_source_posn: None
          position_offset: 0.0
          model_nod_pair: True
          optimize_psf_location: True
          smoothing_length: None
          bkg_fit: None
          bkg_order: None
          log_increment: 50
          save_profile: False
          save_scene_model: False
          save_residual_image: False
          center_xy: None
          ifu_autocen: False
          bkg_sigma_clip: 3.0
          ifu_rfcorr: True
          ifu_set_srctype: None
          ifu_rscale: None
          ifu_covar_scale: 1.0
          soss_atoca: True
          soss_threshold: 0.01
          soss_n_os: 2
          soss_wave_grid_in: None
          soss_wave_grid_out: None
          soss_estimate: None
          soss_rtol: 0.0001
          soss_max_grid_size: 20000
          soss_tikfac: None
          soss_width: 40.0
          soss_bad_pix: masking
          soss_modelname: None
          soss_order_3: True
    wavecorr:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
    flat_field:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      save_interpolated_flat: False
      user_supplied_flat: None
      inverse: False
    srctype:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      source_type: None
    straylight:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      clean_showers: False
      shower_plane: 3
      shower_x_stddev: 18.0
      shower_y_stddev: 5.0
      shower_low_reject: 0.1
      shower_high_reject: 99.9
      save_shower_model: False
    fringe:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
    residual_fringe:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: True
      suffix: residual_fringe
      search_output_file: False
      input_dir: ''
      save_intermediate_results: False
      ignore_region_min: None
      ignore_region_max: None
    pathloss:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      inverse: False
      source_type: None
      user_slit_loc: None
    barshadow:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      inverse: False
      source_type: None
    wfss_contam:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: True
      suffix: None
      search_output_file: True
      input_dir: ''
      save_simulated_image: False
      save_contam_images: False
      maximum_cores: none
      orders: None
      magnitude_limit: None
      wl_oversample: 2
      max_pixels_per_chunk: 50000
    photom:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      inverse: False
      source_type: None
      apply_time_correction: True
    pixel_replace:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: True
      output_use_index: True
      save_results: False
      skip: True
      suffix: None
      search_output_file: True
      input_dir: ''
      algorithm: fit_profile
      n_adjacent_cols: 3
    resample_spec:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      pixfrac: 1.0
      kernel: square
      fillval: NaN
      weight_type: exptime
      output_shape: None
      pixel_scale_ratio: 1.0
      pixel_scale: None
      output_wcs: ''
      single: False
      blendheaders: True
      in_memory: True
    cube_build:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: True
      output_use_index: True
      save_results: False
      skip: False
      suffix: s3d
      search_output_file: False
      input_dir: ''
      pipeline: 3
      channel: all
      band: all
      grating: all
      filter: all
      output_type: None
      scalexy: 0.0
      scalew: 0.0
      weighting: drizzle
      coord_system: skyalign
      ra_center: None
      dec_center: None
      cube_pa: None
      nspax_x: None
      nspax_y: None
      rois: 0.0
      roiw: 0.0
      weight_power: 2.0
      wavemin: None
      wavemax: None
      single: False
      skip_dqflagging: False
      offset_file: None
      debug_spaxel: -1 -1 -1
    extract_1d:
      pre_hooks: []
      post_hooks: []
      output_file: None
      output_dir: None
      output_ext: .fits
      output_use_model: False
      output_use_index: True
      save_results: False
      skip: False
      suffix: None
      search_output_file: True
      input_dir: ''
      subtract_background: None
      apply_apcorr: True
      extraction_type: box
      use_source_posn: None
      position_offset: 0.0
      model_nod_pair: True
      optimize_psf_location: True
      smoothing_length: None
      bkg_fit: None
      bkg_order: None
      log_increment: 50
      save_profile: False
      save_scene_model: False
      save_residual_image: False
      center_xy: None
      ifu_autocen: False
      bkg_sigma_clip: 3.0
      ifu_rfcorr: True
      ifu_set_srctype: None
      ifu_rscale: None
      ifu_covar_scale: 1.0
      soss_atoca: True
      soss_threshold: 0.01
      soss_n_os: 2
      soss_wave_grid_in: None
      soss_wave_grid_out: None
      soss_estimate: None
      soss_rtol: 0.0001
      soss_max_grid_size: 20000
      soss_tikfac: None
      soss_width: 40.0
      soss_bad_pix: masking
      soss_modelname: None
      soss_order_3: True
2026-03-27 13:52:25,343 - stpipe.pipeline - INFO - Prefetching reference files for dataset: 'jw01335004001_03101_00002_nrs2_rate.fits' reftypes = ['apcorr', 'area', 'barshadow', 'bkg', 'camera', 'collimator', 'cubepar', 'dflat', 'disperser', 'distortion', 'extract1d', 'fflat', 'filteroffset', 'flat', 'fore', 'fpa', 'fringe', 'ifufore', 'ifupost', 'ifuslicer', 'mrsxartcorr', 'msa', 'msaoper', 'ote', 'pastasoss', 'pathloss', 'photom', 'psf', 'regions', 'sflat', 'speckernel', 'specprofile', 'specwcs', 'wavecorr', 'wavelengthrange']
2026-03-27 13:52:25,348 - stpipe.pipeline - INFO - Prefetch for APCORR reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_apcorr_0009.asdf'.
2026-03-27 13:52:25,349 - stpipe.pipeline - INFO - Prefetch for AREA reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_area_0046.fits'.
2026-03-27 13:52:25,350 - stpipe.pipeline - INFO - Prefetch for BARSHADOW reference file is 'N/A'.
2026-03-27 13:52:25,350 - stpipe.pipeline - INFO - Prefetch for BKG reference file is 'N/A'.
2026-03-27 13:52:25,351 - stpipe.pipeline - INFO - Prefetch for CAMERA reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_camera_0008.asdf'.
2026-03-27 13:52:25,351 - stpipe.pipeline - INFO - Prefetch for COLLIMATOR reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_collimator_0008.asdf'.
2026-03-27 13:52:25,352 - stpipe.pipeline - INFO - Prefetch for CUBEPAR reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_cubepar_0009.fits'.
2026-03-27 13:52:25,353 - stpipe.pipeline - INFO - Prefetch for DFLAT reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_dflat_0002.fits'.
2026-03-27 13:52:25,353 - stpipe.pipeline - INFO - Prefetch for DISPERSER reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_disperser_0066.asdf'.
2026-03-27 13:52:25,354 - stpipe.pipeline - INFO - Prefetch for DISTORTION reference file is 'N/A'.
2026-03-27 13:52:25,355 - stpipe.pipeline - INFO - Prefetch for EXTRACT1D reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_extract1d_0002.asdf'.
2026-03-27 13:52:25,355 - stpipe.pipeline - INFO - Prefetch for FFLAT reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fflat_0170.fits'.
2026-03-27 13:52:25,356 - stpipe.pipeline - INFO - Prefetch for FILTEROFFSET reference file is 'N/A'.
2026-03-27 13:52:25,356 - stpipe.pipeline - INFO - Prefetch for FLAT reference file is 'N/A'.
2026-03-27 13:52:25,357 - stpipe.pipeline - INFO - Prefetch for FORE reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fore_0050.asdf'.
2026-03-27 13:52:25,357 - stpipe.pipeline - INFO - Prefetch for FPA reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fpa_0009.asdf'.
2026-03-27 13:52:25,358 - stpipe.pipeline - INFO - Prefetch for FRINGE reference file is 'N/A'.
2026-03-27 13:52:25,359 - stpipe.pipeline - INFO - Prefetch for IFUFORE reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifufore_0013.asdf'.
2026-03-27 13:52:25,359 - stpipe.pipeline - INFO - Prefetch for IFUPOST reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifupost_0014.asdf'.
2026-03-27 13:52:25,360 - stpipe.pipeline - INFO - Prefetch for IFUSLICER reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifuslicer_0012.asdf'.
2026-03-27 13:52:25,361 - stpipe.pipeline - INFO - Prefetch for MRSXARTCORR reference file is 'N/A'.
2026-03-27 13:52:25,361 - stpipe.pipeline - INFO - Prefetch for MSA reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_msa_0009.asdf'.
2026-03-27 13:52:25,362 - stpipe.pipeline - INFO - Prefetch for MSAOPER reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_msaoper_0006.json'.
2026-03-27 13:52:25,363 - stpipe.pipeline - INFO - Prefetch for OTE reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ote_0011.asdf'.
2026-03-27 13:52:25,364 - stpipe.pipeline - INFO - Prefetch for PASTASOSS reference file is 'N/A'.
2026-03-27 13:52:25,364 - stpipe.pipeline - INFO - Prefetch for PATHLOSS reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pathloss_0003.fits'.
2026-03-27 13:52:25,365 - stpipe.pipeline - INFO - Prefetch for PHOTOM reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_photom_0016.fits'.
2026-03-27 13:52:25,365 - stpipe.pipeline - INFO - Prefetch for PSF reference file is 'N/A'.
2026-03-27 13:52:25,366 - stpipe.pipeline - INFO - Prefetch for REGIONS reference file is 'N/A'.
2026-03-27 13:52:25,366 - stpipe.pipeline - INFO - Prefetch for SFLAT reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_sflat_0212.fits'.
2026-03-27 13:52:25,367 - stpipe.pipeline - INFO - Prefetch for SPECKERNEL reference file is 'N/A'.
2026-03-27 13:52:25,368 - stpipe.pipeline - INFO - Prefetch for SPECPROFILE reference file is 'N/A'.
2026-03-27 13:52:25,368 - stpipe.pipeline - INFO - Prefetch for SPECWCS reference file is 'N/A'.
2026-03-27 13:52:25,369 - stpipe.pipeline - INFO - Prefetch for WAVECORR reference file is 'N/A'.
2026-03-27 13:52:25,369 - stpipe.pipeline - INFO - Prefetch for WAVELENGTHRANGE reference file is '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_wavelengthrange_0006.asdf'.
2026-03-27 13:52:25,370 - jwst.pipeline.calwebb_spec2 - INFO - Starting calwebb_spec2 ...
2026-03-27 13:52:25,370 - jwst.pipeline.calwebb_spec2 - INFO - Processing product mast_products/jw01335004001_03101_00002_nrs2
2026-03-27 13:52:25,371 - jwst.pipeline.calwebb_spec2 - INFO - Working on input ./mast_products/jw01335004001_03101_00002_nrs2_rate.fits ...
2026-03-27 13:52:25,585 - stpipe.step - INFO - Step assign_wcs running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_rate.fits>,).
2026-03-27 13:52:25,652 - jwst.assign_wcs.nirspec - INFO - gwa_ytilt is 0.133357972 deg
2026-03-27 13:52:25,653 - jwst.assign_wcs.nirspec - INFO - gwa_xtilt is 0.3564805 deg
2026-03-27 13:52:25,654 - jwst.assign_wcs.nirspec - INFO - theta_y correction: 0.0052787810844296245 deg
2026-03-27 13:52:25,655 - jwst.assign_wcs.nirspec - INFO - theta_x correction: 0.00014063512894183975 deg
2026-03-27 13:52:25,729 - jwst.assign_wcs.nirspec - INFO - Applied Barycentric velocity correction : 1.0000997975589527
2026-03-27 13:52:27,329 - jwst.assign_wcs.nirspec - INFO - Created a NIRSPEC nrs_ifu pipeline with references {'distortion': None, 'filteroffset': None, 'specwcs': None, 'regions': None, 'wavelengthrange': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_wavelengthrange_0006.asdf', 'camera': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_camera_0008.asdf', 'collimator': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_collimator_0008.asdf', 'disperser': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_disperser_0066.asdf', 'fore': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fore_0050.asdf', 'fpa': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fpa_0009.asdf', 'msa': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_msa_0009.asdf', 'ote': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ote_0011.asdf', 'ifupost': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifupost_0014.asdf', 'ifufore': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifufore_0013.asdf', 'ifuslicer': '/home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_ifuslicer_0012.asdf'}
2026-03-27 13:52:33,779 - stcal.alignment.util - INFO - Update S_REGION to POLYGON ICRS  150.546368565 1.617854367 150.547591077 1.617854367 150.547591077 1.618979922 150.546368565 1.618979922
2026-03-27 13:52:38,438 - jwst.assign_wcs.assign_wcs - INFO - COMPLETED assign_wcs
2026-03-27 13:52:38,443 - stpipe.step - INFO - Step assign_wcs done
2026-03-27 13:52:38,759 - stpipe.step - INFO - Step badpix_selfcal running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_rate.fits>, [], []).
2026-03-27 13:52:38,761 - stpipe.step - INFO - Step skipped.
2026-03-27 13:52:39,038 - stpipe.step - INFO - Step msa_flagging running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_rate.fits>,).
2026-03-27 13:52:42,705 - jwst.msaflagopen.msaflagopen_step - INFO - Using reference file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_msaoper_0006.json
2026-03-27 13:52:42,785 - jwst.msaflagopen.msaflag_open - INFO - 24 failed open shutters
2026-03-27 13:52:50,773 - stpipe.step - INFO - Step msa_flagging done
2026-03-27 13:52:51,551 - stpipe.step - INFO - Step nsclean running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_rate.fits>,).
2026-03-27 13:52:51,553 - jwst.nsclean.nsclean_step - WARNING - The 'nsclean' step is a deprecated alias to 'clean_flicker_noise' and will be removed in future builds.
2026-03-27 13:52:51,570 - jwst.clean_flicker_noise.clean_flicker_noise - INFO - Input exposure type is NRS_IFU, detector=NRS2
2026-03-27 13:52:55,732 - jwst.clean_flicker_noise.clean_flicker_noise - INFO - Cleaning image jw01335004001_03101_00002_nrs2_rate.fits
2026-03-27 13:52:57,371 - jwst.nsclean.nsclean_step - INFO - Saving mask file ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs2_mask.fits
2026-03-27 13:52:58,991 - stpipe.step - INFO - Saved model in ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs2_nsclean.fits
2026-03-27 13:52:58,992 - stpipe.step - INFO - Step nsclean done
2026-03-27 13:52:59,567 - stpipe.step - INFO - Step imprint_subtract running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>, []).
2026-03-27 13:52:59,568 - stpipe.step - INFO - Step skipped.
2026-03-27 13:52:59,955 - stpipe.step - INFO - Step bkg_subtract running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>, []).
2026-03-27 13:52:59,956 - stpipe.step - INFO - Step skipped.
2026-03-27 13:53:00,346 - stpipe.step - INFO - Step srctype running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:53:03,404 - jwst.srctype.srctype - INFO - Input EXP_TYPE is NRS_IFU
2026-03-27 13:53:03,405 - jwst.srctype.srctype - INFO - Input SRCTYAPT = EXTENDED
2026-03-27 13:53:03,405 - jwst.srctype.srctype - INFO - Using input source type = EXTENDED
2026-03-27 13:53:03,407 - stpipe.step - INFO - Step srctype done
2026-03-27 13:53:03,968 - stpipe.step - INFO - Step straylight running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:53:03,969 - stpipe.step - INFO - Step skipped.
2026-03-27 13:53:04,522 - stpipe.step - INFO - Step flat_field running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:53:04,547 - jwst.flatfield.flat_field_step - INFO - No reference found for type FLAT
2026-03-27 13:53:04,612 - jwst.flatfield.flat_field_step - INFO - Using FFLAT reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_fflat_0170.fits
2026-03-27 13:53:04,709 - jwst.flatfield.flat_field_step - INFO - Using SFLAT reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_sflat_0212.fits
2026-03-27 13:53:04,875 - jwst.flatfield.flat_field_step - INFO - Using DFLAT reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_dflat_0002.fits
2026-03-27 13:53:14,872 - stpipe.step - INFO - Step flat_field done
2026-03-27 13:53:15,553 - stpipe.step - INFO - Step fringe running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:53:15,555 - stpipe.step - INFO - Step skipped.
2026-03-27 13:53:16,005 - stpipe.step - INFO - Step pathloss running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:53:16,024 - jwst.pathloss.pathloss_step - INFO - Using PATHLOSS reference file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_pathloss_0003.fits
2026-03-27 13:53:16,060 - jwst.pathloss.pathloss - INFO - Input exposure type is NRS_IFU
2026-03-27 13:53:21,840 - stpipe.step - INFO - Step pathloss done
2026-03-27 13:53:22,541 - stpipe.step - INFO - Step barshadow running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:53:22,543 - stpipe.step - INFO - Step skipped.
2026-03-27 13:53:23,107 - stpipe.step - INFO - Step photom running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:53:23,129 - jwst.photom.photom_step - INFO - Using photom reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_photom_0016.fits
2026-03-27 13:53:23,130 - jwst.photom.photom_step - INFO - Using area reference file: /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_area_0046.fits
2026-03-27 13:53:26,660 - jwst.photom.photom - INFO - Using instrument: NIRSPEC
2026-03-27 13:53:26,661 - jwst.photom.photom - INFO -  detector: NRS2
2026-03-27 13:53:26,661 - jwst.photom.photom - INFO -  exp_type: NRS_IFU
2026-03-27 13:53:26,662 - jwst.photom.photom - INFO -  filter: F100LP
2026-03-27 13:53:26,662 - jwst.photom.photom - INFO -  grating: G140H
2026-03-27 13:53:26,709 - jwst.photom.photom - INFO - PHOTMJSR value: 3.83761e+12
2026-03-27 13:53:29,150 - stpipe.step - INFO - Step photom done
2026-03-27 13:53:30,009 - stpipe.step - INFO - Step residual_fringe running with args (<IFUImageModel(2048, 2048) from jw01335004001_03101_00002_nrs2_nsclean.fits>,).
2026-03-27 13:53:30,011 - stpipe.step - INFO - Step skipped.
2026-03-27 13:53:33,979 - stpipe.step - INFO - Step pixel_replace running with args (<IFUImageModel(2048, 2048) from ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs2_cal.fits>,).
2026-03-27 13:53:33,981 - stpipe.step - INFO - Step skipped.
2026-03-27 13:53:34,495 - stpipe.step - INFO - Step cube_build running with args (<IFUImageModel(2048, 2048) from ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs2_cal.fits>,).
2026-03-27 13:53:34,496 - jwst.cube_build.cube_build_step - INFO - Starting IFU Cube Building Step
2026-03-27 13:53:34,497 - jwst.cube_build.cube_build_step - INFO - Input interpolation: drizzle
2026-03-27 13:53:34,498 - jwst.cube_build.cube_build_step - INFO - Coordinate system to use: skyalign
2026-03-27 13:53:34,514 - jwst.cube_build.cube_build_step - INFO - Setting output type to: band
2026-03-27 13:53:34,539 - jwst.cube_build.cube_build - INFO - Reading cube parameter file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_cubepar_0009.fits
2026-03-27 13:53:34,995 - jwst.cube_build.cube_build - INFO - Output Cubes are single grating, single filter IFU Cubes
2026-03-27 13:53:34,997 - jwst.cube_build.cube_build_step - INFO - Number of IFU cubes produced by this run = 1
2026-03-27 13:53:34,998 - jwst.cube_build.ifu_cube - INFO - Increasing spatial region of interest default value set for 4 dithers nan
2026-03-27 13:53:35,000 - jwst.cube_build.ifu_cube - INFO - Cube Geometry:
2026-03-27 13:53:35,001 - jwst.cube_build.ifu_cube - INFO - axis#  Naxis  CRPIX    CRVAL       CDELT(arcsec)  Min & Max (xi, eta arcsec)
2026-03-27 13:53:35,002 - jwst.cube_build.ifu_cube - INFO - Axis 1    47  24.00 150.54697982   0.10000000  -2.35000004   2.35000004
2026-03-27 13:53:35,002 - jwst.cube_build.ifu_cube - INFO - Axis 2    45  23.00   1.61841714   0.10000000  -2.25000003   2.25000003
2026-03-27 13:53:35,003 - jwst.cube_build.ifu_cube - INFO - axis#  Naxis  CRPIX    CRVAL      CDELT(microns)  Min & Max (microns)
2026-03-27 13:53:35,004 - jwst.cube_build.ifu_cube - INFO - Axis 3  3915   1.00   0.97011753   0.00023500   0.97000003   1.89002503
2026-03-27 13:53:35,004 - jwst.cube_build.ifu_cube - INFO - Cube covers grating, filter: g140h, f100lp
2026-03-27 13:53:35,005 - jwst.cube_build.ifu_cube - INFO - Output Name: ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs2_s3d.fits
2026-03-27 13:53:38,532 - jwst.cube_build.ifu_cube - INFO - Mapping each NIRSpec slice to sky for input file: ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs2_cal.fits
2026-03-27 13:53:48,246 - jwst.cube_build.ifu_cube - INFO - # of detector pixels not mapped to output plane: 9178 with wavelength above 1.890381051178193
2026-03-27 13:54:04,743 - jwst.cube_build.ifu_cube - INFO - Average # of holes/wavelength plane is < 1
2026-03-27 13:54:04,744 - jwst.cube_build.ifu_cube - INFO - Total # of holes for IFU cube is : 0
2026-03-27 13:54:05,056 - stcal.alignment.util - INFO - Update S_REGION to POLYGON ICRS  150.546340677 1.617806033 150.546340677 1.619028256 150.547618965 1.619028256 150.547618965 1.617806033
2026-03-27 13:54:05,059 - stpipe.step - INFO - Step cube_build done
2026-03-27 13:54:05,183 - stpipe.step - INFO - Saved model in ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs2_s3d.fits
2026-03-27 13:54:06,022 - stpipe.step - INFO - Step extract_1d running with args (<jwst.datamodels.container.ModelContainer object at 0x7fc40b7920d0>,).
2026-03-27 13:54:06,027 - jwst.extract_1d.extract_1d_step - INFO - Using EXTRACT1D reference file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_extract1d_0002.asdf
2026-03-27 13:54:06,030 - jwst.extract_1d.extract_1d_step - INFO - Using APCORR file /home/runner/crds_cache/references/jwst/nirspec/jwst_nirspec_apcorr_0009.asdf
2026-03-27 13:54:06,033 - jwst.extract_1d.extract_1d_step - INFO - Turning off residual fringe correction because it only works on MIRI MRS data
2026-03-27 13:54:06,033 - jwst.extract_1d.ifu - INFO - Source type = EXTENDED
2026-03-27 13:54:06,223 - jwst.extract_1d.ifu - INFO - Input model does not break out variance information. Passing only generalized errors.
2026-03-27 13:54:20,499 - stpipe.step - INFO - Saved model in ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs2_x1d.fits
2026-03-27 13:54:20,500 - stpipe.step - INFO - Step extract_1d done
2026-03-27 13:54:20,501 - jwst.pipeline.calwebb_spec2 - INFO - Finished processing product mast_products/jw01335004001_03101_00002_nrs2
2026-03-27 13:54:20,502 - jwst.pipeline.calwebb_spec2 - INFO - Ending calwebb_spec2
2026-03-27 13:54:20,502 - jwst.stpipe.core - INFO - Results used CRDS context: jwst_1464.pmap
2026-03-27 13:54:22,178 - stpipe.step - INFO - Saved model in ./stage2_nsclean_modified/jw01335004001_03101_00002_nrs2_cal.fits
2026-03-27 13:54:22,179 - stpipe.step - INFO - Step Spec2Pipeline done
2026-03-27 13:54:22,179 - jwst.stpipe.core - INFO - Results used jwst version: 1.20.2
Saved jw01335004001_03101_00002_nrs2_mask.fits
Saved jw01335004001_03101_00002_nrs2_nsclean.fits
Saved jw01335004001_03101_00002_nrs2_cal.fits
Saved jw01335004001_03101_00002_nrs2_x1d.fits
Run time:  4.003333333333333  min

7.2 Comparing Original vs. Cleaned Data (Hand-Modified Mask) #


# Plot the original and cleaned data, as well as a residual map.

cleaned_modified_masks = [
    stage2_nsclean_modified_dir + "jw01335004001_03101_00002_nrs1_nsclean.fits",
    stage2_nsclean_modified_dir + "jw01335004001_03101_00002_nrs2_nsclean.fits",
]

# Plot each associated set of rateint data and cleaned file.
for rate_file, cleaned_file in zip(rate_names, cleaned_modified_masks):
    plot_cleaned_data(
        mast_products_dir + rate_file, cleaned_file, layout="columns", scale=9
    )
../../../_images/85f38a4de301553a83ce2bd6b3048b42fcaa24b6cb92d467e4d83e252069ae3b.png ../../../_images/1eaa1e076910fced94faedd37a3888714b6b989213e2af349be63453393d883b.png

Compare the extracted spectrum from the cleaned data to the spectrum extracted from the original rate file.

x1d_nsclean_modified = [
    stage2_nsclean_modified_dir + "jw01335004001_03101_00002_nrs1_x1d.fits",
    stage2_nsclean_modified_dir + "jw01335004001_03101_00002_nrs2_x1d.fits",
]

# Wavelength region of interest
wavelength_range = {"nrs1": [1.15, 1.25], "nrs2": [1.65, 1.75]}
for original, cleaned in zip(x1d_nsclean_skipped, x1d_nsclean_modified):
    plot_spectra(
        [original, cleaned], scale_percent=4, wavelength_range=wavelength_range
    )
../../../_images/07edb3bcba3a6f6410aad786b2a502b2ffd228dfa08658e8447e4894b6f2b931.png ../../../_images/81c491296dcbe424e84db060274e74080bf39b66f2b9817682fcbb331ef1c447.png

Notes:

  • Even when masking the handful of snowballs we encountered, the spectra remain similar to those cleaned with the default mask.

  • The portion of the spectrum near 1.2um for NRS1 and 1.7um for NRS2, the excess flux due to 1/f noise is reduced.

  • There are several spikes in the difference between the cleaned and original spectra. These correspond to the scattered artifacts introduced by the cleaning process, above.

8. Conclusion #


The final plots below show the countrate images and the resulting 1D extracted spectra side-by-side to compare the different cleaning methods: the original (no NSClean applied), the cleaned countrate image (with the default pipeline mask), the cleaned countrate image (with an alternate pipeline mask), and finally, the cleaned countrate image (with the hand-modified mask).

Please note that the results presented in this notebook may vary for different datasets (e.g., targets of different brightness, spatial extent, etc.). Users are encouraged to explore NSClean using different masking methods to determine the optimal results.

The output from the cleaning algorithm is now ready for further processing. The (_cal.fits) files produced by the above Spec2Pipeline run may be used as input to the Spec3Pipeline, for generating final combined spectral cubes and extracted spectra.

# Not cleaned vs. cleaned (default mask) vs. cleaned (alternate mask) rate data
original_rate_data = [
    fits.open(mast_products_dir + rate_name)[1].data for rate_name in rate_names
]
cleaned_rate_default_data = [
    fits.open(cleaned_default_mask)[1].data
    for cleaned_default_mask in cleaned_default_masks
]
cleaned_rate_alternate_data = [
    fits.open(cleaned_alternate_mask)[1].data
    for cleaned_alternate_mask in cleaned_alternate_masks
]
cleaned_rate_modified_data = [
    fits.open(cleaned_modified_mask)[1].data
    for cleaned_modified_mask in cleaned_modified_masks
]

# For plotting visualization
for data_list in [
    original_rate_data,
    cleaned_rate_default_data,
    cleaned_rate_alternate_data,
    cleaned_rate_modified_data,
]:
    for data in data_list:
        data[np.isnan(data)] = 0

# Original vs. cleaned data (with default mask)
fig, axs = plt.subplots(2, 4, figsize=(25, 12))

# Set y-axis titles and plot the data
titles = [
    "Original Rate Data",
    "Cleaned Rate Data (Default Mask)",
    "Cleaned Rate Data (Alternate Mask)",
    "Cleaned Rate Data (Hand-Modified Mask)",
]
for i, (data_list, title) in enumerate(
    zip(
        [
            original_rate_data,
            cleaned_rate_default_data,
            cleaned_rate_alternate_data,
            cleaned_rate_modified_data,
        ],
        titles,
    )
):
    for j, data in enumerate(data_list):
        ax = axs[j, i]
        ax.set_title(f'{title} \n {"NRS1" if j == 0 else "NRS2"}', fontsize=12)
        im = ax.imshow(data, origin="lower", clim=(-1e-3, 1e-2))
        fig.colorbar(im, ax=ax, pad=0.05, shrink=0.7, label="DN/s")
        ax.set_xlabel("Pixel Column", fontsize=10)
        ax.set_ylabel("Pixel Row", fontsize=10)

plt.tight_layout()
plt.show()
../../../_images/d66b1145013f1cb82b8f222bb0223f46cd772772ad813f63301e03951510fc32.png
# Final Comparison

# Wavelength region of interest
wavelength_range = {"nrs1": [1.15, 1.25], "nrs2": [1.65, 1.75]}

plot_spectra(
    [
        x1d_nsclean_skipped[0],
        x1d_nsclean_default[0],
        x1d_nsclean_alternate[0],
        x1d_nsclean_modified[0],
    ],
    wavelength_range=wavelength_range,
    scale_percent=4,
)
plot_spectra(
    [
        x1d_nsclean_skipped[1],
        x1d_nsclean_default[1],
        x1d_nsclean_alternate[1],
        x1d_nsclean_modified[1],
    ],
    wavelength_range=wavelength_range,
    scale_percent=4,
)
../../../_images/e58d5471853ae438735a9b7be9333e69acc52333f5c862d0532ace2632fe1208.png ../../../_images/dfcca7a1d7be214aad078d73e630643d351a2e6b134b81c7178e5953f00a8d98.png

Note: Cleaning with the alternate mask still removes some of the wavelength-dependent variations but leaves residual background variation in NRS2. Also note the overall continuum level for the spectrum has changed, especially for NRS1. Again, this is because sigma-clipping, unlike the default method, only masks the bright outliers, rather than the entire science region. Consequently, some sky regions are included in the background model that gets subtracted from the data, which can result in changes to the continuum level. In this case, the original algorithm, which blocks the entire science region for each IFU slice (or the hand-modified method to exclude snowballs), is preferable to creating the mask via sigma-clipping.

About the Notebook #

Authors: Melanie Clarke, Kayli Glidic; NIRSpec Instrument Team

Updated On: Feburary 29, 2024.


Top of Page