kevin218 / Eureka

Eureka! is a data reduction and analysis pipeline intended for time-series observations with JWST.
https://eurekadocs.readthedocs.io/
MIT License
60 stars 47 forks source link

Flags fully saturated pixel columns as DO_NOT_USE #651

Closed gianninapr closed 3 months ago

gianninapr commented 4 months ago

Issue Addressed

This PR addresses Issue #597 in which columns that were fully saturated (the first group already saturated) were still being used in Stage 3 and saturation was being manually removed from the first group if found.

Fix Introduced

From conversations with @erinmay the best fix seemed to be to get rid of the portion of the code that removed saturation from the first group, as well as mark any columns that are fully saturated as DO_NOT_USE. And with @cicanas help to understand JWST flagging I was able to brainstorm a path forward for this by establishing a similar condition check to what was already established for partial saturation but for full saturation.

Elegance

I tried to keep the same format that was being used for most of the script, and I did wonder if maybe a more elegant approach for the conditions was an if/else loop, but I was worried that separating the conditions would omit actual saturation flags that might still be needed in favor of just DO_NOT_USE flags. But happy to work on a more elegant solution if anyone sees any obvious ways to update it.

Testing

I was able to test this on WASP 39b data with full saturation in columns 60-144 and also tested it with only partial saturation in the second group to make sure the condition was not catching partial saturation. If others want to test it feel free! I'll post a side by side comparison below of one of our Stage 3 results that showcase the bug fix.

old new

taylorbell57 commented 4 months ago

This is not something that needs to be addressed in this PR, but this new (helpful!) feature will further increase the need to address issue #546. Just noting that here and linking that issue to remind myself and others why resolving that other issue is important