despike¶
- sofia_redux.instruments.exes.despike.despike(data, header, variance=None, abeams=None, bbeams=None, gooddata=None, propagate_nan=False)[source]¶
Correct outlier pixels due to temporal spikes.
All A frames are compared, and any pixels with values greater than a threshold factor (header[‘SPIKEFAC’]) of standard deviations from the mean value across the other frames are replaced with that mean value. B frames are similarly compared with each other.
Optionally (if header[‘TRASH’] is True), frames with significantly discrepant overall background levels (“trashed” frames) may be identified automatically and flagged for removal from subsequent reduction.
- Parameters:
- datanumpy.ndarray
3D data cube [nframe, nspec, nspat].
- headerfits.Header
Header of FITS file.
- variancenumpy.ndarray
3D variance cube [nframe, nspec, nspat].
- abeamsarray-like of int
Index numbers of A frames in data cube.
- bbeamsarray-like of int
Index numbers of B frames in data cube.
- good_datanumpy.ndarray, optional
Bad pixel array [nspec, nspat] indicating valid data (True=good, False=bad).
- propagate_nanbool, optional
If True, outlier pixels will be replaced by NaN rather than the average value.
- Returns:
- spike_data, spike_mask, good_frames3-tuple of numpy.ndarray
The corrected data, outlier pixel mask, and list of good data frames. Data and mask have dimensions [nframe, nspec, nspat]. In the mask, True=good, False=spike. The good frames list includes indices for all good (non-trashed) frames in the input data.