JP-4000: Persistence Options Added#10091
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10091 +/- ##
==========================================
- Coverage 86.86% 86.85% -0.01%
==========================================
Files 375 375
Lines 40346 40069 -277
==========================================
- Hits 35047 34803 -244
+ Misses 5299 5266 -33 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
cb188a3 to
0df513e
Compare
9d6aa53 to
a3af9da
Compare
9de07f4 to
fa24afc
Compare
d47241d to
f8442f5
Compare
cb3b4f2 to
59313d7
Compare
59313d7 to
ba4e186
Compare
|
I've been trying to test this out and I'm not sure I'm using it correctly. Let's say I have two exposures, jw05014008002_02107_00001_mirimage_uncal.fits (exp 1) and jw05014008003_02107_00001_mirimage_uncal.fits (exp 2) I want to run the persistence step to ensure that things that saturate in exp1 get flagged as PERSISTENCE in exp2. I run which creates an asdf file that should describe pixel timings. Then I process the second exposure with but it looks like the DQ array of the rate file isn't flagging the persistence anywhere. If I also provide --steps.persistence.persistence_time=8000 in the call to the second exposure I still don't get DQ flags, but I do get a big block of NaN-valued SCI array pixels in the relevant areas? |
melanieclarke
left a comment
There was a problem hiding this comment.
In addition to addressing David's comments from testing, this needs some preliminary clean up on the software side before we continue reviews:
- pre-commit, changelog, and docs tests are all failing.
- unit tests are failing (some notes below on how to fix)
- the regression test runs only a trivial use case. We'll need regression tests that demonstrate both: initial persistence flagging and saving the asdf file, and using an existing asdf file to flag persistence in a subsequent exposure.
| persistence_time = integer(default=None) # Time, in seconds, to use for persistence window | ||
| persistence_array_file = string(default=None) # A path to an ASDF file containing a 2-D array of persistence times per pixel | ||
| persistence_dnu = boolean(default=False) # If True the set the DO_NOT_USE flag with PERSISTENCE | ||
| skip = boolean(default=False) # Skip the persistence step entirely |
There was a problem hiding this comment.
I think this should default to True, since it requires a non-default persistence_time to do anything useful.
| self.persistence_dnu, | ||
| ) | ||
| (result, traps_filled, output_pers, skipped) = pers_a.do_all() | ||
| result, skipped = pers_a.do_all() |
There was a problem hiding this comment.
Unit tests are failing because some steps run detector1 on synthetic data that doesn't include values assumed to be present inside do_all. Since this function does nothing if persistence_time is None, I think it would be helpful to check for that input and just skip the step instead of calling do_all (in addition to defaulting to skip=True).
|
Adding a couple other quick comments:
|
f3e2ac2 to
57c3519
Compare
"Does the save_persistence infrastructure pass along input persistence information from the prior exposure (input via the asdf file) in the output asdf file, or just from the exposure being processed?" The ASDF file written out if save_persistence is True will output the persistence_array. If no persistence array file is inputed, it will created one to be used during persistence. The information in this array is end time, in epoch time, of any active persistence flagging window. A value of 0.0 indicates no active window. The end time of the windows are calculated as follows:
The current persistence array, within an exposure, persists across integrations. If a persistence array is desired to persist across exposures, it must be saved to an ASDF file that will then be used as an input for the next exposure. This must be done manually. The file names have a time stamp associated with them to allow developers using this feature to change parameters without clobbering previous computations. For example, a user may want to investigate various length persistence windows. Or use a previously computed persistence array as input for more than one exposure, without worry the file will be clobbered with each run of the persistence step. I thought the current naming system was a good idea, but if a different naming convention is desired, with maybe the window length, rather than datetime as part of the suffix or no additional uniqueness to he suffix, that's fine. "It may be worth default to some finite-valued persistence_time instead of None." The input parameters can be changed. I had originally set this to be None when I thought this feature would be added to the existing processes, rather than simply replacing it. I set it to None as default because that would indicate skipping the persistence flagging based on the newly created timing window, but allowing for the other processes to be run if the step isn't skipped. The spec can be updated and the control flow correspondingly updated. |
06b9ea7 to
7b1caad
Compare
|
Thanks @kmacdonald-stsci and @tapastro ; sounds like there's more to understand in terms of how this step can interact with later steps and might need some iteration. |
542e2cf to
429d659
Compare
This issue is still present - we need some filename cleaning of the input persistence array filename if it is also requested that the step save a fresh version. I'd also suggest that we truncate the timestamp by ~3 digits - we probably don't need to go beyond milliseconds. |
…e current working directory.
…line output directory.
…vent backward in time flagging, i.e., erroneously flagging before the time window begins.
…array file, guarding against mismatched persistence times, as well as guarding against backwards flagging.
7a03bb2 to
51ac1fa
Compare
tapastro
left a comment
There was a problem hiding this comment.
Thanks for your efforts, Ken! I think we're good to go.
|
Scratch that - I'll get the stcal PR in, then we'll need to update the pyproject here to point back to stcal/main. I'm also going to get one more set of RTs going, just to have it in hand. RTs here, with both PRs: https://github.com/spacetelescope/RegressionTests/actions/runs/27361455924 |
tapastro
left a comment
There was a problem hiding this comment.
RT run shows errors caused by existing regtests that use parameters which no longer exist: see test_niriss_image and test_nircam_persistence. Those tests will need to be updated to be compliant with the new step spec before we can merge.

Resolves JP-4000
This PR addresses a rough draft of how to handle persistence options to the persistence step.
Tasks
Build 12.0(use the latest build if not sure)no-changelog-entry-needed)changes/:echo "changed something" > changes/<PR#>.<changetype>.rst(see changelog readme for instructions)docs/pageokify_regteststo update the truth files