barshadow step calculates the correction to be applied to
NIRSpec MSA data for extended sources due to the bar that separates
adjacent microshutters. This correction is applied to MultiSlit
data after the pathloss correction has been applied
in the calwebb_spec2 pipeline.
The input data must have been processed through the
extract_2d step, so that cutouts have been created
for each of the slitlets used in the exposure. Hence the input must be in the
form of a
It is also assumed that the input data have been processed through the
srctype step, which for NIRSpec MSA exposures sets the
SRCTYPE keyword value for each slit to “POINT”, “EXTENDED”, or “UNKNOWN.” If the
source type is “EXTENDED” or “UNKNOWN”, or the SRCTYPE keyword is not present,
the default action is to treat the source as extended and apply the
correction. If SRCTYPE=”POINT” for a given slit, the correction is not applied.
The step loops over all slit instances contained in the input exposure, computing and applying the barshadow correction to each slit for which the source type has been determined to be extended.
The BARSHADOW Reference File contains the correction as a function of Y and wavelength for a single open shutter (the DATA1X1 extension), and for 2 adjacent open shutters (DATA1X3). This allows on-the-fly construction of a model for any combination of open and closed shutters. The shutter configuration of a slitlet is contained in the attribute shutter_state, which shows whether the shutters of the slitlet are open, closed, or contain the source. Once the correction as a function of Y and wavelength is calculated, the WCS transformation from the detector to the slit frame is used to calculate Y and wavelength for each pixel in the cutout. The Y values are scaled from shutter heights to shutter spacings, and then the Y and wavelength values are interpolated into the model to determine the correction for each pixel.
Once the 2-D correction array for a slit has been computed, it is applied to the science (SCI), error (ERR), and variance (VAR_POISSON, VAR_RNOISE, and VAR_FLAT) data arrays of the slit. The correction values are divided into the SCI and ERR arrays, and the square of the correction values are divided into the variance arrays.