spacetelescope / stcal

https://stcal.readthedocs.io/en/latest/
Other
10 stars 32 forks source link

JP-3678: Fix C poisson variance calculation #269

Closed drlaw1558 closed 3 months ago

drlaw1558 commented 3 months ago

Resolves JP-3678

This PR fixes the C implementation of the poisson variance calculations when provided an average dark current. It ensures appropriate weighting of the average dark when the average ramp is negative (due to influence of very small segments on the simple average ramp calculation) and ensures that the variance is not set to zero whenever the average ramp is below zero. Largely, it follows the same kind of modifications made to the python routine previously in https://github.com/spacetelescope/stcal/pull/255

Checklist

drlaw1558 commented 3 months ago

Adding a note that I've tested this on jw01047002001_02101_00001_mirifushort_uncal, jw01236004001_02103_00001_mirifulong_uncal, jw01523003001_03102_00001_mirifushort_uncal, and jw01970002001_02101_00003_nrs1_uncal

SCI, ERR, and VAR_POISSON for these now all match the results from the python code as expected, with and without providing an average_dark_current input.

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 83.76%. Comparing base (5772579) to head (c6703f0). Report is 180 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #269 +/- ## ========================================== - Coverage 83.79% 83.76% -0.03% ========================================== Files 35 35 Lines 6998 7004 +6 ========================================== + Hits 5864 5867 +3 - Misses 1134 1137 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

nden commented 3 months ago

Regression tests starting here: https://plwishmaster.stsci.edu:8081/job/RT/job/JWST-Developers-Pull-Requests/