STScI Logo

Slitlessutils Cookbook: Spectral Extraction for WFC3/IR#

This notebook contains a step-by-step guide for performing spectral extractions with Slitlessutils for G102 (or G141) data from WFC3/IR.
The original source for this notebook is the WFC3 folder on the spacetelescope/hst_notebooks GitHub repository.


Learning Goals#

In this tutorial, you will:

  • Configure slitlessutils

  • Download data

  • Calibrate grism data with custom background subtraction code back_sub.py

  • Preprocess data for extraction

  • Extract 1-D spectra with a simple box extraction

Table of Contents#

1. Introduction
      1.1 Environment
      1.2 Imports
      1.3 Slitlessutils Configuration
2. Define Global Variables
3. Download Data
      3.1 Create Data Directories and Organize
4. Calibrate Data
      4.1 Run WFC3 Backsub on Grism Data
      4.2 Check the World Coordinate System (WCS)
5. Preprocess the F105W Direct Images
      5.1 Display Drizzle Image and Overlay Segmentation Map
6. Extract the Spectra from the Grism Data
      6.1 Display a Region File
      6.2 Plot the Spectrum
7. Conclusions
Additional Resources
About this Notebook
Citations

1. Introduction#

Slitlessutils is an official STScI-supported Python package that provides spectral extraction processes for HST grism and
prism data. The slitlessutils software package has formally replaced the HSTaXe Python package, which will remain
on the spacetelescope GitHub organization, but no longer be maintained or developed.

Below, we show an example workflow of spectral extraction using WFC3/IR G102 grism data and F105W direct image data.
The example data were taken as part of WFC3 CAL program 17687 and are downloaded from the Mikulski Archive for Space
Telescopes (MAST) via astroquery. The images are all full-frame exposures. Users with subarray data will need to employ
the embedding utility within slitlessutils before processing and extracting the data. See the UVIS subarray cookbook
for a tutorial on using slitlessutils with subarray data. This tutorial is intended to run continuously without requiring any
edits to the cells.

Running this notebook requires creating a conda environment from the provided requirements file in this notebook’s sub-folder
in the GitHub repository. For more details about creating the necessary environment, see the next section.

To run slitlessutils, we must download the configuration reference files. These files are instrument-specific and include
sensitivity curves, trace and dispersion files, flat fields, and more. Slitlessutils has a Config class with an associated
function that will download the necessary reference files from a Box folder. Section 1.3 shows how to use slitlessutils
to retrieve the files. Once downloaded, slitlessutils will use them for the different processes.

Finally, due to the multi-component nature of the WFC3/IR background, we recommend users consider calibrating RAW
G102/G141 FITS files with the WFC3 Backsub program. This type of complex background subtraction is not available within
slitlessutils and can have a noticeable impact on science results. All necessary files are available on Box, and in
Section 4.1 of this notebook, we download the Backsub files with Python and demonstrate how to run the program.

1.1 Environment#

This notebook requires users to install the packages listed in the requirements.txt file located in the notebook’s
sub-folder on the GitHub repository. We will use the conda package manager to build the necessary virtual environment.
For more information about installing and getting started with Conda (or Mamba), please see this page.

First, we will make sure the conda-forge channel is added so that conda can correctly find the various packages.
$ conda config --add channels conda-forge

Next, we will create a new environment called slitlessutils and initialize it with hstcal and python:
$ conda create --name slitlessutils "hstcal==3.1.0" "python==3.12"

Wait for conda to solve for the environment and confirm the packages/libraries with the y key when prompted.
Once completed, you can activate the new environment with:
$ conda activate slitlessutils

With the new environment activated, we can install the remaining packages from the requirements.txt file with pip:
$ pip install -r requirements.txt

Note, you may encounter an error installing llvmlite. To fix it, run the below command before installing slitlessutils:
$ conda install -c conda-forge llvmlite

We have now successfully installed all the necessary packages for running this notebook. Launch Jupyter and begin:
$ jupyter-lab

1.2 Imports#

For this notebook we import:

Package Purpose
glob File handling
matplotlib.pyplot Displaying images and plotting spectrum
numpy Handling arrays
os System commands
requests Stream download of the WFC3 Backsub tar.gz from Box
shutil File and directory clean up
tarfile Extract the downloaded WFC3 Backsub .tar.gz
astropy.io.fits Reading and modifying/creating FITS files
astropy.visualization Various tools for display FITS images
astropy.wcs.WCS Handling WCS objects
astroquery.mast.Observations Downloading RAW and FLT data from MASTs
drizzlepac.astrodrizzle Creating a mosaic for the direct image filter
pyregions Overlaying DS9-formatted regions
slitlessutils Handling preprocessing and spectral extraction
%matplotlib widget
import glob
import matplotlib.pyplot as plt
import numpy as np
import os
import requests
import shutil
import tarfile

from astropy.io import fits
from astropy.visualization import ZScaleInterval, ImageNormalize, LogStretch
from astropy.wcs import WCS
from astroquery.mast import Observations
from drizzlepac import astrodrizzle
import pyregion

import slitlessutils as su

zscale = ZScaleInterval()
INFO MainProcess> Logger (slitlessutils) with level=10 at 2026-04-10 14:12:57.862330

1.3 Slitlessutils Configuration#

In order to extract or simulate grism spectra with slitlessutils, you must have the necessary reference files.
Below, we provide a table of file descriptions, example filenames, and file types for the different reference files
required by slitlessutils.

File Description Example Filename File Type
Sensitivity curves for the different spectral orders WFC3.IR.G102.1st.sens.2.fits FITS table
Config files with trace and dispersion coefficients g102.conf Text / ASCII
Instrument configuration parameters hst_wfc3ir.yaml YAML
Normalized sky images HST_WFC3IR_G102_sky.fits FITS image
Filter throughput curves hst_wfc3_f105w.fits FITS table
Flat fields WFC3.IR.G102.flat.2.fits FITS image

These reference files that are required for spectral extraction and modeling with slitlessutils must reside in a
dot-directory within the user’s home directory, {$HOME}/.slitlessutils. Upon initialization, the Config()
object verifies the existence of this directory and the presence of valid reference files. If the directory does not
exist, it is created; if the reference files are missing, the most recent versions are automatically retrieved from a
public Box directory. Once the files are downloaded, slitlessutils will apply them automatically, relieving the
user from calling them manually. For more information about configuring slitlessutils, please see the
documentation.

In the following code cell, we initialize the configuration with su.config.Config(). As stated above, if this is your
first time initializing slitlessutils configuration, su.config.Config() will download the most recent reference
files. In the future, if a new reference file version is released, it can be retrieved with cfg.retrieve_reffiles(
update=True).

# Initialize configuration 
cfg = su.config.Config()
# Download latest reffile version
cfg.retrieve_reffiles(update=True)
INFO MainProcess> Using reference path: /home/runner/.slitlessutils/1.0.8/
INFO MainProcess> Retrieving remote file https://data.science.stsci.edu/redirect/slitlessutils/slitlessutils_config_v1.0.8.tar.gz to /home/runner/.slitlessutils
INFO MainProcess> Using reference path: /home/runner/.slitlessutils/1.0.8/
'https://data.science.stsci.edu/redirect/slitlessutils/slitlessutils_config_v1.0.8.tar.gz'

2. Define Global Variables#

These variables will be used throughout the notebook and should only be updated if you are processing different datasets.
The table below lists all the global variables used in the notebook, along with a brief description and the section(s) where
they’re used.

Variable Description
FILTER The direct image filter. Used throughout entire notebook for handling files, I/O, creating a sub-
directory, and needed for slitlessutils. E.g. F105W, F140W
GRATING The grism image filter. Used throughout entire notebook for handling files, I/O, creating a sub-
directory, and needed for slitlessutils. E.g. G102, G141
INSTRUMENT The science instrument that took the data. Needed by slitlessutils. Used in
preprocess_direct() in Section 6. E.g. WFC3.
TELESCOPE The observatory. Needed by slitlessutils. Used in download() and preprocess_direct()
in Sections 3 and 6, respectively. E.g. HST.
DATASETS A dictionary of grism and direct image rootnames. Used throughout entire notebook.
RA The right ascension of the target in the direct image. Used in preprocess_direct() in
Section 6 when creating the segmentation map needed by slitlessutils. Must be in degrees.
DEC The declination of the target in the direct image. Used in preprocess_direct() in
Section 6 when creating the segmentation map needed by slitlessutils. Must be in degrees.
RAD The radius for the segemntations in the map. Used in preprocess_direct() in Section 6.
Must be in arcsec. E.g. 0.5.
SCALE The pixel scale used in preprocess_direct() in Section 6 for creating the drizzle image and
then the segmentation map. Must be in arcsec/pixel. E.g. 0.13.
ROOT The output file name for the drizzle image, segmentation map, and x1d spectrum file. Needed by
slitlessutils. Used in Sections 6 and 7.
ZEROPOINT The AB mag zeropoint of the direct image filter. Used by slitlessutils for estimating source flux
and/or for normalization when simulating data. In this tutorial, the zeropoint value will not
affect the resulting spectrum. Used in extract_single() in Section 7.
# the observations
FILTER = 'F105W'
GRATING = 'G102'
INSTRUMENT = 'WFC3'
TELESCOPE = 'HST'

# datasets to process
DATASETS = {GRATING: ['ifdb01ahq', 'ifdb01akq', 'ifdb01anq'],
            FILTER: ['ifdb01agq', 'ifdb01ajq', 'ifdb01amq']}

RA = 291.092519 # degrees      
DEC = 9.898913  # degrees 
RAD = 0.5 # in arcsec; for seg map
SCALE = 0.12825 # driz image pix scale 
ROOT = 'WFC3_IR_VY2-2' # output rootname for astrodrizzle and later SU

ZEROPOINT = 26.246 # f105w AB MAG -- 'wfc3, ir, f105w, mjd#60744, aper#6'

3. Download Data#

Here, we download the example images via astroquery. For more information, please look at the documentation for
Astroquery, Astroquery.mast, and CAOM Field Descriptions, which are used for the obstab variable below. Additionally,
you may download the data from MAST using either the HST MAST Search Engine or the more general MAST Portal.

We download G102 _raw.fits and F105W _flt.fits images of the galactic planetary nebula, VY2-2, from CAL
program 17687. This target is a well-established calibration source routinely used by the WFC3 instrument team to
derive and validate the wavelength solution for the IR grisms (WFC3 ISR 2016-15 (Pirzkal et al.)). After downloading the
images, we move them to a subdirectory within the current working directory.

def download(datasets, telescope):
    """
    Function to download RAW & FLT files from MAST with astroquery. 
    `datasets` contains ROOTNAMEs i.e. `ipppssoot`. 
        
    Parameters
    ----------
    datasets : dict
        A dictionary of grism and direct rootnames 
    telescope : str
        Used for MAST; e.g. HST 
        
    Output
    -------
    flt FITS files in current working dir
        ipppssoot_flt.fits  
    """
    # Build a lookup dictionary: obsid -> product type
    obs_to_type = {}
    for filt, ids in DATASETS.items():
        for oid in ids:
            if filt in GRATING:
                obs_to_type[oid.lower()] = 'RAW'
            else:
                obs_to_type[oid.lower()] = 'FLT'
                
    # All obsid to download
    obs_ids = tuple(obs_to_type.keys())
    # Call astroquery for all obs_ids
    obstab = Observations.query_criteria(obs_id=obs_ids, obs_collection=TELESCOPE)

    # Go through astroquery tables and download the RAW or FLT file
    for row in obstab:
        obsid = str(row['obs_id']).lower()
        product_type = obs_to_type[obsid]
        # Build dictionary of keywords for astroquery and download
        kwargs = {'productSubGroupDescription': [product_type],
                  'extension': 'fits',
                  'project': 'CALWF3',
                  'cache': False}
        downloads = Observations.download_products(row['obsid'], **kwargs)
        
        # Move the downloaded files to the current directory 
        for local in downloads['Local Path']:
            local = str(local)
            fname = os.path.basename(local)
            if fname.startswith(obsid):
                shutil.copy2(local, '.')
