-
Notifications
You must be signed in to change notification settings - Fork 76
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: Fix parsing of MANGA cube (try 2) #3119
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3119 +/- ##
==========================================
+ Coverage 88.88% 88.89% +0.01%
==========================================
Files 112 112
Lines 17391 17396 +5
==========================================
+ Hits 15458 15465 +7
+ Misses 1933 1931 -2 ☔ View full report in Codecov by Sentry. |
@havok2063 , would this work for your use case? Can you please try it out? Thanks! |
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.
Tested this on a few manga cubes and it works for me well enough. This fix and approach seems reasonable to me.
flux_viewer_reference_name=flux_viewer_reference_name, | ||
uncert_viewer_reference_name=uncert_viewer_reference_name | ||
) | ||
except Exception: # nosec |
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.
can we do anything more specific than general exception that won't result in catching generic typos, etc?
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.
@rosteen , any idea? I don't think there is a way to know if any arbitrary input is going to succeed/fail the specutils I/O registry until you actually do it.
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.
but is there even a specific extension exception we can catch instead of the catch-all?
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.
If you mean exception, I purposely make it general here to be backward compatible. If specutils cannot parse for whatever reason, it goes back to the old way (until we can get rid of it because I think we should).
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.
"But is there a cleaner solution?"
Yes, there is. We can write a custom parser for each format that specutils cannot read. But I don't have that list or time.
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.
My concern is just that some random bug or typo could result in the except always being triggered and we have no way of knowing that or noticing it in the tests. Maybe for now just a snackbar if the except is entered and then could check for that snackbar message in test coverage could do?
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 do not see how that is worse than what we already have. Currently, it goes through our own HDU parser anyway. With this change, it would still do that and then still crash like it would currently if both specutils and HDU parser cannot handle it. The only difference introduced by this PR is that it tries specutils first. A snackbar message before fallback would just be confusing if it ends up succeeding later.
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.
agreed from the user-perspective, I'm more concerned about testing and ending up with stale code without noticing (or just not clear which path a file took). But as long as there is a plan to consolidate these later, I guess this is fine for now. Thanks!
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 think @rosteen is going to end up refactoring this for his specutils 2.0 work?
flux_viewer_reference_name=flux_viewer_reference_name, | ||
uncert_viewer_reference_name=uncert_viewer_reference_name | ||
) | ||
except Exception: # nosec |
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.
same as above
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.
Replied at #3119 (comment)
92bf92a
to
f34b786
Compare
Rebased to get rid of merge conflicts. |
Thanks for the reviews! |
Description
This pull request is to fix loading MANGA cube in Cubeviz. Since Brian C said it works on Jdaviz 3.10 series, probably no need to backport.
This supersedes #3115 and takes advantage of the loaders that already exist in
specutils
when we can, like Brian Cherinka suggested. Also convert uncert type to stddev when we can, like Brett Morris suggested.I tried to get rid of
_parse_hdulist
altogether but too many tests failed, so I kept it as a fallback.Also fixed a Marker display bug where wavelength shows as
0.000 m
, which is very uninformative.Change log entry
CHANGES.rst
? If you want to avoid merge conflicts,list the proposed change log here for review and add to
CHANGES.rst
before merge. If no, maintainershould add a
no-changelog-entry-needed
label.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.
trivial
label.