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

Enable contour unit conversion #3149

Merged
merged 14 commits into from
Aug 23, 2024

Conversation

rosteen
Copy link
Collaborator

@rosteen rosteen commented Aug 13, 2024

This pulls out the contour-relevant code from #2702 and resolves a couple issues I ran into, as well as adding a test for the contour unit conversion. Requires glue-viz/glue-jupyter#461 so we'll need a glue-jupyter release.

@rosteen rosteen added Upstream fix required plugin Label for plugins common to multiple configurations labels Aug 13, 2024
@rosteen rosteen added this to the 4.0 milestone Aug 13, 2024
@rosteen
Copy link
Collaborator Author

rosteen commented Aug 13, 2024

I cancelled the CI for now, since we know they'll fail without the glue-jupyter release.

@rosteen rosteen marked this pull request as ready for review August 15, 2024 16:47
@rosteen
Copy link
Collaborator Author

rosteen commented Aug 15, 2024

Marked as ready for review, reminder that you need glue-jupyter main to test, and merging is blocked by glue-jupyter release.

Copy link
Contributor

@gibsongreen gibsongreen left a comment

Choose a reason for hiding this comment

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

Bear a glue release, these changes worked for me in testing, great job!

@pllim
Copy link
Contributor

pllim commented Aug 16, 2024

Are we then stuck until glue release happens? 😏

p.s. Please rebase to remove change log conflict.

@rosteen rosteen force-pushed the contour-unit-conversion branch from 83553bf to ab25778 Compare August 20, 2024 13:55
Copy link
Member

@kecnry kecnry left a comment

Choose a reason for hiding this comment

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

Seems to work well - thanks!

Comment on lines 300 to 302
# DQ layer doesn't play nicely with this attribute
if "DQ" in layer.layer.label:
continue
Copy link
Member

Choose a reason for hiding this comment

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

I'm guessing masks don't either.... could we instead check the units on the layer to make sure they're surface brightness? Eventually we might need to generalize this method to also set display units for images in velocity, etc (from moment maps), but that isn't enabled in unit conversion yet, so is probably safe to ignore.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added a second check below for surface brightness - we know DQ doesn't work, so might as well do the fast check first for that still?

Comment on lines +276 to +279
# Always send a surface brightness unit to contours
if self.flux_or_sb_selected == 'Flux':
yunit = self._append_angle_correctly(yunit, self.angle_unit.selected)
self._find_and_convert_contour_units(yunit=yunit)
Copy link
Member

Choose a reason for hiding this comment

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

what if _find_and_convert_contour_units just observed sb_unit_selected which already handles this logic?

Copy link
Member

Choose a reason for hiding this comment

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

we discussed that unit conversion probably needs some code moving soon anyways, so I'm fine deferring this until then

@kecnry
Copy link
Member

kecnry commented Aug 23, 2024

(looks like a test needs updating before merge, but assuming that is just the typo fix, approval stands)

@rosteen
Copy link
Collaborator Author

rosteen commented Aug 23, 2024

(looks like a test needs updating before merge, but assuming that is just the typo fix, approval stands)

It's a real failure, I didn't account for subsets existing when units are converted. Should be a quick fix.

Copy link

codecov bot commented Aug 23, 2024

Codecov Report

Attention: Patch coverage is 88.46154% with 3 lines in your changes missing coverage. Please review.

Project coverage is 87.21%. Comparing base (95d6008) to head (0bed8ba).
Report is 141 commits behind head on main.

Files with missing lines Patch % Lines
...specviz/plugins/unit_conversion/unit_conversion.py 88.46% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3149      +/-   ##
==========================================
- Coverage   88.82%   87.21%   -1.62%     
==========================================
  Files         112      122      +10     
  Lines       17626    18284     +658     
==========================================
+ Hits        15657    15947     +290     
- Misses       1969     2337     +368     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@rosteen rosteen merged commit 2160823 into spacetelescope:main Aug 23, 2024
17 of 19 checks passed
cshanahan1 pushed a commit to cshanahan1/jdaviz that referenced this pull request Sep 9, 2024
* Add Jesse's first pass code

* Debugging

* Debugging

* No longer errors but the contour labels still don't update

* Now working with glue-jupyter main, added test

* Changelog

* Codestyle

* Remove debugging print statements

* Update glue-jupyter pin

* Don't loop through all viewers if not necessary

* Skip anything not in surface brightness

* Update jdaviz/configs/specviz/plugins/unit_conversion/unit_conversion.py

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>

* Skip subset layers

* Codestyle

---------

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cubeviz plugin Label for plugins common to multiple configurations Ready for final review specviz
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants