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

BUG: Metadata viewer to ignore invalid FITS header #1342

Merged
merged 1 commit into from
May 24, 2022

Conversation

pllim
Copy link
Contributor

@pllim pllim commented May 24, 2022

Description

This pull request is to avoid Metadata Viewer from crashing when user loads a file with invalid FITS header. Also see spacetelescope/dat_pyinthesky#177 . This is split from #1333 . As noted in the other PR, I have a very hard time creating invalid FITS header by hand and I do not want to download a whole cube to test this one thing, so I did not add any test.

This fixes an unreleased feature (#1325), so it does not need a change log.

Would be nice to merge this fast so I can build #1333 on top of this.

Checklist for package maintainer(s)

This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.

  • Are two approvals required? Branch protection rule does not check for the second approval. If a second approval is not necessary, please apply the trivial label.
  • Do the proposed changes actually accomplish desired goals? Also manually run the affected example notebooks, if necessary.
  • Do the proposed changes follow the STScI Style Guides?
  • Are tests added/updated as required? If so, do they follow the STScI Style Guides?
  • Are docs added/updated as required? If so, do they follow the STScI Style Guides?
  • Did the CI pass? If not, are the failures related?
  • Is a change log needed? If yes, is it added to CHANGES.rst?
  • Is a milestone set?
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)?

@pllim pllim added bug Something isn't working trivial Only needs one approval instead of two no-changelog-entry-needed changelog bot directive labels May 24, 2022
@pllim pllim added this to the 2.6 milestone May 24, 2022
@pllim pllim changed the title BUG: Metadata viewer ignores invalid FITS header BUG: Metadata viewer to ignore invalid FITS header May 24, 2022
@codecov
Copy link

codecov bot commented May 24, 2022

Codecov Report

Merging #1342 (2e1e505) into main (dcebb9a) will decrease coverage by 0.25%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1342      +/-   ##
==========================================
- Coverage   84.89%   84.64%   -0.26%     
==========================================
  Files          91       91              
  Lines        7877     7878       +1     
==========================================
- Hits         6687     6668      -19     
- Misses       1190     1210      +20     
Impacted Files Coverage Δ
jdaviz/utils.py 92.20% <100.00%> (-1.22%) ⬇️
...s/default/plugins/model_fitting/fitting_backend.py 77.90% <0.00%> (-15.12%) ⬇️
...configs/default/plugins/data_tools/file_chooser.py 65.71% <0.00%> (-3.43%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dcebb9a...2e1e505. Read the comment docs.

Copy link
Collaborator

@rosteen rosteen left a comment

Choose a reason for hiding this comment

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

Are there other exceptions this might hit than the VerifyError I saw? Or do you think it's just not worth importing VerifyError from...wherever that lives? EDIT: this is in reference to the except Exception, didn't comment inline for some reason.

@pllim
Copy link
Contributor Author

pllim commented May 24, 2022

@rosteen , I could specifically check for VerifyError (it is from astropy.io.fits, I think) if you want. But that means it is going to crash if the header raises a slightly different exception for whatever reason.

Copy link
Collaborator

@rosteen rosteen left a comment

Choose a reason for hiding this comment

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

I think I'm ok with it this way.

@rosteen rosteen merged commit 84ddff9 into spacetelescope:main May 24, 2022
@pllim pllim deleted the meta-no-crash-on-invalid branch May 24, 2022 16:48
@pllim
Copy link
Contributor Author

pllim commented May 24, 2022

Thanks for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no-changelog-entry-needed changelog bot directive trivial Only needs one approval instead of two
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants