Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(This is needed for #3144)
This fixes an issues where the moment map plugin was incorrectly picking up changes to display unit. It was responding to changes in the spectral y axis, including toggling between flux and surface brightness. The outputs of moment 0 should always be the same type (flux or sb) as the data units (which will, after 3144 is merged, always be surface brightness), and should not be tied to what the spectrum viewer axis is toggled to. Additionally, units were being obtained on global display unit changed and again when moment map was computed, which wasn't necessary to do.
These issues were causing moment map calculation to fail for any cubes loaded in surface brightness units (to reproduce this bug, try calculating a 0th moment with the cubeviz example notebook, it fails). This wasn't being picked up by tests because all the tests fixtures used in moment map tests have cubes that are in flux units. The basic moment map test is now being tested with a cube in Jy, and one in Jy / sr.