-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
update y axis label based on unit type #2703
Conversation
elif y_unit.is_equivalent(u.erg / (u.s * u.cm**2 * u.Hz)): | ||
flux_unit_type = 'Flux' | ||
elif y_unit.is_equivalent(u.e / u.s): | ||
flux_unit_type = "Counts" |
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.
"counts" is very ambiguous by STScI standard. I don't think this is correct.
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.
given that the unit is also in the label, I think this is probably ok?
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2703 +/- ##
=======================================
Coverage 90.83% 90.84%
=======================================
Files 163 164 +1
Lines 21502 21524 +22
=======================================
+ Hits 19532 19553 +21
- Misses 1970 1971 +1 ☔ 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.
I think it is also a matter of how consistent we want to be w.r.t. y_unit.physical_type
that you get from astropy.units
. If consistency isn't a concern, then what you have is fine.
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.
Do we need tests?
I think you can access |
added tests |
d8f0d6e
to
fd32aeb
Compare
Thanks! Won't catch edge cases like |
bffb96d
to
998861a
Compare
devdeps failure is unrelated (glue-viz/glue-jupyter#421) |
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.
Definitely an improvement and we can always iterate or move to somewhere more general (for all axes in all viewers) down the road. Thanks for finding and fixing this!
Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com> Update jdaviz/configs/specviz/plugins/viewers.py Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com>
90ac492
to
fdd00a5
Compare
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.
LGTM. Thanks!
Check unit type (e.g flux density, surface brightness, counts, etc) for generating display label for the y axis in spectral viewer. Previously it was hard coded to always display 'flux density' no matter the input unit.
Closes #2701