Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/9584.background.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change the background reference filetype for WFSS processing from ``wfssbkg`` to ``bkg``.
4 changes: 2 additions & 2 deletions docs/jwst/background_subtraction/reference_files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ Reference Files
===============
The background image subtraction step uses reference files only when
processing Wide-Field Slitless Spectroscopy (WFSS) exposures. Two reference
files are used for WFSS mode: WFSSBKG and WAVELENGTHRANGE. The
files are used for WFSS mode: BKG and WAVELENGTHRANGE. The
WAVELENGTHRANGE reference file is used in the process of determining the
locations of source spectra in the image, and conversely the image areas
that contain only background signal.

.. include:: ../references_general/wfssbkg_reffile.inc
.. include:: ../references_general/bkg_reffile.inc

.. include:: ../references_general/wavelengthrange_reffile.inc

66 changes: 66 additions & 0 deletions docs/jwst/references_general/bkg_reffile.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
.. _bkg_reffile:

Background reference file
-------------------------

:REFTYPE: BKG

The WFSS background reference file contains a "master" image of the
dispersed background produced by a particular filter+grism combination.

.. include:: ../references_general/bkg_selection.inc

.. include:: ../includes/standard_keywords.inc

Type Specific Keywords for BKG
++++++++++++++++++++++++++++++
In addition to the standard reference file keywords listed above,
the following keywords are *required* in BKG reference files,
because they are used as CRDS selectors.
(see :ref:`bkg_selectors`):

========= ==============================
Keyword Data Model Name
========= ==============================
DETECTOR model.meta.instrument.detector
EXP_TYPE model.meta.exposure.type
FILTER model.meta.instrument.filter
PUPIL model.meta.instrument.pupil
========= ==============================

Reference File Format
+++++++++++++++++++++
BKG reference files are in FITS format. The content of the background references differ
based on exposure type:

:Data model: `~jwst.datamodels.WfssBkgModel`

Wide-field slitless spectroscopy (WFSS) background files contain 3 IMAGE extensions and
1 BINTABLE extension. The FITS primary HDU does not contain a data array.
The characteristics of the FITS extensions are as follows:

======= ======== ===== ============== =========
EXTNAME XTENSION NAXIS Dimensions Data type
======= ======== ===== ============== =========
SCI IMAGE 2 ncols x nrows float
ERR IMAGE 2 ncols x nrows float
DQ IMAGE 2 ncols x nrows integer
DQ_DEF BINTABLE 2 TFIELDS = 4 N/A
======= ======== ===== ============== =========

.. include:: ../includes/dq_def.inc

:Data model: `~jwst.datamodels.SossBkgModel`

Background reference files supporting NIRISS SOSS exposures contain three
image extensions, each with three dimensions. The extensions contain templates
of reference backgrounds. The FITS primary HDU does not contain a data array.
The characteristics of the FITS extensions are as follows:

======= ======== ===== ========================== =========
EXTNAME XTENSION NAXIS Dimensions Data type
======= ======== ===== ========================== =========
SCI IMAGE 3 ncols x nrows x ntemplates float
ERR IMAGE 3 ncols x nrows x ntemplates float
DQ IMAGE 3 ncols x nrows x ntemplates integer
======= ======== ===== ========================== =========
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.. _wfssbkg_selectors:
.. _bkg_selectors:

Reference Selection Keywords for WFSSBKG
++++++++++++++++++++++++++++++++++++++++
CRDS selects appropriate WFSSBKG references based on the following keywords.
WFSSBKG is not applicable for instruments not in the table.
Reference Selection Keywords for BKG
++++++++++++++++++++++++++++++++++++
CRDS selects appropriate BKG references based on the following keywords.
BKG is not applicable for instruments not in the table.

========== ===============================================================
Instrument Keywords
Expand Down
2 changes: 1 addition & 1 deletion docs/jwst/references_general/explain_rmaps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,14 @@ example .imap taken from NIRSPEC::
selector = {
'AREA' : 'jwst_nirspec_area_0010.rmap',
'BARSHADOW' : 'jwst_nirspec_barshadow_0002.rmap',
'BKG' : 'N/A',
'CAMERA' : 'jwst_nirspec_camera_0015.rmap',
...,
'PATHLOSS' : 'jwst_nirspec_pathloss_0003.rmap',
...,
'WAVECORR' : 'jwst_nirspec_wavecorr_0003.rmap',
'WAVELENGTHRANGE' : 'jwst_nirspec_wavelengthrange_0015.rmap',
'WCSREGIONS' : 'N/A',
'WFSSBKG' : 'N/A',
}

