PersistenceFlagStep#
snowblind.PersistenceFlagStep, run with strun persist. Flags the pixels that saturated in an earlier exposure of the same detector,
and the pixels next to them, for a time measured for each detector. Takes a
whole set of _rate or _cal files at once.
Guide: Persistence flagging.
- Parameters:
- timefloat, default
None seconds, end of saturated exposure to middle of later one; None for the packaged time
- save_maskboolean, default
False write out persistence mask for each exposure
- timefloat, default
The parameters every stpipe step has (skip, save_results,
output_dir, suffix, pre_hooks, post_hooks and the
others) are described in the stpipe documentation.
- class snowblind.PersistenceFlagStep(name=None, parent=None, config_file=None, _validate_kwds=True, **kws)#
Given a series of exposures, for any pixel flagged as SATURATED or CHARGELOSS in one exposure, flag the pixel as DO_NOT_USE | PERSISTENCE in the later exposures of the same detector whose middle is less than
timeseconds after the end of that one.Persistence decays from the end of the saturated exposure, and the rate of a later exposure averages it over the exposure, which its value at the middle of the exposure approximates; so an exposure longer than
timestill flags the next.Without
time, each detector gets the time measured for it and packaged with snowblind (packaged_time), and DEFAULT_TIME (2500 s) when it has none. Each exposure records the time it was flagged with, where that came from, and how many pixels it flagged from how many earlier exposures, inmeta.snowblind.persist; the time also goes in the header cardPERSTIME. The packaged times are long on purpose: persistence varies across a detector and with each pixel’s history of illumination (how long and how often it saturated), so they are set for a pixel persisting twice as much as the detector’s typical saturated star. Each file’stypical_timeis the time of the typical star; pass it, or a time between the two, astimeto flag less.- process(input_data)#
Flag persistence from earlier saturated exposures in each image.
The saturated pixels of an exposure are those with SATURATED in its
dq: ramp fitting sets it where any group of any integration saturated. Those with CHARGELOSS are flagged too:snowblind_detector1sets it on the pixels next to saturated ones, which persist as well, where the jwst saturation step’s default sets SATURATED, and the packaged times were measured with that default.- Parameters:
- input_datastr, list of str, or ModelContainer
Association file, list of file names, or container of image datamodels (
_rateor_calproducts) withdqarrays of shape (nrows, ncols). Of an association, the members of its first product are read, whatever their exposure type, as ~jwst.datamodels.ModelContainer reads them. The exposures are grouped bymeta.instrument.detectorand each group is handled on its own, in order ofmeta.exposure.start_time, withmeta.exposure.end_timegiving the end and the middle of each; themeta.subarraystart pixels place each exposure on the detector, so a subarray is flagged where a full-frame exposure saturated, and the other way round. When file names are given andsave_resultsis set, each exposure is opened, flagged, saved and closed in turn, so only the saturation masks of the lasttimeseconds are held in memory; each is saved under its own file name with the step’s suffix, whateveroutput_use_modelandoutput_filesay.
- Returns:
- ModelContainer or list of str
Copy of the input in which pixels saturated in an earlier exposure of the same detector, which ended less than
timeseconds before the middle of the exposure, haveDO_NOT_USE | PERSISTENCEset indq; for file names withsave_resultsset, the paths of the saved files instead.