download(DATASETS, TELESCOPE)
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:HST/product/ifdb01agq_flt.fits to ./mastDownload/HST/ifdb01agq/ifdb01agq_flt.fits ...
 [Done]
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:HST/product/ifdb01ahq_raw.fits to ./mastDownload/HST/ifdb01ahq/ifdb01ahq_raw.fits ...
 [Done]
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:HST/product/ifdb01ajq_flt.fits to ./mastDownload/HST/ifdb01ajq/ifdb01ajq_flt.fits ...
 [Done]
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:HST/product/ifdb01akq_raw.fits to ./mastDownload/HST/ifdb01akq/ifdb01akq_raw.fits ...
 [Done]
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:HST/product/ifdb01amq_flt.fits to ./mastDownload/HST/ifdb01amq/ifdb01amq_flt.fits ...
 [Done]
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:HST/product/ifdb01anq_raw.fits to ./mastDownload/HST/ifdb01anq/ifdb01anq_raw.fits ...
 [Done]

3.1 Create Data Directories and Organize#

Below, we define the current working directory, cwd, and create directories, g102/, f105w/, and output/, that will be used
throughout the notebook. After the directories are created, we move the downloaded RAW and FLT files into them.

cwd = os.getcwd()
print(f'The current directory is: {cwd}')
The current directory is: /home/runner/work/hst_notebooks/hst_notebooks/notebooks/WFC3/slitlessutils_IR_extraction
dirs = [GRATING.lower(), FILTER.lower(), 'output']
for dirr in dirs:
    if os.path.isdir(dirr):
        print(f'Removing {dirr}/')
        shutil.rmtree(dirr)
    print(f'Creating {dirr}/')
    os.mkdir(dirr) 
Removing g102/
Creating g102/
Removing f105w/
Creating f105w/
Removing output/
Creating output/
for filt in DATASETS.keys():
    dst = filt.lower()
    for file in DATASETS[filt]:
        src = glob.glob(file+'*.fits')[0]
        print(f"Moving {src} to {dst}/")
        shutil.move(src, dst)
Moving ifdb01ahq_raw.fits to g102/
Moving ifdb01akq_raw.fits to g102/
Moving ifdb01anq_raw.fits to g102/
Moving ifdb01agq_flt.fits to f105w/
Moving ifdb01ajq_flt.fits to f105w/
Moving ifdb01amq_flt.fits to f105w/

4. Calibrate Data#

4.1 Run WFC3 Backsub on Grism Data#

When working with WFC3/IR grism data (G102 and/or G141), we highly advise that you consider using the WFC3 Backsub program
to process the RAW files into calibrated FLT files. The G102 and G141 background sky signal is both variable and made up of multiple
components, and the WFC3 calibration pipeline, calwf3, and slitlessutils do not have the capability to model and remove
this dispersed 2D background. WFC3 Backsub is designed specifically to assess the level of each of the three components (zodiacal,
1.083 μm HeI emission, and scattered) and remove the signal during calibration. The back_sub.py program still relies on and uses
calwf3 for calibration (e.g. bias correction and dark subtraction), but it employs custom reference files to measure and remove
the multiple sky components before the final “up-the-ramp” fitting occurs in calwf3.

WFC3 Backsub was originally written by Dr. Norbert Pirzkal (at STScI) for his scientific work with the Faint Infrared Grism Survey. The
original code is still hosted on Dr. Pirzkal’s personal GitHub repository; with his permission, we have adapted it, updating syntax and
procedures as needed to be compatible with the slitlessutils cookbook environment. This updated version of WFC3 Backsub and
the required reference files are hosted on Box. In the cell below, we download and extract the WFC3_Backsub/ directory from the Box
folder. A description of the three background components and the methods used in WFC3 Backsub can be found in WFC3 ISR 2020-04
(Pirzkal & Ryan). For more information on WFC3 IR calibration as well as the IR variable background, please see Chapter 3 and Chapter 7
of the WFC3 Data Handbook.

First, we will download all the Backsub files into a new directory called WFC3_Backsub/.

backsub_url = "https://stsci.box.com/shared/static/im9k7or0af8wz0mscn4ecchqqr75knfz.gz"
backsub_folder = "./WFC3_Backsub"

def download_WFC3_Backsub(url, timeout=120):
    filename = url.split("/")[-1]
    response = requests.get(url, stream=True, timeout=timeout)
    response.raise_for_status()
    with open(filename, "wb") as f:
        for chunk in response.iter_content(chunk_size=8192):
            f.write(chunk)
    return filename

if not os.path.exists(backsub_folder):
    backsub_file = download_WFC3_Backsub(backsub_url)
    with tarfile.open(backsub_file, 'r:gz') as tf:
        tf.extractall('.')

Next, we will copy the back_sub.py file and the custom reference files over to the g102/ directory.

# src = '/path/to/your/WFC3_Backsub/back_sub.py'
src = './WFC3_Backsub/back_sub.py'
dst = f'{GRATING.lower()}/'
cl1 = shutil.copy2(src, dst)

# src = '/path/to/your/WFC3_Backsub/backsub_data/'
src = './WFC3_Backsub/backsub_data/'
dst = f'{GRATING.lower()}/backsub_data/'
cl2 = shutil.copytree(src, dst, dirs_exist_ok=False)

The back_sub.py routine, which also runs calwf3, needs access to certain pipeline reference files; we need to set environment variables.
Note, if your environment already has these variables defined, you may skip the cell below.

os.environ['CRDS_SERVER_URL'] = 'https://hst-crds.stsci.edu'
os.environ['CRDS_SERVER'] = 'https://hst-crds.stsci.edu'
os.environ['CRDS_PATH'] = 'crds_cache'
os.environ['iref'] = 'crds_cache/references/hst/wfc3/'

Now we can change directories over to g102/ and call back_sub from the command line with os.system.

os.chdir(f'{GRATING.lower()}')

# set backsub arguments for command line call
grism = GRATING # Filters to process, G102, G141, or Both (default)
ipppss = 'All' # Rootnames to process, 'ipppssoot' or 'All' (default)
grey_flat = True # Set to False if pflat flat-fielding is not wanted for final FLT file

