-
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
Add migrate_data script to make older x1d files readable by later versions of jwst #6055
Add migrate_data script to make older x1d files readable by later versions of jwst #6055
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6055 +/- ##
=======================================
Coverage 77.13% 77.14%
=======================================
Files 402 402
Lines 34332 34357 +25
=======================================
+ Hits 26483 26505 +22
- Misses 7849 7852 +3
*This pull request uses carry forward flags. Click here to find out more.
Continue to review full report at Codecov.
|
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 reasonable overall. At first I thought the name of the script was too generic, but then I saw that was intentional, because migrating the current x1d files is just one change allowed for. Future expansion: what a concept.
55b289a
to
64894e9
Compare
jwst/regtest/test_migrate_data.py
Outdated
@pytest.mark.parametrize("truth_path", [ | ||
"truth/test_miri_lrs_slit_spec2/jw00623032001_03102_00001_mirimage_x1d.fits", | ||
"truth/test_nirspec_mos_spec2/f170lp-g235m_mos_observation-6-c0e0_001_dn_nrs1_mod_x1d.fits", | ||
]) |
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 would add an ids=["miri-lrs-x1d", "nirspec-mos-x1d"]
to this parametrize call, so that the verbose output is readable. See
https://docs.pytest.org/en/6.2.x/example/parametrize.html#different-options-for-test-ids
scripts/migrate_data
Outdated
def migrate_spec_model_1_1_0(hdul): | ||
for hdu in hdul: | ||
if hdu.name == "EXTRACT1D": | ||
hdu.data = rebuild_spec_table(hdu.data) | ||
|
||
|
||
def migrate_multispec_model_1_1_0(hdul): | ||
for hdu in hdul: | ||
if hdu.name == "EXTRACT1D": | ||
hdu.data = rebuild_spec_table(hdu.data) |
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.
These functions are identical. Is there a reason they are differently-named? Can't the _MIGRATE_METHODS
dict below point to a single function for the two different datamodel classes?
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.
Hmm... good point, I thought I was going to need different logic for MultiSpecModel but they sure are identical.
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 made the exact same discovery when writing the readers for specutils
for these a year ago. 😅
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.
This looks great. And the updates to RegtestData
are a nice enhancement as well. 🚀
a0fa600
to
159f414
Compare
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.
LGTM
Should be ready to merge, after fixing conflicts in change log. |
159f414
to
3e4f4fe
Compare
Description
This PR adds a
migrate_data
script that will update the EXTRACT1D table to the new format introduced in #6014. It needs documentation and a test of some kind, but I'd like to get feedback first in case I need to make significant changes to the script.Checklist
Tests
Documentation
Change log
Milestone
Label(s)