-
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
Add test that triggers handle_display_units bug #2910
Add test that triggers handle_display_units bug #2910
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2910 +/- ##
==========================================
+ Coverage 88.76% 88.77% +0.01%
==========================================
Files 111 111
Lines 17178 17194 +16
==========================================
+ Hits 15248 15264 +16
Misses 1930 1930 ☔ View full report in Codecov by Sentry. |
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 good to me, will be very nice to have the changes at the helper level. Great work!
@@ -109,72 +109,76 @@ def to_unit(self, data, cid, values, original_units, target_units): | |||
spec = data.get_object(cls=Spectrum1D) | |||
|
|||
except RuntimeError: | |||
eqv = [] | |||
data = data.get_object(cls=NDDataArray) | |||
spec = Spectrum1D(flux=data.data * u.Unit(original_units)) |
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.
Should we pass along the attributes for spectral axis, meta, or WCS, too? There are places within the methods below that call Spectrum1D's spectral_axis
and meta
, so we might need to make sure those get passed in here too.
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.
What value should I pass for the spectral_axis
parameter? Otherwise yes that makes sense.
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.
Good question. We could pull it out of the wcs
by getting out the spectral component of the coordinates, and evaluate it on the integer pixel grid.
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 I'm pretty sure if you give Spectrum1D the WCS without separately specifying spectral axis, it will do that parsing for you.
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.
Adding the wcs did not work for me, would you be ok with me creating a follow-up ticket for roundtripping all relevant information? I would like to get this in soon so I can finish with #2873 and have this available for the aperture photometry work.
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.
Sure thing 💯
# TODO: Failing because of dev version of upstream dependency, figure | ||
# out which one | ||
# assert mm.calculate_moment() | ||
|
||
# TODO: This test should pass once continuum subtraction works with | ||
# flux to surface brightness conversion | ||
# mm.continuum.selected = 'Surrounding' | ||
# | ||
# assert mm.calculate_moment() |
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 tests will need to be uncommented when we make the unit conversion translator available to users. Otherwise, this PR is ready for a re-review @bmorris3 .
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. Please add a changelog entry and you're good to go.
Description
This pull request is to address a bug that exists on
main
but was made more apparent by #2873 . Currently there is just a couple lines in the unit conversion test that triggers this in CI, but the traceback can also be seen by running the following lines in the cubeviz example notebook after data has been loaded:and in a new cell after the Line Analysis plugin has opened and the continuum is visible:
la.get_results()
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.