# NIRSpec MSA Leakage Subtraction Recommended Strategies

A very small fraction of light seeps through the JWST NIRSpec Micro-Shutter Assembly onto the detectors even when all shutters are closed. This leakage affects the IFU and MOS observations. Strategies to prevent and correct this issue are provided and discussed.

The NIRSpec observing modes Multi-Object Spectroscopy (MOS, using the Micro-Shutter Assembly) and Integral Field Spectroscopy (using the Integral Field Unit; IFU) share the same area on the NIRSpec detectors and are therefore mutually exclusive. When IFU observations are conducted, the Micro-Shutter Assembly (MSA) will be closed to block light coming from the MOS field of view that could contaminate the IFU spectra.

Unfortunately, due to the limited light-blocking performance of the MSA, a small fraction of light coming from the ~9 square arcmin MOS field of view will still reach the detectors, even if the micro-shutters are all commanded “closed”. The limitations are the following:

• A small number of micro-shutters (the so-called "failed-open” shutters) are stuck open and cannot be commanded closed. Any light present in these shutters will always go through to the detectors and create unwanted, parasitic spectra that will overlap with the IFU spectra. In most cases, the contaminating spectra will be comprised of sky background, but the failed open shutters can intercept sources in some cases.

• The micro-shutters are not perfectly opaque and, even when closed, they will let a small fraction of the incident light through. The attenuation level of the shutters (often referred as their “contrast”) ranges from a few thousand to more than ten thousand. This light “leaking” through the MSA will create two different types of parasitic signal.
1. When a very bright object is present in the MOS field of view, even after an attenuation of a few thousand by the closed micro-shutters, its spectrum may still be detectable and could contaminate the IFU spectra.
2. Although the leaked spectrum by an individual closed micro-shutter would be too weak to be detected, the leaked spectra from the many adjacent micro-shutters will overlap each other in the spectral direction generating a parasitic 'diffuse' signal, called the “MSA leakage”, that can be significant. This effect is analogous to having a dispersed background present in wide field slitless spectroscopy observations, although with attenuation through the MSA. Importantly, however, the MSA contrast varies globally across the MSA, and also shows more significant leakage on small scales at the tops and bottoms of shutters. Hence, the parasitic signal will have spatial structure which is difficult to predict.

The NIRSpec Bright Spoilers article provides strategies to mitigate the effect of leaked signal from bright sources, whether they appear in failed-open shutters or are imprinted through closed microshutters. In the remainder of this article, we focus on the diffuse parasitic signal from the overlap of dispersed background, which we refer to as "MSA leakage."

# Significance of the diffuse MSA leakage

• Will the MSA leakage be present in my observation?

Yes, the leakage will always be present in MSA and IFU observations. The zodiacal light and telescope stray light will always be present in the MOS field of view and will generate MSA leakage. In some observations, additional background from extended astrophysical sources may be present and provide an additional contribution to the MSA leakage.

• How can I estimate the importance of the MSA leakage?

The level of the MSA leakage will depend on the brightness of the incident background from which it originates. Its actual level will, therefore, vary from one observation to the other. To allow for an easy scaling of its level we have computed how the MSA leakage would compare to the direct IFU spectrum of the incident background. Table 1 provides information on the relative increase in the background in the IFU spectra due to the MSA leakage. Note that this increase is both wavelength- and position-dependent. These dependencies are characterized in Deshpande et al. (2018).

Table 1. Relative increase in background in the IFU spectra due to the presence of the MSA leakage.

 Instrument Configuration Relative increase (in %) Mean1(calibration lamp measurements) 95th percentile1,2(calibration lamp measurements) 95th percentile1,2(zodiacal model prediction) Low-spectral resolution configuration CLEAR/PRISM 1.5 1.7 1.6 Medium-spectral resolution configurations F070LP/G140M 30 82 3.9 F100LP/G140M 4.8 13.4 6.2 F170LP/G235M 1.8 3.5 5.7 F290LP/G395M 1.8 6.6 2.2 High-spectral resolution configurations F070LP/G140H 1.5 2.3 4.7 F100LP/G140H 2.9 6.5 11.3 F170LP/G235H 3.7 7.4 7.4 F290LP/G395H 5.8 19 4.6

1 These numbers were derived from test data obtained on the ground using the internal calibration sources of the instrument that provide a uniform illumination of the MOS field of view (i.e. mimicking the presence of an extended background source). Exposures were obtained with an open IFU aperture and then closed, allowing a comparison of the MSA leakage to the “in-field” spectra of the incident illumination obtained with the IFU. On sky, the parasitic signal will differ from this estimate, since the spectrum of the calibration lamps is not the same as the spectrum of the zodiacal background. The right-most column of Table 1 gives a prediction for the MSA leakage from a zodiacal light, estimated by fitting a model to the calibration lamp leakage data, and substituting the JWST background spectrum for the lamp spectrum in the model. Details of this modeling can be found in Deshpande et al. (2018).
2 The 95th percentile refers to the value where 95% of the measured MSA leakage values are smaller, and 5% are larger. Note that the MSA leakage varies both spatially and with wavelength (Deshpande et al. 2018).

# How to determine whether MSA leakage calibration exposures are necessary

It is important to note from Table 1 that (except for the calibration lamp measurements using the F070LP/G140M setup) the contribution of the MSA leakage to an IFU spectrum is typically at least 10 times lower than the direct contribution of the background (i.e. as observed in the IFU spectra). As a consequence, before deciding if the MSA leakage should be subtracted, it is necessary to have gone through the steps of selecting a background subtraction strategy.

## No need for MSA leakage subtraction cases

If your observation falls into one of the following three categories below, then either the MSA leakage subtraction is not necessary, or it is performed automatically as part of the background subtraction scheme. Hence, in these cases no action is necessary.

1. No background subtraction planned: If it was deemed unnecessary to subtract the background from the IFU spectra then it should not be necessary to subtract the MSA leakage due to its fainter nature.  This scenario arises for bright objects, where the surface brightness of the expected emission is significantly higher than the zodiacal background

2. Off-scene nodding: When an off-scene nodding scheme is used (with the standard pixel-level subtraction procedure) and if the incident background can be considered uniform over the complete NIRSpec field of view and over the two nodding positions, then the MSA leakage is subtracted at the same time than the background.

3. In-scene nodding: When an in-scene nodding scheme is used (with the standard pixel-level subtraction procedure) and if the incident background can be considered uniform over scales of a few arcsec (i.e. the typical amplitude of the nodding steps), then the MSA leakage is subtracted at the same time than the background.

## Other Cases

In all other observation scenarios, the subtraction of the MSA leakage can only be performed using dedicated MSA leakage exposures. Obtaining these exposures will add overhead time, and using them may have an impact on the final signal to noise ratio. It is therefore important to assess if the MSA leakage subtraction is actually necessary. However, it is difficult to provide a universal recipe for this assessment that typically requires comparing the level of the MSA leakage to the noise level in the observation. There are some obvious cases, though. For example, observing a moon in the IFU that is in close proximity to a planet or its rings. When light from extraneous bright sources falls on the MSA, light leakage calibration exposures can help to remove this unwanted light from science spectra.

The following steps outline how to use the JWST Exposure Time Calculator (ETC) to estimate whether leakage calibration exposures may be useful:

1. Perform a signal-to-noise (S/N) calculation of the scene, ignoring any knowledge of the MSA leakage. Note that if a strong extended astrophysical background other than the zodiacal light and the telescope stray light is present, it may have to be included into the computation by adding this source to the area covered by the object and the background subtraction area (so the background spectrum is subtracted by the ETC). Note that, for the purposes of this ETC calculation, the IFU background subtraction can be modeled by in-scene nodding, even though in-scene nodding may preclude the need for leakage calibration exposures. The S/N ratio obtained using this scene will be called  $\rm{S/N}_{ETC}^{obj}$.

2. Create a new scene by duplicating the scene used for step 1. In this new scene, add a new source corresponding to the incident background scaled using the factor from Table 1 (95th percentile value, divided by 100 as the table contains percent values). This source should extend both over the area covered by the object and the background subtraction area. The S/N ratio obtained using this scene will be called  $\rm{S/N}_{ETC}^{obj-leak}$.

3. Create a new scene by duplicating the one used for step 1. In this new scene, add a new source corresponding again to the incident background scaled using the factor of Table 1 (95th percentile value, divided by 100 as the table contains percent values) but this time make sure it only extends over the area covered by the object and not over the area used for background subtraction. This signal to noise ratio obtained using this scene will be called  $\rm{S/N}_{ETC}^{obj+leak}$.

It can be shown that:

where S is the source signal, B is the background signal, and D is variance on the the detector noise, all measured in electrons. Likewise,  $\rm{\epsilon}$ is the increase in the background due to MSA leakage, as given in Table 1 (divided by 100 as the table contains percent values).

Then, we can estimate the amount of leakage signal, $\rm{\epsilon}$B, relative to the noise in the observation:

If $\rm{\epsilon}$B is small compared to the noise in the observation ($\Delta(\rm{S/N})$ << 1) it is likely that a leakage correction would not be useful, and would simply add noise from the pixel-wise subtraction of the exposures.  Alternatively, if $\rm{\epsilon}$B is significant compared to the noise in the observations ($\Delta(\rm{S/N}) \gtrsim$  1), users may find that their science goals require the subtraction of the additional signal. Here, we reiterate that the MSA leakage varies spatially across the MSA on both small and large scales, so the MSA leakage signal that must be subtracted will have a variable amplitude, with a 95th percentile characterized by $\rm{\epsilon}$B.

These guidelines are derived using our best knowledge of the MSA leakage from ground-based data. Without any on-sky experience, a conservative approach is strongly recommended. If there is any doubt about the necessity of leakage calibration exposures, we urge users to err on the side of caution, and include the leakage calibration exposures.

# Adjustments to ETC calculations to account for MSA Leakage

Table 2 lists corrections to the ETC calculations that are needed to get accurate S/N estimates, both for cases where leakage exposures are subtracted, and when they are not. In the latter, it follows from the equations above that the only necessary correction is in background limited cases, where the ETC-predicted $\rm{S/N}_{ETC}^{obj}$ is reduced by a factor of $\frac{1}{\sqrt{1+\epsilon}}$. In the object-noise-limited and detector-noise-limited cases, the background noise is negligible, so the MSA leakage is also negligible. For the former case, we can write the S/N achieved after the pixel-by-pixel subtraction as:

Then, it can be shown that $\rm{S/N}_{real}^{obj-leak}$ is related to $\rm{S/N}_{ETC}^{obj-leak}$ by the ratios in Table 2. The subtraction of the leakage calibration exposure adds noise in both the background limited and detector-noise limited regimes.

Table 2. Corrections to ETC calculations to account for MSA leakage signal

 Noise regime Object-noise limited Background-noise limited Detector-noise limited Correction to be applied to $\rm{S/N}_{ETC}^{obj}$ to account for the presence of the MSA leakage (for cases where the leakage exposures are not subtracted). 1 $\frac{1}{\sqrt{1+\epsilon}}$ 1 Correction to be applied  $\rm{S/N}_{ETC}^{obj-leak}$ to account for additional noise introduced by the leakage background subtraction 1 $\frac{\sqrt{1+\epsilon}}{\sqrt{1+2 \epsilon}}$ $\frac{1}{\sqrt{2}}$

# How to determine if observations will be background limited, detector limited, or object-noise limited

The JWST Exposure Time Calculator (ETC) provides the necessary information to determine whether the calculations are in the object-noise-limited, background-noise-limited, or detector-noise limited regimes. The "Reports" section in the lower right corner provides the S/N for the calculation, along with the source counts (S; in e-/s) and background noise (B; in e-/s). Using the exposure time to convert these rates into the total number of electrons, the variance from the detector noise can be inferred (following the equations above). Users should compare S, B, and D to determine the dominant noise source in the planned observations.

# Number of MSA leakage exposures

When preparing NIRSpec IFU observations and including MSA leakage exposures, two different options are available when executing a dither or nodding pattern:

1. A single MSA leakage exposure is obtained only for the position at the beginning of the dither or nodding pattern.
2. An MSA leakage exposure is obtained for each dither or nodding point.

It is recommended to select option 2 if the incident background generating the MSA leakage varies during the dither or nodding pattern. If the background is expected to be uniform over those scales then option 1 is recommended.

# References

Deshpande, A., et al. 2018, SPIE Proceedings Vol. 10698
The contrast performance of the NIRSpec micro shutters and its impact on NIRSpec integral field observations

Published 06 Feb 2018