-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JP-3547: Flux conservation for spectral resampling #8596
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8596 +/- ##
==========================================
+ Coverage 60.16% 60.47% +0.30%
==========================================
Files 370 369 -1
Lines 38667 38408 -259
==========================================
- Hits 23265 23226 -39
+ Misses 15402 15182 -220 ☔ View full report in Codecov by Sentry. |
Started regression tests here: |
Regression tests showed a problem with data centering for some spec3 data sets (e.g. in s2d products for test_nirspec_mos_fs_spec3). I pushed a fix and started another run here: |
23b945f
to
fe21641
Compare
Restarted regression tests here: There were some unrelated failures for reference file changes in the last run. |
Co-authored-by: Ned Molter <[email protected]>
Yes, has been added to this PR but it was not in the original (on master) code. |
I think I finally figured out the math that justifies why the scaling must be
then, the resampled image' grid along the spectral axis will be, thanks to
Also see jwst/jwst/resample/resample_spec.py Lines 91 to 99 in ce95ab6
So, if data are not in units of spectral density (i.e., At first glance NIRSPEC data are not affected by this unless user-provided One more issue: reported pixel area as computed/reported in jwst/jwst/resample/resample_spec.py Lines 192 to 195 in 6b6f4f2
may be incorrect. In the resampled image, the grid along the spatial axis is a grid along the slit and it is a 1D thing. There is no "area" here at first glance but in reality, each "pixel" along the spectral axis was integrated in the direction perpendicular to the slit. So, I wonder whether self.blank_output.meta.photometry.pixelarea_steradians should be multiplied by slit width. Of course this is not needed if nominal_area = self.input_models[0].meta.photometry.pixelarea_steradians already takes into account slit width.
|
The units are in density, in the spectral axis. Jy is a flux density unit (10^−26 W m−2 Hz−1). Only the spatial area changes need to be accounted for for flux conservation. |
I wrestled with that too, developing this. The nominal_area, set in the photom step, takes into account the slit width, which is not otherwise recorded anywhere in the data model (that I could find). I initially thought we might need to apply a direct update to the nominal area based on the WCS, the way you did for imaging, but eventually realized it wasn't possible for this reason. The nominal area includes the slit width, the WCS does not. That's why my changes to the resample_spec init function are structured the way they are: pixel_ratio can relatively correct the nominal area, for one of the spatial axes, but we can't compute a whole new spatial area from the WCS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am satisfied with provided responses and proposed changes make sense. Thanks!
Thanks so much for your thoughtful review @mcara! I really appreciate you taking the time to work it through with me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just one question, for my education.
Resolves JP-3547
Resolves JP-3544
Resolves JP-3328
Closes #8297
Closes #8293
Closes #7790
Several fixes associated with spectral flux conservation through resampling. Also added missing documentation for spectral resampling modules.
For NIRSpec:
For MIRI:
For both:
Checklist for PR authors (skip items if you don't have permissions or they are not applicable)
CHANGES.rst
within the relevant release sectionHow to run regression tests on a PR