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

add spectral unit to moment map 0 display unit, simplify logic #3211

Merged
merged 1 commit into from
Oct 5, 2024

Conversation

cshanahan1
Copy link
Contributor

@cshanahan1 cshanahan1 commented Oct 2, 2024

There was previously an issue where the moment map plugin was using the spectral y axis unit for moment 0 rather than always using a surface brightness unit. This was fixed in #3156.

This PR applies some of the changes from #3116, which also fixed that issue but based on an outdated main pre many unit conversion changes, so I found it easier to cherry pick some of the code here rather than rebasing that PR.

The display unit now has the spectral unit because specutils is pinned to the version with the fix for MM units. I made some small tweaks including using _get_display_unit rather than grabbing the UC plugin from the MM plugin and accessing display unit there.

I think sufficient test coverage was added in #3156 so i didn't add the tests from #3116, but i did expand one of the tests to test that the moment map plugin has the correct units when spectral unit is changed (previously was just testing when flux unit was changed)

This will close JDAT 4651 and #3116

Closes #3116.

@github-actions github-actions bot added cubeviz plugin Label for plugins common to multiple configurations labels Oct 2, 2024
@cshanahan1 cshanahan1 added this to the 4.0 milestone Oct 2, 2024
@cshanahan1 cshanahan1 marked this pull request as ready for review October 2, 2024 19:22
Copy link

codecov bot commented Oct 2, 2024

Codecov Report

Attention: Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.

Project coverage is 88.50%. Comparing base (21e9b87) to head (135a58b).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...configs/cubeviz/plugins/moment_maps/moment_maps.py 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3211      +/-   ##
==========================================
- Coverage   88.51%   88.50%   -0.01%     
==========================================
  Files         125      125              
  Lines       18694    18697       +3     
==========================================
+ Hits        16547    16548       +1     
- Misses       2147     2149       +2     

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

full_spectrum = self.app._jdaviz_helper.get_data(self.dataset.selected,
use_display_units=True)
full_spectrum = self.app._jdaviz_helper.get_data(self.dataset.selected)
Copy link
Member

Choose a reason for hiding this comment

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

is this (and the other removal below) because the marks are handling the unit conversion themselves?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes i believe so (but also cc @bmorris3) . I also verified this change doesn't break anything in line analysis where this mixin is also used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

also see https://jira.stsci.edu/browse/JDAT-4830, this bug was not introduced with this change

Copy link
Member

Choose a reason for hiding this comment

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

see #3212 for the fix to moment map continuum previews during unit conversion. Whichever PR makes it in second should rebase and ensure that is still working as expected.

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.

LGTM - would like to have @bmorris3 review before merging, if possible, just to make sure we're not missing anything from that original PR.

Copy link
Contributor

@bmorris3 bmorris3 left a comment

Choose a reason for hiding this comment

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

Here are some differences with #3116 for @cshanahan1 to double check. Otherwise all good by me.

Copy link
Contributor

@bmorris3 bmorris3 Oct 4, 2024

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. fixed, removed Flux from options
  2. i see this correctly removing flux as an option already
  3. I intentionally omitted this because I found it to work without it, and I new @kecnry did some work recently on units with an empty viewer so I figured thats why it was now working

@cshanahan1
Copy link
Contributor Author

I have no idea why 3.12 tests are failing

@pllim
Copy link
Contributor

pllim commented Oct 4, 2024

I think scipy dev wheel is broken again. You can ignore it.

@cshanahan1
Copy link
Contributor Author

in that case im going to merge this, if i can find some consequence of not subscribing to AddDataMessage i'll follow up but i don't see any issues

Co-authored-by: bmorris3 <bmmorris@stsci.edu>
@cshanahan1 cshanahan1 merged commit a9cd7b5 into spacetelescope:main Oct 5, 2024
18 of 19 checks passed
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants