Closed brechmos-stsci closed 5 years ago
I looked at it this afternoon. It is not an issue with spectral-cube. Spectral-cube returns data with units. The problem is that in the code after the moment call we are using data.value
and so stripping the units (https://github.com/spacetelescope/cubeviz/blob/master/cubeviz/tools/moment_maps.py#L102). The data.value
variable is then passed into another method as component_data
and then added to the 2D container (around line https://github.com/spacetelescope/cubeviz/blob/master/cubeviz/tools/common.py#L27). So, I'll have to see about units for the container_2d
and/or talk with @astrofrog to see if this is an easy fix.
I think the key is that here:
https://github.com/spacetelescope/cubeviz/blob/master/cubeviz/tools/common.py#L27
you should initialize a Component
class manually and you can set units on it, then pass that to add_component
. The Component
initialized takes units
:
https://github.com/glue-viz/glue/blob/master/glue/core/component.py#L31
One note on this, the cube collapse is affected by this too. So we'll have to make sure any change fixes it as well.
Closed by #525
The moment maps calculations do not have units. It seems the underlying spectral-cube moment map calculation has units so it might be something in the code here-in. So, need to see why moment maps calculated in cubeviz are unit-less.