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

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 time seconds 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 time still 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, in meta.snowblind.persist; the time also goes in the header card PERSTIME. 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’s typical_time is the time of the typical star; pass it, or a time between the two, as time to 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_detector1 sets 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 (_rate or _cal products) with dq arrays 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 by meta.instrument.detector and each group is handled on its own, in order of meta.exposure.start_time, with meta.exposure.end_time giving the end and the middle of each; the meta.subarray start 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 and save_results is set, each exposure is opened, flagged, saved and closed in turn, so only the saturation masks of the last time seconds are held in memory; each is saved under its own file name with the step’s suffix, whatever output_use_model and output_file say.

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 time seconds before the middle of the exposure, have DO_NOT_USE | PERSISTENCE set in dq; for file names with save_results set, the paths of the saved files instead.