A value of N/A indicates that a particular reference type is not yet used by
Expand Down
6 changes: 3 additions & 3 deletions docs/jwst/references_general/references_general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ documentation on each reference file.
+ +--------------------------------------------------+
| | :ref:`WAVELENGTHRANGE <wavelengthrange_reffile>` |
+-------------------------------------------------------+--------------------------------------------------+
| :ref:`background <background_subtraction>` | :ref:`WFSSBKG <wfssbkg_reffile>` |
| :ref:`background <background_subtraction>` | :ref:`BKG <bkg_reffile>` |
+ +--------------------------------------------------+
| | :ref:`WAVELENGTHRANGE <wavelengthrange_reffile>` |
+-------------------------------------------------------+--------------------------------------------------+
Expand Down Expand Up @@ -312,7 +312,7 @@ documentation on each reference file.
+--------------------------------------------------+-------------------------------------------------------+
| :ref:`WAVECORR <wavecorr_reffile>` | :ref:`wavecorr <wavecorr_step>` |
+--------------------------------------------------+-------------------------------------------------------+
| :ref:`WFSSBKG <wfssbkg_reffile>` | :ref:`background <background_subtraction>` |
| :ref:`BKG <bkg_reffile>` | :ref:`background <background_subtraction>` |
+--------------------------------------------------+-------------------------------------------------------+

Step Parameters Reference Types
Expand All @@ -339,7 +339,7 @@ The required Keywords Documenting Contents of Reference Files are:
======== ==================================================================================
Keyword Comment
======== ==================================================================================
REFTYPE `WFSSBKG Required values are listed in the discussion of each pipeline step.`
REFTYPE `BKG Required values are listed in the discussion of each pipeline step.`
DESCRIP `Summary of file content and/or reason for delivery`
AUTHOR `Fred Jones Person(s) who created the file`
USEAFTER `YYYY-MM-DDThh:mm:ss Date and time after the reference files will
Expand Down
47 changes: 0 additions & 47 deletions docs/jwst/references_general/wfssbkg_reffile.inc

This file was deleted.

13 changes: 10 additions & 3 deletions jwst/background/background_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
""" # noqa: E501

# These reference files are only used for WFSS/GRISM or SOSS data.
reference_file_types = ["bkg", "wfssbkg", "wavelengthrange"]
reference_file_types = ["bkg", "wavelengthrange"]

Check warning on line 35 in jwst/background/background_step.py

View check run for this annotation

Codecov / codecov/patch

jwst/background/background_step.py#L35

Added line #L35 was not covered by tests

# Define a suffix for optional saved output of the combined background
bkg_suffix = "combinedbackground"
Expand Down Expand Up @@ -60,9 +60,16 @@

if result.meta.exposure.type in ["NIS_WFSS", "NRC_WFSS"]:
# Get the reference file names
bkg_name = self.get_reference_file(result, "wfssbkg")
bkg_name = self.get_reference_file(result, "bkg")

Check warning on line 63 in jwst/background/background_step.py

View check run for this annotation

Codecov / codecov/patch

jwst/background/background_step.py#L63

Added line #L63 was not covered by tests
wlrange_name = self.get_reference_file(result, "wavelengthrange")
self.log.info("Using WFSSBKG reference file %s", bkg_name)

if bkg_name == "N/A":
self.log.warning("No BKG reference file found. Skipping background subtraction.")
result.meta.cal_step.bkg_subtract = "SKIPPED"
input_model.close()
return result

Check warning on line 70 in jwst/background/background_step.py

View check run for this annotation

Codecov / codecov/patch

jwst/background/background_step.py#L66-L70

Added lines #L66 - L70 were not covered by tests

self.log.info("Using BKG reference file %s", bkg_name)

Check warning on line 72 in jwst/background/background_step.py

View check run for this annotation

Codecov / codecov/patch

jwst/background/background_step.py#L72

Added line #L72 was not covered by tests
self.log.info("Using WavelengthRange reference file %s", wlrange_name)

# Do the background subtraction for WFSS/GRISM data
Expand Down