kammerje / spaceKLIP

Pipeline for reducing JWST high-contrast imaging data. Published in Kammerer et al. 2022 and Carter et al. 2022.
https://ui.adsabs.harvard.edu/abs/2022SPIE12180E..3NK/abstract
MIT License
16 stars 9 forks source link

Create 1/f noise correction Step class #106

Closed JarronL closed 10 months ago

JarronL commented 10 months ago

Removed the SavGol 1/f correction code from the pipeline and packaged it all into a jwst Step class and placed in the fnoise_clean.py file. Now this works similarly to other steps within jwst pipelines. Similarly created and added a kTC subtraction Step class kTCSubtractStep. Overall, the PR shouldn't change anything to the outputs or results, but simply cleans up the pipeline code and allows reuse of the 1/f correction for other pipelines.

Vertical striping correction is now applied in the CleanSubarry class and can be turned off and on in the OneOverfStep class via the vertical_corr parameter. (e.g., pipeline.subtract_1overf.vertical_corr). This has been turned on by default.

Full frame subarrays are now cleaned more intelligently via the implementation of the CleanFullFrame class. This first determines common-mode 1/f noise between the four channels, subtract that from each channel (accounting for channel flips along the x-axis), then models the residuals to determine channel-dependent 1/f noise. These are then all combined to create a full frame

Added logic to better handle cases where only a single integration is present. In that case, we are unable to work on residuals, so we simply apply an outlier mask to exclude pixels with high flux. The fitting routine then dynamically adapts the mask based on noise-subtracted residuals.