# create command line call and run backsub
cl_input = f"python back_sub.py '*_raw.fits'  --grism={grism} --ipppss={ipppss} --grey_flat={grey_flat}"
cl = os.system(cl_input)
if cl != 0:
    print("Backsub program did not execute properly.")
    print("Be sure `back_sub.py`, `backsub_data/`, and raw grism files are all in the same directory.")
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfpc2_wf4tfile_0250.rmap         678 bytes  (1 / 142 files) (0 / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfpc2_shadfile_0250.rmap         977 bytes  (2 / 142 files) (678 / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfpc2_offtab_0250.rmap           642 bytes  (3 / 142 files) (1.7 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfpc2_maskfile_0250.rmap         685 bytes  (4 / 142 files) (2.3 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfpc2_idctab_0250.rmap           696 bytes  (5 / 142 files) (3.0 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfpc2_flatfile_0250.rmap      30.0 K bytes  (6 / 142 files) (3.7 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfpc2_dgeofile_0250.rmap         801 bytes  (7 / 142 files) (33.7 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfpc2_darkfile_0250.rmap     178.4 K bytes  (8 / 142 files) (34.5 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfpc2_biasfile_0250.rmap       3.3 K bytes  (9 / 142 files) (212.8 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfpc2_atodfile_0250.rmap         874 bytes  (10 / 142 files) (216.1 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfpc2_0250.imap                  782 bytes  (11 / 142 files) (217.0 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_snkcfile_0003.rmap          681 bytes  (12 / 142 files) (217.8 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_satufile_0004.rmap        1.0 K bytes  (13 / 142 files) (218.5 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_pfltfile_0253.rmap       34.2 K bytes  (14 / 142 files) (219.5 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_pctetab_0004.rmap           698 bytes  (15 / 142 files) (253.7 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_oscntab_0250.rmap           747 bytes  (16 / 142 files) (254.4 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_npolfile_0254.rmap        4.0 K bytes  (17 / 142 files) (255.1 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_nlinfile_0252.rmap          698 bytes  (18 / 142 files) (259.2 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_mdriztab_0254.rmap          845 bytes  (19 / 142 files) (259.9 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_imphttab_0257.rmap          683 bytes  (20 / 142 files) (260.7 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_idctab_0254.rmap            661 bytes  (21 / 142 files) (261.4 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_flshfile_0257.rmap        6.0 K bytes  (22 / 142 files) (262.1 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_drkcfile_0214.rmap      260.0 K bytes  (23 / 142 files) (268.0 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_dfltfile_0002.rmap       17.1 K bytes  (24 / 142 files) (528.0 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_darkfile_0514.rmap      307.3 K bytes  (25 / 142 files) (545.2 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_d2imfile_0251.rmap          605 bytes  (26 / 142 files) (852.5 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_crrejtab_0250.rmap          803 bytes  (27 / 142 files) (853.1 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_ccdtab_0250.rmap            799 bytes  (28 / 142 files) (853.9 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_bpixtab_0334.rmap        12.9 K bytes  (29 / 142 files) (854.7 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_biasfile_0269.rmap       24.2 K bytes  (30 / 142 files) (867.6 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_biacfile_0003.rmap          692 bytes  (31 / 142 files) (891.8 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_atodtab_0250.rmap           651 bytes  (32 / 142 files) (892.5 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_wfc3_0647.imap                 1.3 K bytes  (33 / 142 files) (893.2 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_synphot_tmttab_0002.rmap         745 bytes  (34 / 142 files) (894.5 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_synphot_tmgtab_0013.rmap         767 bytes  (35 / 142 files) (895.2 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_synphot_tmctab_0066.rmap         743 bytes  (36 / 142 files) (896.0 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_synphot_thruput_0072.rmap    332.2 K bytes  (37 / 142 files) (896.7 K / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_synphot_thermal_0003.rmap     20.4 K bytes  (38 / 142 files) (1.2 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_synphot_obsmodes_0004.rmap       743 bytes  (39 / 142 files) (1.2 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_synphot_0082.imap                579 bytes  (40 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_xtractab_0250.rmap          815 bytes  (41 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_wcptab_0251.rmap            578 bytes  (42 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_teltab_0250.rmap            745 bytes  (43 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_tdstab_0256.rmap            921 bytes  (44 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_tdctab_0253.rmap            650 bytes  (45 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_srwtab_0250.rmap            745 bytes  (46 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_sptrctab_0251.rmap          895 bytes  (47 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_sdctab_0251.rmap            889 bytes  (48 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_riptab_0254.rmap            877 bytes  (49 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_phottab_0259.rmap         1.6 K bytes  (50 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_pfltfile_0250.rmap       23.7 K bytes  (51 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_pctab_0250.rmap           3.1 K bytes  (52 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_mofftab_0250.rmap           747 bytes  (53 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_mlintab_0250.rmap           601 bytes  (54 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_lfltfile_0250.rmap       11.8 K bytes  (55 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_lamptab_0250.rmap           610 bytes  (56 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_inangtab_0250.rmap          815 bytes  (57 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_imphttab_0253.rmap          616 bytes  (58 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_idctab_0251.rmap            775 bytes  (59 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_halotab_0250.rmap           747 bytes  (60 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_gactab_0250.rmap            651 bytes  (61 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_exstab_0250.rmap            745 bytes  (62 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_echsctab_0250.rmap          749 bytes  (63 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_disptab_0250.rmap           813 bytes  (64 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_darkfile_0375.rmap       64.7 K bytes  (65 / 142 files) (1.3 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_crrejtab_0250.rmap          711 bytes  (66 / 142 files) (1.4 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_cdstab_0250.rmap            745 bytes  (67 / 142 files) (1.4 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_ccdtab_0252.rmap            893 bytes  (68 / 142 files) (1.4 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_bpixtab_0250.rmap           845 bytes  (69 / 142 files) (1.4 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_biasfile_0376.rmap      126.9 K bytes  (70 / 142 files) (1.4 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_apertab_0250.rmap           588 bytes  (71 / 142 files) (1.5 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_apdestab_0252.rmap          636 bytes  (72 / 142 files) (1.5 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_stis_0396.imap                 1.7 K bytes  (73 / 142 files) (1.5 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_nicmos_zprattab_0250.rmap        646 bytes  (74 / 142 files) (1.5 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_nicmos_tempfile_0250.rmap      1.1 K bytes  (75 / 142 files) (1.5 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_nicmos_tdffile_0250.rmap       8.9 K bytes  (76 / 142 files) (1.5 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_nicmos_saadfile_0250.rmap        771 bytes  (77 / 142 files) (1.5 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_nicmos_saacntab_0250.rmap        594 bytes  (78 / 142 files) (1.5 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_nicmos_rnlcortb_0250.rmap        771 bytes  (79 / 142 files) (1.5 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_nicmos_pmskfile_0250.rmap        603 bytes  (80 / 142 files) (1.5 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_nicmos_pmodfile_0250.rmap        603 bytes  (81 / 142 files) (1.5 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_nicmos_phottab_0250.rmap         862 bytes  (82 / 142 files) (1.5 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_nicmos_pedsbtab_0250.rmap        594 bytes  (83 / 142 files) (1.5 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_nicmos_noisfile_0250.rmap      2.6 K bytes  (84 / 142 files) (1.5 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_nicmos_nlinfile_0250.rmap      1.7 K bytes  (85 / 142 files) (1.5 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_nicmos_maskfile_0250.rmap      1.2 K bytes  (86 / 142 files) (1.5 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_nicmos_illmfile_0250.rmap      5.8 K bytes  (87 / 142 files) (1.5 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_nicmos_idctab_0250.rmap          767 bytes  (88 / 142 files) (1.5 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_nicmos_flatfile_0250.rmap     11.0 K bytes  (89 / 142 files) (1.5 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_nicmos_darkfile_0250.rmap     14.9 K bytes  (90 / 142 files) (1.5 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_nicmos_0250.imap               1.1 K bytes  (91 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_ywlkfile_0004.rmap           922 bytes  (92 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_xwlkfile_0003.rmap           922 bytes  (93 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_xtractab_0274.rmap         1.9 K bytes  (94 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_wcptab_0262.rmap           1.2 K bytes  (95 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_twozxtab_0285.rmap         1.5 K bytes  (96 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_tracetab_0283.rmap         1.5 K bytes  (97 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_tdstab_0274.rmap             749 bytes  (98 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_spwcstab_0255.rmap         1.1 K bytes  (99 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_spottab_0008.rmap            766 bytes  (100 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_proftab_0283.rmap          1.5 K bytes  (101 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_phatab_0250.rmap             668 bytes  (102 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_lamptab_0271.rmap          1.7 K bytes  (103 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_hvtab_0259.rmap              567 bytes  (104 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_hvdstab_0003.rmap          1.0 K bytes  (105 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_gsagtab_0263.rmap            603 bytes  (106 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_geofile_0251.rmap            640 bytes  (107 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_fluxtab_0292.rmap          1.8 K bytes  (108 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_flatfile_0270.rmap         2.3 K bytes  (109 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_disptab_0282.rmap          1.8 K bytes  (110 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_dgeofile_0003.rmap           909 bytes  (111 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_deadtab_0250.rmap            711 bytes  (112 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_brsttab_0250.rmap            696 bytes  (113 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_brftab_0251.rmap             583 bytes  (114 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_bpixtab_0261.rmap            773 bytes  (115 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_badttab_0252.rmap            643 bytes  (116 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_cos_0377.imap                  1.4 K bytes  (117 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_spottab_0251.rmap            641 bytes  (118 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_snkcfile_0119.rmap         8.5 K bytes  (119 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_shadfile_0251.rmap           531 bytes  (120 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_satufile_0002.rmap         1.2 K bytes  (121 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_pfltfile_0253.rmap        69.2 K bytes  (122 / 142 files) (1.6 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_pctetab_0254.rmap            615 bytes  (123 / 142 files) (1.7 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_oscntab_0251.rmap            781 bytes  (124 / 142 files) (1.7 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_npolfile_0253.rmap         3.2 K bytes  (125 / 142 files) (1.7 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_mlintab_0250.rmap            646 bytes  (126 / 142 files) (1.7 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_mdriztab_0253.rmap           769 bytes  (127 / 142 files) (1.7 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_imphttab_0262.rmap           769 bytes  (128 / 142 files) (1.7 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_idctab_0256.rmap           1.5 K bytes  (129 / 142 files) (1.7 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_flshfile_0271.rmap         3.5 K bytes  (130 / 142 files) (1.7 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_drkcfile_0472.rmap        16.0 K bytes  (131 / 142 files) (1.7 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_dgeofile_0250.rmap         3.2 K bytes  (132 / 142 files) (1.7 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_darkfile_0462.rmap        88.0 K bytes  (133 / 142 files) (1.7 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_d2imfile_0253.rmap           601 bytes  (134 / 142 files) (1.8 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_crrejtab_0251.rmap           945 bytes  (135 / 142 files) (1.8 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_cfltfile_0250.rmap         1.2 K bytes  (136 / 142 files) (1.8 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_ccdtab_0256.rmap           1.4 K bytes  (137 / 142 files) (1.8 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_bpixtab_0253.rmap          1.1 K bytes  (138 / 142 files) (1.8 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_biasfile_0459.rmap        58.1 K bytes  (139 / 142 files) (1.8 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_atodtab_0251.rmap            528 bytes  (140 / 142 files) (1.8 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_acs_0570.imap                  1.3 K bytes  (141 / 142 files) (1.8 M / 1.9 M bytes)
CRDS - INFO -  Fetching  crds_cache/mappings/hst/hst_1323.pmap                        495 bytes  (142 / 142 files) (1.9 M / 1.9 M bytes)
CRDS - INFO -  No comparison context or source comparison requested.
CRDS - INFO -  ===> Processing ifdb01akq_raw.fits
CRDS - INFO -  Fetching  crds_cache/references/hst/wfc3/3562021pi_mdz.fits         40.3 K bytes  (1 / 10 files) (0 / 394.3 M bytes)
CRDS - INFO -  Fetching  crds_cache/references/hst/wfc3/8ch15233i_imp.fits         83.5 K bytes  (2 / 10 files) (40.3 K / 394.3 M bytes)
CRDS - INFO -  Fetching  crds_cache/references/hst/wfc3/93718295i_drk.fits        302.6 M bytes  (3 / 10 files) (123.8 K / 394.3 M bytes)
CRDS - INFO -  Fetching  crds_cache/references/hst/wfc3/94119087i_bpx.fits          1.1 M bytes  (4 / 10 files) (302.7 M / 394.3 M bytes)
CRDS - INFO -  Fetching  crds_cache/references/hst/wfc3/a2412448i_lin.fits         79.9 M bytes  (5 / 10 files) (303.8 M / 394.3 M bytes)
CRDS - INFO -  Fetching  crds_cache/references/hst/wfc3/q911321mi_osc.fits         20.2 K bytes  (6 / 10 files) (383.7 M / 394.3 M bytes)
CRDS - INFO -  Fetching  crds_cache/references/hst/wfc3/t2c16200i_ccd.fits         17.3 K bytes  (7 / 10 files) (383.7 M / 394.3 M bytes)
CRDS - INFO -  Fetching  crds_cache/references/hst/wfc3/u4m1335li_pfl.fits         10.5 M bytes  (8 / 10 files) (383.7 M / 394.3 M bytes)
CRDS - INFO -  Fetching  crds_cache/references/hst/wfc3/u6a1748ri_crr.fits         14.4 K bytes  (9 / 10 files) (394.3 M / 394.3 M bytes)
CRDS - INFO -  Fetching  crds_cache/references/hst/wfc3/w3m18525i_idc.fits         20.2 K bytes  (10 / 10 files) (394.3 M / 394.3 M bytes)
CRDS - INFO -  0 errors
CRDS - INFO -  0 warnings
CRDS - INFO -  154 infos
WARNING: VerifyWarning: Card is too long, comment will be truncated. [astropy.io.fits.card]
CRDS - INFO -  No comparison context or source comparison requested.
CRDS - INFO -  ===> Processing ifdb01anq_raw.fits
CRDS - INFO -  0 errors
CRDS - INFO -  0 warnings
CRDS - INFO -  2 infos
WARNING: VerifyWarning: Card is too long, comment will be truncated. [astropy.io.fits.card]
Will look for custom back_sub reference files in  /home/runner/work/hst_notebooks/hst_notebooks/notebooks/WFC3/slitlessutils_IR_extraction/g102/backsub_data/
Will look for standard reference files in  crds_cache/references/hst/wfc3/
args: *_raw.fits True
Loading  /home/runner/work/hst_notebooks/hst_notebooks/notebooks/WFC3/slitlessutils_IR_extraction/g102/backsub_data/G102_Zodi_CLN6_V9_b_clean.fits
Loading  /home/runner/work/hst_notebooks/hst_notebooks/notebooks/WFC3/slitlessutils_IR_extraction/g102/backsub_data/G102_HeI_V9_b_clean.fits
Loading  /home/runner/work/hst_notebooks/hst_notebooks/notebooks/WFC3/slitlessutils_IR_extraction/g102/backsub_data/G102_Scatter_V9_b_superclean.fits
Processing  ifdb01akq_raw.fits
git tag: d11b028b-dirty

git branch: HEAD

HEAD @: d11b028bd316e388903f16e28736fbdb97848a57





CALBEG*** CALWF3 -- Version 3.7.2 (Apr-15-2024) ***

Begin    10-Apr-2026 14:13:50 UTC





Input    ifdb01akq_raw.fits

loading asn



LoadAsn:  Processing SINGLE exposure

Trying to open ifdb01akq_raw.fits...

Read in Primary header from ifdb01akq_raw.fits...

Creating new trailer file `ifdb01akq.tra'.





CALBEG*** WF3IR -- Version 3.7.2 (Apr-15-2024) ***

Begin    10-Apr-2026 14:13:50 UTC

Input    ifdb01akq_raw.fits

Output   ifdb01akq_flt.fits

Trying to open ifdb01akq_raw.fits...

Read in Primary header from ifdb01akq_raw.fits...

APERTURE GRISM1024

FILTER   G102

DETECTOR IR

Reading data from ifdb01akq_raw.fits ...

CCDTAB   iref$t2c16200i_ccd.fits

CCDTAB   PEDIGREE=Ground

CCDTAB   DESCRIP =Reference data based on Thermal-Vac #3, gain=2.5 results for IR-4

CCDTAB   DESCRIP =Readnoise,gain,saturation from TV3,MEB2 values. ISRs 2008-25,39,50

    readnoise =20.2,19.8,19.9,20.1

    gain =2.34,2.37,2.31,2.38

DQICORR  PERFORM

DQITAB   iref$94119087i_bpx.fits

DQITAB   PEDIGREE=INFLIGHT 22/12/2023 21/10/2024

DQITAB   DESCRIP =Bad Pixel Table generated using Cycle 31 Flats and Darks-----------

DQICORR  COMPLETE

ZSIGCORR PERFORM

ZSIGCORR detected 1289 saturated pixels in 0th read

ZSIGCORR detected 1350 saturated pixels in 1st read

ZSIGCORR COMPLETE

BLEVCORR PERFORM

OSCNTAB  iref$q911321mi_osc.fits

OSCNTAB  PEDIGREE=GROUND

OSCNTAB  DESCRIP =Initial values for ground test data processing

BLEVCORR COMPLETE

ZOFFCORR PERFORM

ZOFFCORR COMPLETE

NOISCORR PERFORM

Uncertainty array initialized.

NOISCORR COMPLETE

NLINCORR PERFORM

NLINFILE iref$a2412448i_lin.fits

NLINFILE PEDIGREE=INFLIGHT 29/03/2011 25/11/2012

NLINFILE DESCRIP =Non-linearity, pixel-based correction from WFC3 on-orbit frames

NLINCORR detected 1289 saturated pixels in imset 6

NLINCORR detected 1357 saturated pixels in imset 5

NLINCORR detected 1635 saturated pixels in imset 4

NLINCORR detected 1897 saturated pixels in imset 3

NLINCORR detected 2174 saturated pixels in imset 2

NLINCORR detected 2382 saturated pixels in imset 1

NLINCORR COMPLETE

DARKCORR PERFORM

DARKFILE iref$93718295i_drk.fits

DARKFILE PEDIGREE=INFLIGHT 01/09/2009 10/03/2024

DARKFILE DESCRIP =DARK created from in-flight WFC3/IR frames ------------------------

DARKCORR using dark imset 16 for imset  6 with exptime=       0

DARKCORR using dark imset 15 for imset  5 with exptime= 2.93229

DARKCORR using dark imset 14 for imset  4 with exptime= 27.9328

DARKCORR using dark imset 13 for imset  3 with exptime= 52.9333

DARKCORR using dark imset 12 for imset  2 with exptime= 77.9338

DARKCORR using dark imset 11 for imset  1 with exptime= 102.934

DARKCORR COMPLETE

PHOTCORR PERFORM

IMPHTTAB iref$8ch15233i_imp.fits

IMPHTTAB PEDIGREE=INFLIGHT 08/05/2009 01/09/2024

IMPHTTAB DESCRIP =Time-dependent image photometry reference table (IMPHTTAB)---------

Found parameterized variable 1.

NUMPAR=1, N=1

Allocated 1 parnames

Adding parameter mjd#60744.0494 as parnames[0]

==> Value of PHOTFLAM = 3.9978801e-20

==> Value of PHOTPLAM = 9989.8237

==> Value of PHOTBW = 936.39502

PHOTCORR COMPLETE

UNITCORR PERFORM

UNITCORR COMPLETE

CRCORR   OMIT

FLATCORR PERFORM

PFLTFILE tref$uc72113oi_pfl_patched2.fits

PFLTFILE PEDIGREE=INFLIGHT 01/08/2009 30/11/2010

PFLTFILE DESCRIP =Flat-field created from inflight observations (Aug 2009- Nov 2010).

FLATCORR COMPLETE

Writing calibrated readouts to ifdb01akq_ima.fits

Writing final image to ifdb01akq_flt.fits

 with trimx = 5,5, trimy = 5,5





End      10-Apr-2026 14:13:52 UTC

*** WF3IR complete ***





End      10-Apr-2026 14:13:52 UTC

*** CALWF3 complete ***

CALWF3 completion for ifdb01akq_raw.fits

Processing  ifdb01anq_raw.fits
git tag: d11b028b-dirty

git branch: HEAD

HEAD @: d11b028bd316e388903f16e28736fbdb97848a57





CALBEG*** CALWF3 -- Version 3.7.2 (Apr-15-2024) ***

Begin    10-Apr-2026 14:14:05 UTC





Input    ifdb01anq_raw.fits

loading asn



LoadAsn:  Processing SINGLE exposure

Trying to open ifdb01anq_raw.fits...

Read in Primary header from ifdb01anq_raw.fits...

Creating new trailer file `ifdb01anq.tra'.





CALBEG*** WF3IR -- Version 3.7.2 (Apr-15-2024) ***

Begin    10-Apr-2026 14:14:05 UTC

Input    ifdb01anq_raw.fits

Output   ifdb01anq_flt.fits

Trying to open ifdb01anq_raw.fits...

Read in Primary header from ifdb01anq_raw.fits...

APERTURE GRISM1024

FILTER   G102

DETECTOR IR

Reading data from ifdb01anq_raw.fits ...

CCDTAB   iref$t2c16200i_ccd.fits

CCDTAB   PEDIGREE=Ground

CCDTAB   DESCRIP =Reference data based on Thermal-Vac #3, gain=2.5 results for IR-4

CCDTAB   DESCRIP =Readnoise,gain,saturation from TV3,MEB2 values. ISRs 2008-25,39,50

    readnoise =20.2,19.8,19.9,20.1

    gain =2.34,2.37,2.31,2.38

DQICORR  PERFORM

DQITAB   iref$94119087i_bpx.fits

DQITAB   PEDIGREE=INFLIGHT 22/12/2023 21/10/2024

DQITAB   DESCRIP =Bad Pixel Table generated using Cycle 31 Flats and Darks-----------

DQICORR  COMPLETE

ZSIGCORR PERFORM

ZSIGCORR detected 1289 saturated pixels in 0th read

ZSIGCORR detected 1360 saturated pixels in 1st read

ZSIGCORR COMPLETE

BLEVCORR PERFORM

OSCNTAB  iref$q911321mi_osc.fits

OSCNTAB  PEDIGREE=GROUND

OSCNTAB  DESCRIP =Initial values for ground test data processing

BLEVCORR COMPLETE

ZOFFCORR PERFORM

ZOFFCORR COMPLETE

NOISCORR PERFORM

Uncertainty array initialized.

NOISCORR COMPLETE

NLINCORR PERFORM

NLINFILE iref$a2412448i_lin.fits

NLINFILE PEDIGREE=INFLIGHT 29/03/2011 25/11/2012

NLINFILE DESCRIP =Non-linearity, pixel-based correction from WFC3 on-orbit frames

NLINCORR detected 1289 saturated pixels in imset 6

NLINCORR detected 1370 saturated pixels in imset 5

NLINCORR detected 1841 saturated pixels in imset 4

NLINCORR detected 2151 saturated pixels in imset 3

NLINCORR detected 2347 saturated pixels in imset 2

NLINCORR detected 2511 saturated pixels in imset 1

NLINCORR COMPLETE

DARKCORR PERFORM

DARKFILE iref$93718295i_drk.fits

DARKFILE PEDIGREE=INFLIGHT 01/09/2009 10/03/2024

DARKFILE DESCRIP =DARK created from in-flight WFC3/IR frames ------------------------

DARKCORR using dark imset 16 for imset  6 with exptime=       0

DARKCORR using dark imset 15 for imset  5 with exptime= 2.93229

DARKCORR using dark imset 14 for imset  4 with exptime= 27.9328

DARKCORR using dark imset 13 for imset  3 with exptime= 52.9333

DARKCORR using dark imset 12 for imset  2 with exptime= 77.9338

DARKCORR using dark imset 11 for imset  1 with exptime= 102.934

DARKCORR COMPLETE

PHOTCORR PERFORM

IMPHTTAB iref$8ch15233i_imp.fits

IMPHTTAB PEDIGREE=INFLIGHT 08/05/2009 01/09/2024

IMPHTTAB DESCRIP =Time-dependent image photometry reference table (IMPHTTAB)---------

Found parameterized variable 1.

NUMPAR=1, N=1

Allocated 1 parnames

Adding parameter mjd#60744.0524 as parnames[0]

==> Value of PHOTFLAM = 3.9978801e-20

==> Value of PHOTPLAM = 9989.8237

==> Value of PHOTBW = 936.39502

PHOTCORR COMPLETE

UNITCORR PERFORM

UNITCORR COMPLETE

CRCORR   OMIT

FLATCORR PERFORM

PFLTFILE tref$uc72113oi_pfl_patched2.fits

PFLTFILE PEDIGREE=INFLIGHT 01/08/2009 30/11/2010

PFLTFILE DESCRIP =Flat-field created from inflight observations (Aug 2009- Nov 2010).

FLATCORR COMPLETE

Writing calibrated readouts to ifdb01anq_ima.fits

Writing final image to ifdb01anq_flt.fits

 with trimx = 5,5, trimy = 5,5





End      10-Apr-2026 14:14:06 UTC

*** WF3IR complete ***





End      10-Apr-2026 14:14:06 UTC
CRDS - INFO -  No comparison context or source comparison requested.
CRDS - INFO -  ===> Processing ifdb01ahq_raw.fits
CRDS - INFO -  0 errors
CRDS - INFO -  0 warnings
CRDS - INFO -  2 infos
WARNING: VerifyWarning: Card is too long, comment will be truncated. [astropy.io.fits.card]
*** CALWF3 complete ***

CALWF3 completion for ifdb01anq_raw.fits

Processing  ifdb01ahq_raw.fits
git tag: d11b028b-dirty

git branch: HEAD

HEAD @: d11b028bd316e388903f16e28736fbdb97848a57





CALBEG*** CALWF3 -- Version 3.7.2 (Apr-15-2024) ***

Begin    10-Apr-2026 14:14:18 UTC





Input    ifdb01ahq_raw.fits

loading asn



LoadAsn:  Processing SINGLE exposure

Trying to open ifdb01ahq_raw.fits...

Read in Primary header from ifdb01ahq_raw.fits...

Creating new trailer file `ifdb01ahq.tra'.





CALBEG*** WF3IR -- Version 3.7.2 (Apr-15-2024) ***

Begin    10-Apr-2026 14:14:18 UTC

Input    ifdb01ahq_raw.fits

Output   ifdb01ahq_flt.fits

Trying to open ifdb01ahq_raw.fits...

Read in Primary header from ifdb01ahq_raw.fits...

APERTURE GRISM1024

FILTER   G102

DETECTOR IR

Reading data from ifdb01ahq_raw.fits ...

CCDTAB   iref$t2c16200i_ccd.fits

CCDTAB   PEDIGREE=Ground

CCDTAB   DESCRIP =Reference data based on Thermal-Vac #3, gain=2.5 results for IR-4

CCDTAB   DESCRIP =Readnoise,gain,saturation from TV3,MEB2 values. ISRs 2008-25,39,50

    readnoise =20.2,19.8,19.9,20.1

    gain =2.34,2.37,2.31,2.38

DQICORR  PERFORM

DQITAB   iref$94119087i_bpx.fits

DQITAB   PEDIGREE=INFLIGHT 22/12/2023 21/10/2024

DQITAB   DESCRIP =Bad Pixel Table generated using Cycle 31 Flats and Darks-----------

DQICORR  COMPLETE

ZSIGCORR PERFORM

ZSIGCORR detected 1290 saturated pixels in 0th read

ZSIGCORR detected 1352 saturated pixels in 1st read

ZSIGCORR COMPLETE

BLEVCORR PERFORM

OSCNTAB  iref$q911321mi_osc.fits

OSCNTAB  PEDIGREE=GROUND

OSCNTAB  DESCRIP =Initial values for ground test data processing

BLEVCORR COMPLETE

ZOFFCORR PERFORM

ZOFFCORR COMPLETE

NOISCORR PERFORM

Uncertainty array initialized.

NOISCORR COMPLETE

NLINCORR PERFORM

NLINFILE iref$a2412448i_lin.fits

NLINFILE PEDIGREE=INFLIGHT 29/03/2011 25/11/2012

NLINFILE DESCRIP =Non-linearity, pixel-based correction from WFC3 on-orbit frames

NLINCORR detected 1290 saturated pixels in imset 6

NLINCORR detected 1358 saturated pixels in imset 5

NLINCORR detected 1576 saturated pixels in imset 4

NLINCORR detected 1806 saturated pixels in imset 3

NLINCORR detected 2016 saturated pixels in imset 2

NLINCORR detected 2174 saturated pixels in imset 1

NLINCORR COMPLETE

DARKCORR PERFORM

DARKFILE iref$93718295i_drk.fits

DARKFILE PEDIGREE=INFLIGHT 01/09/2009 10/03/2024

DARKFILE DESCRIP =DARK created from in-flight WFC3/IR frames ------------------------

DARKCORR using dark imset 16 for imset  6 with exptime=       0

DARKCORR using dark imset 15 for imset  5 with exptime= 2.93229

DARKCORR using dark imset 14 for imset  4 with exptime= 27.9328

DARKCORR using dark imset 13 for imset  3 with exptime= 52.9333

DARKCORR using dark imset 12 for imset  2 with exptime= 77.9338

DARKCORR using dark imset 11 for imset  1 with exptime= 102.934

DARKCORR COMPLETE

PHOTCORR PERFORM

IMPHTTAB iref$8ch15233i_imp.fits

IMPHTTAB PEDIGREE=INFLIGHT 08/05/2009 01/09/2024

IMPHTTAB DESCRIP =Time-dependent image photometry reference table (IMPHTTAB)---------

Found parameterized variable 1.

NUMPAR=1, N=1

Allocated 1 parnames

Adding parameter mjd#60744.0465 as parnames[0]

==> Value of PHOTFLAM = 3.9978801e-20

==> Value of PHOTPLAM = 9989.8237

==> Value of PHOTBW = 936.39502

PHOTCORR COMPLETE

UNITCORR PERFORM

UNITCORR COMPLETE

CRCORR   OMIT

FLATCORR PERFORM

PFLTFILE tref$uc72113oi_pfl_patched2.fits

PFLTFILE PEDIGREE=INFLIGHT 01/08/2009 30/11/2010

PFLTFILE DESCRIP =Flat-field created from inflight observations (Aug 2009- Nov 2010).

FLATCORR COMPLETE

Writing calibrated readouts to ifdb01ahq_ima.fits

Writing final image to ifdb01ahq_flt.fits

 with trimx = 5,5, trimy = 5,5





End      10-Apr-2026 14:14:20 UTC

*** WF3IR complete ***





End      10-Apr-2026 14:14:20 UTC

*** CALWF3 complete ***

CALWF3 completion for ifdb01ahq_raw.fits

We are solving for  37  HeI values
name: ifdb01akq_ima.fits imset: 1 0
name: ifdb01akq_ima.fits imset: 2 1
name: ifdb01akq_ima.fits imset: 3 2
name: ifdb01akq_ima.fits imset: 4 3
name: ifdb01akq_ima.fits imset: 5 4
name: ifdb01anq_ima.fits imset: 1 5
name: ifdb01anq_ima.fits imset: 2 6
name: ifdb01anq_ima.fits imset: 3 7
name: ifdb01anq_ima.fits imset: 4 8
name: ifdb01anq_ima.fits imset: 5 9
name: ifdb01ahq_ima.fits imset: 1 10
name: ifdb01ahq_ima.fits imset: 2 11
name: ifdb01ahq_ima.fits imset: 3 12
name: ifdb01ahq_ima.fits imset: 4 13
name: ifdb01ahq_ima.fits imset: 5 14
ifdb01akq_ima.fits 0 Zodi: 1.576  He: 0.261 S: 0.010
ifdb01akq_ima.fits 1 Zodi: 1.576  He: 0.241 S: 0.016
ifdb01akq_ima.fits 2 Zodi: 1.576  He: 0.208 S: 0.016
ifdb01akq_ima.fits 3 Zodi: 1.576  He: 0.184 S: 0.012
ifdb01akq_ima.fits 4 Zodi: 1.576  He: 0.014 S: 0.173
ifdb01anq_ima.fits 0 Zodi: 1.576  He: 0.841 S: 0.023
ifdb01anq_ima.fits 1 Zodi: 1.576  He: 0.808 S: 0.012
ifdb01anq_ima.fits 2 Zodi: 1.576  He: 0.796 S: 0.023
ifdb01anq_ima.fits 3 Zodi: 1.576  He: 0.738 S: 0.019
ifdb01anq_ima.fits 4 Zodi: 1.576  He: 0.863 S: -0.205
ifdb01ahq_ima.fits 0 Zodi: 1.576  He: 0.106 S: 0.008
ifdb01ahq_ima.fits 1 Zodi: 1.576  He: 0.098 S: 0.008
ifdb01ahq_ima.fits 2 Zodi: 1.576  He: 0.080 S: 0.013
ifdb01ahq_ima.fits 3 Zodi: 1.576  He: 0.066 S: 0.008
ifdb01ahq_ima.fits 4 Zodi: 1.576  He: 0.030 S: 0.074
Updating  ifdb01akq_ima.fits
EXTVER: 1
"Keyword 'HEI' not found."
IMSET: 1 subtracting 0.2611124473006997 0.010367562827087924
Before: 2.2317572
After: 1.9662445
EXTVER: 2
"Keyword 'HEI' not found."
IMSET: 2 subtracting 0.24094553191530443 0.01637360681921761
Before: 2.2417922
After: 1.9930539
EXTVER: 3
"Keyword 'HEI' not found."
IMSET: 3 subtracting 0.20785260260449837 0.015850297538126303
Before: 2.263639
After: 2.048389
EXTVER: 4
"Keyword 'HEI' not found."
IMSET: 4 subtracting 0.18420418942108324 0.011799717007907736
Before: 2.3491688
After: 2.1595306
EXTVER: 5
"Keyword 'HEI' not found."
IMSET: 5 subtracting 0.01426925256347534 0.17294429655387397
Before: 2.8473988
After: 2.738259
Updating  ifdb01anq_ima.fits
EXTVER: 1
"Keyword 'HEI' not found."
IMSET: 1 subtracting 0.8414235092762203 0.02289740534199387
Before: 2.8159852
After: 1.9652886
EXTVER: 2
"Keyword 'HEI' not found."
IMSET: 2 subtracting 0.8076935660290765 0.0120889312633273
Before: 2.8070683
After: 1.9956188
EXTVER: 3
"Keyword 'HEI' not found."
IMSET: 3 subtracting 0.7959709914522425 0.022709994193577197
Before: 2.8403163
After: 2.0354233
EXTVER: 4
"Keyword 'HEI' not found."
IMSET: 4 subtracting 0.737572850276199 0.019396992731556314
Before: 2.900596
After: 2.1561651
EXTVER: 5
"Keyword 'HEI' not found."
IMSET: 5 subtracting 0.8632309747106929 -0.20519939719056515
Before: 3.3753328
After: 2.6269002
Updating  ifdb01ahq_ima.fits
EXTVER: 1
"Keyword 'HEI' not found."
IMSET: 1 subtracting 0.10610746791468902 0.008449363139518263
Before: 2.0809832
After: 1.9708562
EXTVER: 2
"Keyword 'HEI' not found."
IMSET: 2 subtracting 0.0977937200190828 0.008070180161463228
Before: 2.1005442
After: 1.9989771
EXTVER: 3
"Keyword 'HEI' not found."
IMSET: 3 subtracting 0.07972496508239975 0.012943975136970175
Before: 2.1398077
After: 2.0535574
EXTVER: 4
"Keyword 'HEI' not found."
IMSET: 4 subtracting 0.0664560927518591 0.007713865165760435
Before: 2.2260542
After: 2.1558354
EXTVER: 5
"Keyword 'HEI' not found."
IMSET: 5 subtracting 0.030071995048578017 0.07371140005670189
Before: 2.718834
After: 2.650334
git tag: d11b028b-dirty

git branch: HEAD

HEAD @: d11b028bd316e388903f16e28736fbdb97848a57

Creating new trailer file `ifdb01akq_ima.tra'.





CALBEG*** WF3IR -- Version 3.7.2 (Apr-15-2024) ***

Begin    10-Apr-2026 14:14:24 UTC

Input    ifdb01akq_ima.fits

Output   ifdb01akq_ima_flt.fits

Trying to open ifdb01akq_ima.fits...

Read in Primary header from ifdb01akq_ima.fits...

APERTURE GRISM1024

FILTER   G102

DETECTOR IR

Reading data from ifdb01akq_ima.fits ...

CCDTAB   iref$t2c16200i_ccd.fits

CCDTAB   PEDIGREE=Ground

CCDTAB   DESCRIP =Reference data based on Thermal-Vac #3, gain=2.5 results for IR-4

CCDTAB   DESCRIP =Readnoise,gain,saturation from TV3,MEB2 values. ISRs 2008-25,39,50

    readnoise =20.2,19.8,19.9,20.1

    gain =2.34,2.37,2.31,2.38

DQICORR  COMPLETE

ZSIGCORR COMPLETE

BLEVCORR COMPLETE

ZOFFCORR COMPLETE

NOISCORR PERFORM

NOISCORR SKIPPED
NLINCORR COMPLETE

DARKCORR COMPLETE

PHOTCORR COMPLETE

UNITCORR COMPLETE

CRCORR   PERFORM

CRREJTAB iref$u6a1748ri_crr.fits

CRIDCALC using 4 sigma rejection threshold

               256 bad DQ mask

               4 max CRs for UNSTABLE

CRCORR   COMPLETE

FLATCORR COMPLETE

Writing calibrated readouts to ifdb01akq_ima_ima.fits

Writing final image to ifdb01akq_ima_flt.fits

 with trimx = 5,5, trimy = 5,5





End      10-Apr-2026 14:14:24 UTC

*** WF3IR complete ***

git tag: d11b028b-dirty

git branch: HEAD

HEAD @: d11b028bd316e388903f16e28736fbdb97848a57

Creating new trailer file `ifdb01anq_ima.tra'.





CALBEG*** WF3IR -- Version 3.7.2 (Apr-15-2024) ***

Begin    10-Apr-2026 14:14:24 UTC

Input    ifdb01anq_ima.fits

Output   ifdb01anq_ima_flt.fits

Trying to open ifdb01anq_ima.fits...

Read in Primary header from ifdb01anq_ima.fits...

APERTURE GRISM1024

FILTER   G102

DETECTOR IR

Reading data from ifdb01anq_ima.fits ...

CCDTAB   iref$t2c16200i_ccd.fits

CCDTAB   PEDIGREE=Ground

CCDTAB   DESCRIP =Reference data based on Thermal-Vac #3, gain=2.5 results for IR-4

CCDTAB   DESCRIP =Readnoise,gain,saturation from TV3,MEB2 values. ISRs 2008-25,39,50

    readnoise =20.2,19.8,19.9,20.1

    gain =2.34,2.37,2.31,2.38

DQICORR  COMPLETE

ZSIGCORR COMPLETE

BLEVCORR COMPLETE

ZOFFCORR COMPLETE

NOISCORR PERFORM

NOISCORR SKIPPED

NLINCORR COMPLETE

DARKCORR COMPLETE

PHOTCORR COMPLETE

UNITCORR COMPLETE

CRCORR   PERFORM

CRREJTAB iref$u6a1748ri_crr.fits

CRIDCALC using 4 sigma rejection threshold

               256 bad DQ mask

               4 max CRs for UNSTABLE

CRCORR   COMPLETE

FLATCORR COMPLETE

Writing calibrated readouts to ifdb01anq_ima_ima.fits

Writing final image to ifdb01anq_ima_flt.fits

 with trimx = 5,5, trimy = 5,5





End      10-Apr-2026 14:14:25 UTC

*** WF3IR complete ***

git tag: d11b028b-dirty

git branch: HEAD

HEAD @: d11b028bd316e388903f16e28736fbdb97848a57

Creating new trailer file `ifdb01ahq_ima.tra'.





CALBEG*** WF3IR -- Version 3.7.2 (Apr-15-2024) ***

Begin    10-Apr-2026 14:14:25 UTC

Input    ifdb01ahq_ima.fits

Output   ifdb01ahq_ima_flt.fits

Trying to open ifdb01ahq_ima.fits...

Read in Primary header from ifdb01ahq_ima.fits...

APERTURE GRISM1024

FILTER   G102

DETECTOR IR

Reading data from ifdb01ahq_ima.fits ...

CCDTAB   iref$t2c16200i_ccd.fits

CCDTAB   PEDIGREE=Ground

CCDTAB   DESCRIP =Reference data based on Thermal-Vac #3, gain=2.5 results for IR-4

CCDTAB   DESCRIP =Readnoise,gain,saturation from TV3,MEB2 values. ISRs 2008-25,39,50

    readnoise =20.2,19.8,19.9,20.1

    gain =2.34,2.37,2.31,2.38

DQICORR  COMPLETE

ZSIGCORR COMPLETE

BLEVCORR COMPLETE

ZOFFCORR COMPLETE

NOISCORR PERFORM

NOISCORR SKIPPED

NLINCORR COMPLETE

DARKCORR COMPLETE

PHOTCORR COMPLETE

UNITCORR COMPLETE

CRCORR   PERFORM

CRREJTAB iref$u6a1748ri_crr.fits

CRIDCALC using 4 sigma rejection threshold

               256 bad DQ mask

               4 max CRs for UNSTABLE

CRCORR   COMPLETE

FLATCORR COMPLETE

Writing calibrated readouts to ifdb01ahq_ima_ima.fits

Writing final image to ifdb01ahq_ima_flt.fits

 with trimx = 5,5, trimy = 5,5





End      10-Apr-2026 14:14:26 UTC

*** WF3IR complete ***

"Keyword 'ZODI' not found."
Zodi, Scale 1.5763067273793612
"Keyword 'ZODI' not found."
Zodi, Scale 1.5763067273793612
"Keyword 'ZODI' not found."
Zodi, Scale 1.5763067273793612
AstrometryDB URL: https://mast.stsci.edu/portal/astrometryDB/availability
AstrometryDB service available
- IDCTAB: Distortion model from row 16 for chip 1 : G102
- IDCTAB: Distortion model from row 16 for chip 1 : G102
Updating astrometry for ifdb01akq
Accessing AstrometryDB service :
	https://mast.stsci.edu/portal/astrometryDB/observation/read/ifdb01akq
No solutions found in database for ifdb01akq
Archiving pipeline-default WCS IDC_w3m18525i to ifdb01akq_flt.fits
Writing out pipeline-default WCS IDC_w3m18525i to headerlet file: ifdb01akq_flt_219774_hlet.fits
gsReference service retrieved IFDB01AKQ
....Updating header for ifdb01akq_flt.fits...
WARNING: VerifyWarning: Keyword name 'IDCSCALEO' is greater than 8 characters or contains characters not allowed by the FITS standard; a HIERARCH card will be created. [astropy.io.fits.card]
WARNING: VerifyWarning: Card is too long, comment will be truncated. [astropy.io.fits.card]
Initializing new WCSCORR table for  ifdb01akq_flt.fits
INFO: 
                Inconsistent SIP distortion information is present in the FITS header and the WCS object:
                SIP coefficients were detected, but CTYPE is missing a "-SIP" suffix.
                astropy.wcs is using the SIP distortion coefficients,
                therefore the coordinates calculated here might be incorrect.

                If you do not want to apply the SIP distortion coefficients,
                please remove the SIP coefficients from the FITS header or the
                WCS object.  As an example, if the image is already distortion-corrected
                (e.g., drizzled) then distortion components should not apply and the SIP
                coefficients should be removed.

                While the SIP distortion coefficients are being applied here, if that was indeed the intent,
                for consistency please append "-SIP" to the CTYPE in the FITS header or the WCS object.

                 [astropy.wcs.wcs]
Processing ifdb01akq_flt.fits['SCI',1]
Updating header for ifdb01akq_flt.fits[1]
Archived IDC_w3m18525i-GSC240 in ('SCI', 1)
Appending a priori WCS IDC_w3m18525i-GSC240 to ifdb01akq_flt.fits
Writing out a priori WCS IDC_w3m18525i-GSC240 to headerlet file: ifdb01akq_flt_668208_hlet.fits
AstrometryDB URL: https://mast.stsci.edu/portal/astrometryDB/availability
AstrometryDB service available
- IDCTAB: Distortion model from row 16 for chip 1 : G102
- IDCTAB: Distortion model from row 16 for chip 1 : G102
Updating astrometry for ifdb01anq
Accessing AstrometryDB service :
	https://mast.stsci.edu/portal/astrometryDB/observation/read/ifdb01anq
No solutions found in database for ifdb01anq
Archiving pipeline-default WCS IDC_w3m18525i to ifdb01anq_flt.fits
Writing out pipeline-default WCS IDC_w3m18525i to headerlet file: ifdb01anq_flt_219774_hlet.fits
gsReference service retrieved IFDB01ANQ
....Updating header for ifdb01anq_flt.fits...
Initializing new WCSCORR table for  ifdb01anq_flt.fits
INFO: 
                Inconsistent SIP distortion information is present in the FITS header and the WCS object:
                SIP coefficients were detected, but CTYPE is missing a "-SIP" suffix.
                astropy.wcs is using the SIP distortion coefficients,
                therefore the coordinates calculated here might be incorrect.

                If you do not want to apply the SIP distortion coefficients,
                please remove the SIP coefficients from the FITS header or the
                WCS object.  As an example, if the image is already distortion-corrected
                (e.g., drizzled) then distortion components should not apply and the SIP
                coefficients should be removed.

                While the SIP distortion coefficients are being applied here, if that was indeed the intent,
                for consistency please append "-SIP" to the CTYPE in the FITS header or the WCS object.

                 [astropy.wcs.wcs]
Processing ifdb01anq_flt.fits['SCI',1]
Updating header for ifdb01anq_flt.fits[1]
Archived IDC_w3m18525i-GSC240 in ('SCI', 1)
Appending a priori WCS IDC_w3m18525i-GSC240 to ifdb01anq_flt.fits
Writing out a priori WCS IDC_w3m18525i-GSC240 to headerlet file: ifdb01anq_flt_668208_hlet.fits
AstrometryDB URL: https://mast.stsci.edu/portal/astrometryDB/availability
WARNING: VerifyWarning: Keyword name 'IDCSCALEO' is greater than 8 characters or contains characters not allowed by the FITS standard; a HIERARCH card will be created. [astropy.io.fits.card]
WARNING: VerifyWarning: Card is too long, comment will be truncated. [astropy.io.fits.card]
AstrometryDB service available
- IDCTAB: Distortion model from row 16 for chip 1 : G102
- IDCTAB: Distortion model from row 16 for chip 1 : G102
Updating astrometry for ifdb01ahq
Accessing AstrometryDB service :
	https://mast.stsci.edu/portal/astrometryDB/observation/read/ifdb01ahq
No solutions found in database for ifdb01ahq
Archiving pipeline-default WCS IDC_w3m18525i to ifdb01ahq_flt.fits
Writing out pipeline-default WCS IDC_w3m18525i to headerlet file: ifdb01ahq_flt_219774_hlet.fits
gsReference service retrieved IFDB01AHQ
....Updating header for ifdb01ahq_flt.fits...
WARNING: VerifyWarning: Keyword name 'IDCSCALEO' is greater than 8 characters or contains characters not allowed by the FITS standard; a HIERARCH card will be created. [astropy.io.fits.card]
WARNING: VerifyWarning: Card is too long, comment will be truncated. [astropy.io.fits.card]
Initializing new WCSCORR table for  ifdb01ahq_flt.fits
INFO: 
                Inconsistent SIP distortion information is present in the FITS header and the WCS object:
                SIP coefficients were detected, but CTYPE is missing a "-SIP" suffix.
                astropy.wcs is using the SIP distortion coefficients,
                therefore the coordinates calculated here might be incorrect.

                If you do not want to apply the SIP distortion coefficients,
                please remove the SIP coefficients from the FITS header or the
                WCS object.  As an example, if the image is already distortion-corrected
                (e.g., drizzled) then distortion components should not apply and the SIP
                coefficients should be removed.

                While the SIP distortion coefficients are being applied here, if that was indeed the intent,
                for consistency please append "-SIP" to the CTYPE in the FITS header or the WCS object.

                 [astropy.wcs.wcs]
Processing ifdb01ahq_flt.fits['SCI',1]
Updating header for ifdb01ahq_flt.fits[1]
Archived IDC_w3m18525i-GSC240 in ('SCI', 1)
Appending a priori WCS IDC_w3m18525i-GSC240 to ifdb01ahq_flt.fits
Writing out a priori WCS IDC_w3m18525i-GSC240 to headerlet file: ifdb01ahq_flt_668208_hlet.fits
/home/runner/micromamba/envs/ci-env/lib/python3.12/site-packages/numpy/lib/_nanfunctions_impl.py:1215: RuntimeWarning: All-NaN slice encountered
  return fnb._ureduce(a, func=_nanmedian, keepdims=keepdims,

Here we display one of the G102 images we just calibrated with WFC3 Backsub (and calwf3) to verify it looks as expected.
Note, the grism image of the planetary nebula Vy2-2 shows bright, horizontally extended spectral traces across the detector.
The primary +1 order trace is located near detector coordinates (x, y) ≈ (500, 560) and appears as a bright, horizontally
extended feature. Unlike typical stellar spectra, the trace contains several compact, bright knots corresponding to strong
emission lines, which appear along the dispersion direction. These features are intrinsic to the nebula’s emission-line
spectrum and should not be mistaken for imaging artifacts or additional sources.

fig, axs = plt.subplots(1, 1, figsize=(9, 9))
img = fits.getdata(f'{DATASETS[GRATING][0]}_flt.fits')
z1, z2 = zscale.get_limits(img)
inorm = ImageNormalize(img, vmin=z1, vmax=z2*100, stretch=LogStretch())
im1 = axs.imshow(img, origin='lower', cmap='Greys_r', norm=inorm)
axs.set_title(f'{DATASETS[GRATING][0]}_flt.fits')
fig.colorbar(im1, ax=axs, shrink=0.8).set_label(label='e$^-$ s$^{-1}$', size=12)
plt.show()

4.2 Check the World Coordinate System (WCS)#

It is likely that the active WCS in the direct and grism images differ. Having a consistent astrometric reference for the direct
and grism images is crucial for successful spectral extraction
. In this section, we will investigate the active WCS (header
keyword WCSNAME) and ultimately use slitlessutils to change the WCS of the direct images. We start by using
slitlessutils to display the active WCS of the direct and grism images.

For more information about slitlessutils astrometry, see the documentation. For a more technical and detailed understanding
of HST WCS and improved absolute astrometry please see WFC3 ISR 2022-06 (Mack et al.). A general overview is also available on
Outerspace.

os.chdir(cwd)
su.core.preprocess.astrometry.list_wcs(f'{GRATING.lower()}/i*flt.fits')
su.core.preprocess.astrometry.list_wcs(f'{FILTER.lower()}/i*flt.fits')
 g102/ifdb01anq_flt.fits                     G102
+----------+--------------------------------+--------------------------------+
| WCSVERS  |                              1 |
+----------+--------------------------------+--------------------------------+
| WCSNAME  |           IDC_w3m18525i-GSC240 | 
| WCSNAMEA |                  IDC_w3m18525i | 
| WCSNAMEB |           IDC_w3m18525i-GSC240 | 
| WCSNAMEO |                           OPUS | 
+----------+--------------------------------+--------------------------------+


 g102/ifdb01ahq_flt.fits                     G102
+----------+--------------------------------+--------------------------------+
| WCSVERS  |                              1 |
+----------+--------------------------------+--------------------------------+
| WCSNAME  |           IDC_w3m18525i-GSC240 | 
| WCSNAMEA |                  IDC_w3m18525i | 
| WCSNAMEB |           IDC_w3m18525i-GSC240 | 
| WCSNAMEO |                           OPUS | 
+----------+--------------------------------+--------------------------------+


 g102/ifdb01akq_flt.fits                     G102
+----------+--------------------------------+--------------------------------+
| WCSVERS  |                              1 |
+----------+--------------------------------+--------------------------------+
| WCSNAME  |           IDC_w3m18525i-GSC240 | 
| WCSNAMEA |                  IDC_w3m18525i | 
| WCSNAMEB |           IDC_w3m18525i-GSC240 | 
| WCSNAMEO |                           OPUS | 
+----------+--------------------------------+--------------------------------+


 f105w/ifdb01agq_flt.fits                    F105W
+----------+--------------------------------+--------------------------------+
| WCSVERS  |                              1 |
+----------+--------------------------------+--------------------------------+
| WCSNAME  | IDC_w3m18525i-FIT_IMG_GAIAeDR3 | 
| WCSNAMEA |                  IDC_w3m18525i | 
| WCSNAMEB |         IDC_w3m18525i-GSC240-1 | 
| WCSNAMEO |                           OPUS | 
+----------+--------------------------------+--------------------------------+


 f105w/ifdb01amq_flt.fits                    F105W
+----------+--------------------------------+--------------------------------+
| WCSVERS  |                              1 |
+----------+--------------------------------+--------------------------------+
| WCSNAME  | IDC_w3m18525i-FIT_IMG_GAIAeDR3 | 
| WCSNAMEA |                  IDC_w3m18525i | 
| WCSNAMEB |         IDC_w3m18525i-GSC240-1 | 
| WCSNAMEO |                           OPUS | 
+----------+--------------------------------+--------------------------------+


 f105w/ifdb01ajq_flt.fits                    F105W
+----------+--------------------------------+--------------------------------+
| WCSVERS  |                              1 |
+----------+--------------------------------+--------------------------------+
| WCSNAME  | IDC_w3m18525i-FIT_IMG_GAIAeDR3 | 
| WCSNAMEA |                  IDC_w3m18525i | 
| WCSNAMEB |         IDC_w3m18525i-GSC240-1 | 
| WCSNAMEO |                           OPUS | 
+----------+--------------------------------+--------------------------------+

As shown above, the F105W active WCS (IDC_w3m18525i-FIT_IMG_GAIAeDR3) is different from the G102 active WCS
(IDC_w3m18525i-GSC240). The F105W images have an undistorted a posteriori solution with a WCS that has been matched to
the Gaia Early Data Release 3 (eDR3) reference catalog using stars from the images. ’IMG’ denotes that each FLT exposure was
separately aligned to the reference catalog. The G102 images, on the other hand, have an undistorted a priori solution where
guide star coordinates are corrected from the original reference frame to the Gaia DR1-based Guide Star Catalog v2.4.0 (GSC240).

To fix the discrepancy, we will use slitlessutils to “downgrade” the WCS of the direct images to match the grism images.
The WCS solution we want (IDC_w3m18525i-GSC240) is encoded in the header keyword WCSNAMEB of the F105W images.

direct_imgs = [f'{FILTER.lower()}/{direct}_flt.fits' for direct in DATASETS[FILTER]]
for img in direct_imgs:
    su.core.preprocess.astrometry.downgrade_wcs(img, key='B', inplace=True) # `key` corresponds to WCS in WCSNAMEB
INFO MainProcess> downgrading WCS in f105w/ifdb01agq_flt.fits to WCSNAMEB
INFO MainProcess> downgrading WCS in f105w/ifdb01ajq_flt.fits to WCSNAMEB
INFO MainProcess> downgrading WCS in f105w/ifdb01amq_flt.fits to WCSNAMEB

Finally, we print the active WCS names one last time to verify the upgrade worked as intended.
files = glob.glob(f'{FILTER.lower()}/i*_flt.fits')+glob.glob(f'{GRATING.lower()}/i*_flt.fits')
for f in files:
    print(f, fits.getval(f, 'WCSNAME', ext=1))
f105w/ifdb01agq_flt.fits IDC_w3m18525i-GSC240-1
f105w/ifdb01amq_flt.fits IDC_w3m18525i-GSC240-1
f105w/ifdb01ajq_flt.fits IDC_w3m18525i-GSC240-1
g102/ifdb01anq_flt.fits IDC_w3m18525i-GSC240
g102/ifdb01ahq_flt.fits IDC_w3m18525i-GSC240
g102/ifdb01akq_flt.fits IDC_w3m18525i-GSC240

5. Preprocess the F105W Direct Images#

With the grism data calibrated and a consistent WCS across all images, we can proceed to preprocessing the direct images.
The two main steps we need to complete are (1) drizzling the direct images together and (2) creating a segmentation map.

Information about DrizzlePac can be found on the STScI website, and AstroDrizzle tutorials are hosted in the hst_notebooks
GitHub repo.

def preprocess_direct(datasets, filt, root, scale, ra, dec, rad, telescope, instrument):
    """
    Function to create a drizzle image and segmentation map for direct image data.

    Parameters
    ----------
    datasets : dict
        A dictionary of grism and filter rootnames
    filt : str
        The direct image filter associated with datasets e.g. F200LP
    root : str
        The filename for the drizzle image and seg. map
    scale : float
        Pixel (plate) scale for drizzle image and seg. map (arcsec)
    ra : float
        The Right Ascension of the source in the direct image (degrees)
    dec : float
        The Declination of the source in the direct image (degrees)
    rad : float
        The radius of the segmentation size (arcsec)
    telescope : str
        The name of the observatory; e.g. HST
    instrument : str
        The name of the instrument; e.g. WFC3

    Outputs
    -------
    Drizzle image : FITS file
        <root>_drz_sci.fits
    Segmentation map : FITS file
        <root>_drz_seg.fits
    """

    files = [f'{imgdset}_flt.fits' for imgdset in datasets[filt]]

    # mosaic data via astrodrizzle
    astrodrizzle.AstroDrizzle(files, output=root, build=False,
                              static=False, skysub=False, driz_separate=False,
                              median=False, blot=False, driz_cr=False,
                              driz_combine=True, final_wcs=True,
                              final_rot=0., final_scale=scale,
                              final_pixfrac=1.0,
                              overwrite=True, final_fillval=0.0)

    # Must use memmap=False to force close all handles and allow file overwrite
    with fits.open(f'{root}_drz_sci.fits', memmap=False) as hdulist:
        img = hdulist['PRIMARY'].data
        hdr = hdulist['PRIMARY'].header

    wcs = WCS(hdr)
    x, y = wcs.all_world2pix(ra, dec, 0)
    
    xx, yy = np.meshgrid(np.arange(hdr['NAXIS1']),
                         np.arange(hdr['NAXIS2']))
    rr = np.hypot(xx-x, yy-y)
    seg = rr < (rad/scale)
    
    # add some keywords for SU
    hdr['TELESCOP'] = telescope
    hdr['INSTRUME'] = instrument
    hdr['FILTER'] = filt

    # write the files to disk
    fits.writeto(f'{root}_drz_sci.fits', img, hdr, overwrite=True)
    fits.writeto(f'{root}_drz_seg.fits', seg.astype(int), hdr, overwrite=True)
os.chdir(FILTER.lower())
preprocess_direct(DATASETS, FILTER, ROOT, SCALE, RA, DEC, RAD, TELESCOPE, INSTRUMENT)
Setting up logfile :  astrodrizzle.log
AstroDrizzle log file: astrodrizzle.log
AstroDrizzle Version 3.10.0 started at: 14:14:29.864 (10/04/2026)

==== Processing Step  Initialization  started at  14:14:29.865 (10/04/2026)

Forcibly archiving original of:  ifdb01agq_flt.fits as  OrIg_files/ifdb01agq_flt.fits

Turning OFF "preserve" and "restore" actions...

Forcibly archiving original of:  ifdb01ajq_flt.fits as  OrIg_files/ifdb01ajq_flt.fits
Forcibly archiving original of:  ifdb01amq_flt.fits as  OrIg_files/ifdb01amq_flt.fits
WCS Keywords

Number of WCS axes: 2
CTYPE : 'RA---TAN' 'DEC--TAN'
CUNIT : 'deg' 'deg'
CRVAL : 291.0983139188943 9.904157606520858
CRPIX : 872.4555616948504 913.9006754937355
CD1_1 CD1_2  : -3.5625e-05 1.0116615832766588e-21
CD2_1 CD2_2  : -2.4672289965473928e-22 3.5625e-05
NAXIS : 1743  1827
********************************************************************************
*
*  Estimated memory usage:  up to 44 Mb.
*  Output image size:       1743 X 1827 pixels. 
*  Output image file:       ~ 36 Mb. 
*  Cores available:         1
*
********************************************************************************
==== Processing Step Initialization finished at 14:14:30.328 (10/04/2026)
==== Processing Step  Static Mask  started at  14:14:30.330 (10/04/2026)

==== Processing Step Static Mask finished at 14:14:30.331 (10/04/2026)
==== Processing Step  Subtract Sky  started at  14:14:30.332 (10/04/2026)

==== Processing Step Subtract Sky finished at 14:14:30.398 (10/04/2026)
==== Processing Step  Separate Drizzle  started at  14:14:30.398 (10/04/2026)

==== Processing Step Separate Drizzle finished at 14:14:30.400 (10/04/2026)
==== Processing Step  Create Median  started at  14:14:30.401 (10/04/2026)

==== Processing Step  Blot  started at  14:14:30.402 (10/04/2026)

==== Processing Step Blot finished at 14:14:30.403 (10/04/2026)
==== Processing Step  Driz_CR  started at  14:14:30.404 (10/04/2026)

==== Processing Step  Final Drizzle  started at  14:14:30.406 (10/04/2026)

WCS Keywords

Number of WCS axes: 2
CTYPE : 'RA---TAN' 'DEC--TAN'
CUNIT : 'deg' 'deg'
CRVAL : 291.0983139188943 9.904157606520858
CRPIX : 872.4555616948504 913.9006754937355
CD1_1 CD1_2  : -3.5625e-05 1.0116615832766588e-21
CD2_1 CD2_2  : -2.4672289965473928e-22 3.5625e-05
NAXIS : 1743  1827
-Generating simple FITS output: WFC3_IR_VY2-2_drz_sci.fits
Writing out image to disk: WFC3_IR_VY2-2_drz_sci.fits
Writing out image to disk: WFC3_IR_VY2-2_drz_wht.fits
Writing out image to disk: WFC3_IR_VY2-2_drz_ctx.fits
==== Processing Step Final Drizzle finished at 14:14:31.71 (10/04/2026)

AstroDrizzle Version 3.10.0 is finished processing at 14:14:31.71 (10/04/2026).



   --------------------          --------------------
                   Step          Elapsed time
   --------------------          --------------------

         Initialization          0.4632 sec.
            Static Mask          0.0014 sec.
           Subtract Sky          0.0660 sec.
       Separate Drizzle          0.0015 sec.
          Create Median          0.0000 sec.
                   Blot          0.0014 sec.
                Driz_CR          0.0000 sec.
          Final Drizzle          1.3069 sec.
   ====================          ====================
                  Total          1.8404 sec.

Trailer file written to:  astrodrizzle.log

5.1 Display Drizzle Image and Overlay Segmentation Map#

Next, we display the F105W drizzle image created in the cell above. We also overplot the segmentation map by getting all
the x and y pixels where the segmentation array is True. Visually inspect the drizzle science image (and other drizzle
products if needed) for accurate image alignment and combination, as well as the source location as defined by the
segmentation map. Note, if you are using your own datasets with this notebook and the segmentation map does not line
up with the underlying source, you may need to adjust the RA and DEC variables.

# get drizzle data
d = fits.getdata(f'{ROOT}_drz_sci.fits')
# get seg map coordinates
y, x = np.where(fits.getdata(f'{ROOT}_drz_seg.fits') == 1)

# display the image and seg map coords
fig, axs = plt.subplots(1, 1, figsize=(10, 10))
z1, z2 = zscale.get_limits(d[600:950, 850:1200])
inorm = ImageNormalize(d, vmin=z1, vmax=z2*200, stretch=LogStretch())
im1 = axs.imshow(d, origin='lower', cmap='Greys_r', norm=inorm)
axs.scatter(x, y, 15, marker='x', c='limegreen', alpha=0.5, label='segmentation')
fig.colorbar(im1, ax=axs, shrink=0.8).set_label(label='e$^-$ s$^{-1}$', size=12)
axs.set_title(f'{ROOT} {FILTER} Mosaic')
axs.legend()
plt.show()

6. Extract the Spectrum from the Grism Data#

We are now finished with all the preprocessing steps and ready to extract the 1D spectrum. The function below, extract_single(),
demonstrates a complete single-orientation spectral extraction workflow using slitlessutils, starting from calibrated WFC3/IR
grism exposures and a direct-image-based source catalog (segmentation map). Below, we list each of the core slitlessutils tasks
used in extract_single() and provide a brief description of what the task does.

  • WFSSCollection serves as a container for the grism FLT exposures used in the extraction. Grouping them into a collection allows
    the software to treat the set of exposures as a unified dataset when projecting sources, building pixel‑dispersion tables (PDTs), and
    performing extraction. For more information about WFSSCollection, see the documentation.

  • SourceCollection is a similar container data structure that defines the sources from the inputted segmentation map and the
    drizzled science image; both made from the associated direct filter data. For more information about SourceCollection, see
    the documentation.

  • Region is a module that creates visual outlines of where each source’s dispersed light appears on the grism images. It does this
    by reading the PDTs and distilling them into DS9‑compatible region files that trace the footprint of each spectral order across the
    detector. These region files are not required for extraction, but are useful for quickly inspecting which parts of the grism images
    contribute to each object’s spectrum. More information about Region can be found in the documentation.

  • Tabulate performs the forward‑modeling step that connects the direct image to the grism frames. For every relevant direct‑image
    pixel, it computes the trace, wavelength mapping, and fractional pixel coverage and stores the results in a PDT. Because this calculation
    is computationally expensive, slitlessutils only computes PDTs when requested and then saves them in hierarchical data-format
    5 (HDF5) files inside the su_tables/ directory for later use. The PDT files only capture the geometric mapping of the scene.
    Instrumental effects and the actual astrophysical signal are added later in the workflow, so the PDTs depend solely on the WCS and its
    calibration. See the Tabulate documentation for more information.

  • Single is the class that carries out the one‑dimensional extraction for a single telescope orientation (position angle) and spectral
    order (here, the +1 order). It uses the PDTs to forward‑model how each direct‑image pixel contributes to the dispersed spectrum and
    assembles these contributions into a 1D spectrum. The method is conceptually similar to HSTaXe, but with a more flexible contamination
    model and a full forward‑modeling approach that can support optimization, such as SED‑fitting workflows. This extraction mode is
    intended for relatively simple, isolated sources where self‑contamination is not severe. A given spectral order should be extracted one
    at a time. Note, the software will overwrite the x1d.fits file, so users must use unique file names with root. For additional details,
    see the Single documentation.

Note, the AB mag zeropoint for the direct image filter (here, F105W) is needed for SourceCollection. It is used by slitlessutils
to measure the magnitude within the aperture, which allows users to reject sources that are too faint. The value used for zeropoint will not
affect the resulting spectrum. Zeropoints for WFC3/IR filters are available at the WFC3/IR Photometric Calibration page. For convenience,
a table of zeropoints for common filters is provided below. These zeropoints were created using the stsynphot Python package with an
obsmode of 'wfc3, ir, {filter}, mjd#60744, aper#6'. For the most accurate and time-dependent zeropoints, we recommend
using stsynphot. A tutorial for calculating WFC3 time-dependent zeropoints with stsynphot is available as a Jupyter notebook (see
Section 5 of that tutorial).

Filter Approximate AB Mag Zeropint
F098M 25.650
F105W 26.246
F140W 26.445
F160W 25.938
def extract_single(grating, filt, root, zeropoint, tabulate=False):
    """
    Basic single orient extraction similar to HSTaXe

    Parameters
    ----------
    grating : str 
        The grism image filter associated with datasets; e.g. G280
    filt : str
        The direct image filter associated with datasets e.g. F200LP
    root : str 
        The rootname of the drz and seg FITS file; will also be the 1d spectrum output file rootname
    zeropoint : float
        The AB mag zeropoint of the direct image filter; needed when simulating or rejecting faint sources
    tabulate : Bool
        If true, SU computes the pixel‑dispersion tables. Only need PDTs once per `data` and `sources`

    Output
    ------
    1D spectrum : FITS file
        root_x1d.fits
    
    """
    # load grism data into slitlessutils
    data = su.wfss.WFSSCollection.from_glob(f'../{grating.lower()}/*_flt.fits')

    # load the sources from direct image into slitlessutils
    sources = su.sources.SourceCollection(f'../{filt.lower()}/{root}_drz_seg.fits',
                                          f'../{filt.lower()}/{root}_drz_sci.fits',
                                          local_back=False,
                                          zeropoint=zeropoint)
    
    # create region files for spectral orders
    # regions are not required for spectral extraction
    reg = su.modules.Region(ncpu=1)
    reg(data, sources) 

    # project the sources onto the grism images; output to `su_tables/`
    if tabulate:
        tab = su.modules.Tabulate(ncpu=1)
        tab(data, sources)

    # run a single-orient extraction on the +1 order
    ext = su.modules.Single('+1', mskorders=None, root=root, ncpu=1)
    ext(data, sources, profile='uniform', width=15)
os.chdir('../output')
extract_single(GRATING, FILTER, ROOT, ZEROPOINT, tabulate=True)
INFO MainProcess> Loading from glob: ../g102/*_flt.fits
INFO MainProcess> Loading WFSS data from python list
INFO MainProcess> loading throughput from keys: ('hst', 'wfc3', 'f105w')
INFO MainProcess> Loading a classic segmentation map: ../f105w/WFC3_IR_VY2-2_drz_seg.fits
INFO MainProcess> Serial processing
Regions:   0%|          | 0/3 [00:00<?, ?it/s]
Regions:  33%|███▎      | 1/3 [00:00<00:01,  1.08it/s]
Regions: 100%|██████████| 3/3 [00:01<00:00,  3.59it/s]
Regions: 100%|██████████| 3/3 [00:01<00:00,  2.91it/s]
INFO MainProcess> Serial processing

Tabulating:   0%|          | 0/3 [00:00<?, ?it/s]
Tabulating:  33%|███▎      | 1/3 [00:01<00:03,  1.61s/it]
Tabulating:  67%|██████▋   | 2/3 [00:03<00:01,  1.57s/it]
Tabulating: 100%|██████████| 3/3 [00:04<00:00,  1.58s/it]
Tabulating: 100%|██████████| 3/3 [00:04<00:00,  1.58s/it]
INFO MainProcess> Serial processing

Extracting (single):   0%|          | 0/3 [00:00<?, ?it/s]
INFO MainProcess> Building contamination model for ifdb01anq/IR
Extracting (single):  33%|███▎      | 1/3 [00:00<00:00,  2.86it/s]
INFO MainProcess> Building contamination model for ifdb01ahq/IR
Extracting (single):  67%|██████▋   | 2/3 [00:00<00:00,  2.93it/s]
INFO MainProcess> Building contamination model for ifdb01akq/IR
Extracting (single): 100%|██████████| 3/3 [00:01<00:00,  2.98it/s]
Extracting (single): 100%|██████████| 3/3 [00:01<00:00,  2.96it/s]
INFO MainProcess> Combining the 1d spectra
INFO MainProcess> Writing: /home/runner/work/hst_notebooks/hst_notebooks/notebooks/WFC3/slitlessutils_IR_extraction/output/WFC3_IR_VY2-2_x1d.fits
WARNING: VerifyWarning: Card is too long, comment will be truncated. [astropy.io.fits.card]

6.1 Display a Region File#

Below, we display a grism FLT file and the associated region file. The region files are useful for quickly inspecting which part
of the grism image contribute to each object’s spectrum. The 0, +1, +2, and +3 spectral orders for the observations are outlined
in white, blue, orange, and green, respectively. More information about the slitlessutils region files can be found in the
documentation.

Note: if the figure below does not display correctly, try switching to %matplotlib inline.

# %matplotlib inline
i = 0 # which FLT image to display
fig, axs = plt.subplots(1, 1, figsize=(9, 9))

# Display a grism FLT
flt = fits.getdata(f'../{GRATING.lower()}/{DATASETS[GRATING][i]}_flt.fits')
z1, z2 = zscale.get_limits(flt)
inorm = ImageNormalize(flt, vmin=z1, vmax=z2*100, stretch=LogStretch())
im1 = axs.imshow(flt, origin='lower', cmap='Greys_r', norm=inorm)
axs.set_title(f'{DATASETS[GRATING][i]}_flt.fits')
fig.colorbar(im1, ax=axs, shrink=0.8, label='e$^-$ s$^{-1}$')

# Display the corresponding region file
region = pyregion.open(f'{DATASETS[GRATING][i]}_IR.reg')
patch_list, _ = region.get_mpl_patches_texts()
orders = ['+1', '0', '+2', '+3']
# Add patches 
for idx, p in enumerate(patch_list):
    p.set_linewidth(2)
    p.set_label(orders[idx])
    axs.add_patch(p)
# Reorder legend numerically 
handles, labels = axs.get_legend_handles_labels()
sorted_pairs = sorted(zip(handles, labels), key=lambda x: int(x[1].replace('+','')))
handles_sorted, labels_sorted = zip(*sorted_pairs)
axs.legend(handles_sorted, labels_sorted, title="Spectral Orders", ncol=4)
plt.show()

6.2 Plot the Spectrum#

Finally, what we’ve all been waiting for(!), plotting the extracted spectrum. The Single module produces a single spectrum for each
source and grism image. Those spectra are then combined into a single one-dimensional spectrum for each source and saved as a
x1d.fits file. In this example, we only have one source, so there is a single spectrum.

The x1d file is a binary table with columns for the wavelength (WAVELENGTH), flux (FLUX), uncertainty (UNCERTAINTY), contamination
(CONTAMINATION), and number of pixels (NMEASUREMENTS). By default configuration, the flux and uncertainty values are in units of
erg s-1 cm-2 · Å-1 and scaled by 10-17 (cfg.fluxunits and cfg.fluxscale).

There are several emission lines in VY2-2’s spectrum. A list of emission lines is provided in Table 2 of WFC3 ISR 2015-10 (Bohlin et al.),
which has been copied over to this notebook in the cell below.

cfg.fluxunits, cfg.fluxscale
('erg / (s * cm**2 * Angstrom)', 1e-17)
fig, ax = plt.subplots(1, 1, figsize=(10, 6))
ax.grid(alpha=0.5)

# load spectrum
dat = fits.getdata(f'{ROOT}_x1d.fits')

# create wavelength mask
lrange = (8000, 11550) 
wav = (lrange[0] < dat['WAVELENGTH']) & (dat['WAVELENGTH'] < lrange[1])

# plot spectrum
ax.errorbar(dat['WAVELENGTH'][wav], 
            dat['FLUX'][wav]*cfg.fluxscale/1e-13, 
            yerr=dat['UNCERTAINTY'][wav]*cfg.fluxscale/1e-13, 
            marker='.', markersize=5)

# overlay known emission lines
ax.axvline(9070, ls='--', c='k', lw=1)  # [SIII]; S²⁺
ax.axvline(9535, ls='--', c='k', lw=1)  # [SIII]; S²⁺ blended with H I Pε
ax.axvline(10060, ls='--', c='k', lw=1) # H I P7; n = 7 → 3
ax.axvline(10834, ls='--', c='k', lw=1) # He I; 2³S → 2³P

# matplotlib formatting
ax.minorticks_on()
ax.yaxis.set_ticks_position('both'), ax.xaxis.set_ticks_position('both')
ax.tick_params(axis='both', which='minor', direction='in', labelsize=12, length=3)
ax.tick_params(axis='both', which='major', direction='in', labelsize=12, length=5)
ax.set_xlabel(r'Wavelength ($\mathrm{\AA}$)', size=13)
ax.set_ylabel(r'Flux ($10^{-13}\ erg\ cm^{-2}\ s^{-1}\ \AA^{-1}$)', size=13)
ax.set_title(f"{ROOT.replace('_', ' ')} {GRATING} Spectrum", size=14)
plt.show()

7. Conclusions#

Thank you for going through this notebook. You should now have all the necessary tools to extract a 1D spectrum from WFC3
IR grism data using slitlessutils. After completing this notebook, you should be more familiar with:

  • Downloading data from MAST.

  • Performing background subtraction using WFC3 Backsub.

  • Preprocessing images for slitlessutils.

  • Creating and displaying region files.

  • Extracting and plotting a source’s spectrum.

Additional Resources#

Below are some additional resources that may be helpful. Please send any questions through the HST Help Desk.

About this Notebook#

Author: Benjamin Kuhn, WFC3 Team
Last Updated: 2026-03-25
Created 2026-01-15

Citations#

If you use Python packages for published research, please cite the authors.
Follow these links for more information about citing packages used in this notebook:


Top of Page Space Telescope Logo