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

Skip flux conversion for moment maps #3158

Merged
merged 2 commits into from
Aug 26, 2024

Conversation

rosteen
Copy link
Collaborator

@rosteen rosteen commented Aug 20, 2024

Looks like #3139 broke adding moment maps to a viewer, due to the coords_info logic. This skips the flux conversion that breaks it in the case of moment-like units (velocity and higher powers of it) by skipping any unit with incompatible physical type.

Additionally, calculating moment 0 in flux when the cube is in surface brightness seemed to be broken (again?) so I moved the unit conversion to be before the moment calculation, so we can convert, e.g., MJy/sr to MJy and not have to worry about the extra wavelength unit that comes in via the moment calculation.

I also took this opportunity to bump the specutils pin and get rid of the handling for the change in 1.16 for the dev tests and such.

@rosteen rosteen added bug Something isn't working plugin Label for plugins common to multiple configurations labels Aug 20, 2024
@rosteen rosteen added this to the 4.0 milestone Aug 20, 2024
@kecnry
Copy link
Member

kecnry commented Aug 20, 2024

Does any of this overlap or conflict with #3116? (cc @bmorris3)

@rosteen
Copy link
Collaborator Author

rosteen commented Aug 20, 2024

Whoops, it almost certainly does. I should have stuck to fixing the first bug I found 😆

@rosteen
Copy link
Collaborator Author

rosteen commented Aug 20, 2024

I could split out the changes to coords_info.py, @bmorris3 should check this to make sure I was actually fixing the same things, if I wasn't the other changes can stay.

@rosteen rosteen added the no-changelog-entry-needed changelog bot directive label Aug 20, 2024
@rosteen
Copy link
Collaborator Author

rosteen commented Aug 20, 2024

Alright, after talking with @bmorris3 offline I dropped the stuff that overlapped with #3116 and kept the fix to the mouseover for things in incompatible units like velocity.

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.

If there's any way to get an easy regression test, that would be great to add!

Comment on lines +488 to +499
if str(u.Unit(unit).physical_type) not in ("spectral flux density",
"surface brightness"):
skip_spectral_density_eqv = True
Copy link
Member

Choose a reason for hiding this comment

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

if this is the only exception, this probably could be shortened to be directly in the if-statement itself, but that's probably a matter of preference.

Copy link
Contributor

@pllim pllim left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@pllim
Copy link
Contributor

pllim commented Aug 26, 2024

There is a conflict. Please rebase.

Copy link

codecov bot commented Aug 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.42%. Comparing base (a9b559b) to head (535727f).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3158   +/-   ##
=======================================
  Coverage   88.42%   88.42%           
=======================================
  Files         122      122           
  Lines       18264    18267    +3     
=======================================
+ Hits        16150    16153    +3     
  Misses       2114     2114           

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

@rosteen rosteen merged commit c3d0c81 into spacetelescope:main Aug 26, 2024
19 checks passed
cshanahan1 pushed a commit to cshanahan1/jdaviz that referenced this pull request Sep 9, 2024
* Skip flux conversion for moment maps

* More general check on unit physical type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cubeviz imviz no-changelog-entry-needed changelog bot directive 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.

3 participants