jwst
jwst copied to clipboard
Jp 3088 fix bunit_data and bunit_err for MOS data products
Resolves JP-3088
Closes #7792
This PR updates exp_to_source to correctly populate the bunit_data and bunit_err values to the slit data.
Checklist for maintainers
- [x] added entry in
CHANGES.rst
within the relevant release section - [ ] updated or added relevant tests
- [ ] updated relevant documentation
- [x] added relevant milestone
- [x] added relevant label(s)
- [x] ran regression tests, post a link to the Jenkins job below. How to run regression tests on a PR
- [ ] Make sure the JIRA ticket is resolved properly
@hbushouse @tapastro This approach was the easiest way to get the bunit_data and bunit_err in the output of the MOS slit data. Because the top level meta data of the multislit data now has None for these values the None value was getting copied to the slit data in the exp_to_source code, specifically the merge_tree code on stdatamodels. I was concerned with update the merge_tree code and breaking some other code. The bunit values are handled differently than other meta data to I just updated each of them in exp_to_source. I was also concerned about making nay major changes to how the headers of the slits are filled in because again I did not want to break any down stream code. Let me know if this seems "good enough" I am starting a regression test
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 75.45%. Comparing base (
4cc0ac1
) to head (fec33a6
). Report is 20 commits behind head on master.
:exclamation: Current head fec33a6 differs from pull request most recent head 4dca8d6. Consider uploading reports for the commit 4dca8d6 to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## master #8294 +/- ##
==========================================
+ Coverage 75.15% 75.45% +0.29%
==========================================
Files 470 474 +4
Lines 38604 39077 +473
==========================================
+ Hits 29014 29484 +470
- Misses 9590 9593 +3
Flag | Coverage Δ | *Carryforward flag | |
---|---|---|---|
nightly | 77.34% <ø> (-0.06%) |
:arrow_down: | Carriedforward from a462697 |
*This pull request uses carry forward flags. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Running regression tests again (now with wcsinfo also saved) https://plwishmaster.stsci.edu:8081/job/RT/job/JWST-Developers-Pull-Requests/1247/
@hbushouse @tapastro The regression tests had many errors that I do not understand. Maybe they are unrelated to this PR and I should run the regression tests again: failed on setup with "RecursionError: maximum recursion depth exceeded while calling a Python object" https://plwishmaster.stsci.edu:8081/job/RT/job/JWST-Developers-Pull-Requests/1247/#showFailuresLink
Thanks for linking the run. Likely most of those failures were due to the 1.10.0 stdatamodels release. The issue is fixed in: https://github.com/spacetelescope/jwst/pull/8322 (which is now merged). The short explanation is the release pushed the version outside the acceptable version range for jwst causing an older, incompatible version of stdatamodels to be installed causing the errors.
regression Tests running: https://plwishmaster.stsci.edu:8081/job/RT/job/JWST-Developers-Pull-Requests/1251/
Trying regression tests again with Tyler's suggestion. https://plwishmaster.stsci.edu:8081/job/RT/job/JWST-Developers-Pull-Requests/1267/
@tapastro I am still struggling with the regression tests. This is what I have in the exp_to_source.py - does that seem right to you - or did I misunderstand how to copy the wcsinfo. slit_bunit = slit.meta.bunit_data slit_bunit_err = slit.meta.bunit_err slit_model = slit.meta.model_type slit_wcsinfo = slit.meta.wcsinfo.instance # exposure.meta.bunit_data and bunit_err does not exist # before calling merge_tree save these values # Before merge_tree the slits have a model_type of SlitModel. # After merge_tree it is overwritten with MultiSlitModel. # store the model type to undo overwriting of modeltype.
merge_tree(result_slit.exposures[-1].meta.instance, exposure.meta.instance)
result_slit.exposures[-1].meta.bunit_data = slit_bunit
result_slit.exposures[-1].meta.bunit_err = slit_bunit_err
result_slit.exposures[-1].meta.model_type = slit_model
result_slit.exposures[-1].meta.wcsinfo.instance = slit_wcsinfo
You may want to try the assignment line without the instance:
result_slit.exposures[-1].meta.wcsinfo = slit_wcsinfo
I can try running the tests locally too.
@jemorrison What's the latest regression test run for this one? The last one I see reference here is 1267, which still has all the recursion errors in it.
The latest regression test is: 1280 https://plwishmaster.stsci.edu:8081/job/RT/job/JWST-Developers-Pull-Requests/1280/#showFailuresLink I will rebase and run again to get the cleanest version
Goodness the run I did yesterday (after rebasing) still resulted in 236 failures- 1294 Again it seems related to another PR. So trying this again -1298.
The results from https://plwishmaster.stsci.edu:8081/job/RT/job/JWST-Developers-Pull-Requests/1280/ look fine. Of the 58 failures, about half are unrelated and benign, due to a change in the resample step to remove the use of the TEXPTIME keyword, and the rest are all expected changes from this PR that either adds BUNIT keywords to SCI and ERR headers where they didn't exist before, or give them the correct values (DN/s in the past, now updated to MJy or MJy/sr). So I think that all looks good.
Latest regtest run (1298) shows only the expected updates involving BUNIT keywords. So this looks good. I'll approve and merge.