Skip to content
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

restore column units on cast #242

Merged
merged 3 commits into from
Dec 11, 2023

Conversation

braingram
Copy link
Collaborator

@braingram braingram commented Dec 6, 2023

Resolves JP-3482

Closes [spacetelescope/jwst#8109]

When a DataModel containing a table extension is loaded from a FITS file, stdatamodels currently discards the units defined in the TUNITS headers. This is due to a _cast from a FITS_rec to a ndarray (to protect against the numerous gotchas in FITS_rec):

val = util.gentle_asarray(val, dtype, allow_extra_columns=allow_extra_columns)

then a conversion back to a FITS_rec to allow jwst code to continue to interact with a FITS_rec:
val = _as_fitsrec(val)

This PR is an alternative to #238 and a stop-gap measure until #240 can be resolved.

Checklist

  • added entry in CHANGES.rst (either in Bug Fixes or Changes to API)
  • updated relevant tests
  • updated relevant documentation
  • updated relevant milestone(s)
  • added relevant label(s)

@braingram braingram marked this pull request as ready for review December 6, 2023 21:22
@braingram braingram requested a review from a team as a code owner December 6, 2023 21:22
Copy link

codecov bot commented Dec 6, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (bbc9016) 64.78% compared to head (3dd1cfd) 64.82%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #242      +/-   ##
==========================================
+ Coverage   64.78%   64.82%   +0.04%     
==========================================
  Files         103      103              
  Lines        5688     5695       +7     
==========================================
+ Hits         3685     3692       +7     
  Misses       2003     2003              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@braingram braingram force-pushed the fitsrec_units branch 2 times, most recently from fb33f11 to da3472a Compare December 7, 2023 13:18
@braingram
Copy link
Collaborator Author

braingram commented Dec 7, 2023

Regression tests started at: https://plwishmaster.stsci.edu:8081/job/RT/job/JWST-Developers-Pull-Requests/1084/
the above tests crashed and burned due to many artifactory connection errors
I restarted them with the hope that this was transient:
https://plwishmaster.stsci.edu:8081/job/RT/job/JWST-Developers-Pull-Requests/1085/
The re-run shows 30 errors. None of which on the surface appear related to these changes. All contain the following:

E              Extra column R_MIREMI of format D in a
E              Extra column S_MIREMI of format D in a

which points towards truth files that haven't been updated yet for #200

@braingram
Copy link
Collaborator Author

@jemorrison I can't seem to request you as a reviewer but thanks again for testing out this PR and confirming that it fixed your issue. Please feel free to review/comment on the PR if you have a chance to give it a look.

@jemorrison
Copy link
Contributor

Looks reasonable to me and it works.

Copy link
Collaborator

@hbushouse hbushouse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@braingram braingram merged commit db64580 into spacetelescope:master Dec 11, 2023
21 of 22 checks passed
@braingram braingram deleted the fitsrec_units branch December 11, 2023 14:50
@hbushouse
Copy link
Collaborator

There have been a couple rounds of regtest truth file updates over the past few days, so it might be worthwhile to run this PR branch again, one last time.

@hbushouse
Copy link
Collaborator

OK, now that this has been merged, I'll just kick off a regular RT run, which will use stdatamodels/master.

@braingram
Copy link
Collaborator Author

Thanks! Sorry for the quick draw on the merge.

@hbushouse
Copy link
Collaborator

Regtest run https://plwishmaster.stsci.edu:8081/job/RT/job/JWST/2686/ shows only unrelated failures/errors. So this looks good (at least it does no obvious harm).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants