-
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
Fix unit conversion from flux to surface brightness #2888
Conversation
My reasoning for having the additional conditional statements for checking the original units on the data is because the data item from the data collection does not update (nor the units). The numpy array that makes up I did test this PR locally and the behavior does seem to function as expected. I did double check to see what happens to |
This is not always true - in particular in the case of the min/max limits, glue will take the existing limits and convert them to the native data units and then to new units - which means that for one of the calls to |
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.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2888 +/- ##
==========================================
- Coverage 88.70% 88.69% -0.01%
==========================================
Files 111 111
Lines 17125 17122 -3
==========================================
- Hits 15190 15187 -3
Misses 1935 1935 ☔ View full report in Codecov by Sentry. |
@kecnry per this comment related to CI, they are the 2 same failures here so I will also merge: #2897 (comment) |
@astrofrog , this actually added 9 new failures to the devdeps failures galore. See https://github.com/spacetelescope/jdaviz/actions/runs/9292738683/job/25574299461 Ignore these 2:
|
@pllim - ok I'll take a look at these failures |
@pllim - are you sure these aren't due to astropy/specutils#1141? |
Yes the errors:
seem to be related to astropy/specutils#1141 (cc @rosteen) |
BTW yeah, not caused by this PR after all. Sorry for the noise! #2905 |
Description
While looking at issues with limits not updating when changing to certain units, I spotted an unrelated issue. In
to_unit
, the units on the original data should be irrelevant, and if glue asks for a conversion from e.g. Jy to MJy, we should ignore the original units on the data, since they might already have been previously converted to Jy which is why glue is asking for Jy to MJy. So looking at spec.unit.bases is not the right thing to do. A lot of the change here is indentation so be sure to check the diff ignoring whitespace.I've expanded the test for to_unit.
There are other issues with the
to_unit
code as written currently, but I thought I'd break it up into conceptual chunks.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.