spacetelescope / jwst

Python library for science observations from the James Webb Space Telescope
https://jwst-pipeline.readthedocs.io/en/latest/
Other
571 stars 167 forks source link

Saturation flagging change causes problems for snowball rejection #8984

Open stscijgbot-jp opened 6 days ago

stscijgbot-jp commented 6 days ago

Issue JP-3805 was created on JIRA by David Law:

Analysis of an unrelated issue has revealed that snowball flagging in build 11.1 (1.16.1) has regressed compared to build 11.0 (1.15.1).  For some NIRCam data, the outer halos of snowballs is no longer removed by the snowball routine.  See, e.g., jw01345001001_10201_00001_nrca3

Initial analysis points to this being caused by https://jira.stsci.edu/browse/JP-3593, as setting saturation.use_readpatt=False fixes the issue.

stscijgbot-jp commented 6 days ago

Comment by David Law on JIRA:

On investigation, the root issue seems to be that the groups in which saturation is reached (but is not obvious) because of group averaging are fundamentally different from groups in which the saturation is obvious.  Just like the group averaging dilutes how obvious saturation is, it also dilutes the evidence for a snowball surrounding the core.  With how the snowball code is designed, when it doesn't see such evidence for a snowball in the first group in which saturation occurs it seems to not try to find and flag one.

It may be possible to address this with an update to the snowball code, but a safer alternative may be to modify the saturation code to set DO_NOT_USE instead of SATURATION for those cases in which saturation is technically reached in the individual frames but not obvious in grouped data.

This is a trivial change, and seems to fix the problem.  See spacetelescope/stcal#321

Still needs further testing though.

stscijgbot-jp commented 6 days ago

Comment by David Law on JIRA:

Now tested on the original suite of test cases for JP-3593 and some new test cases where CR shower flagging was having some problems.  All look successful, with no CR shower issues any longer but still flagging bad pixels as intended.

Test cases included:

jw01180022001_02101_00002_nrca1_uncal.fits     jw02234008001_02101_00001_nrca4_uncal.fits     jw04147012001_08201_00003_nis_uncal.fits jw01345001001_10201_00001_nrca3_uncal.fits     jw02756003001_03101_00001_nrca1_uncal.fits jw01906001001_02101_00001_nrs1_uncal.fits      jw02756003001_03101_00001_nrcalong_uncal.fits