The unit management code in cubeviz is quite complicated and a bit difficult to reason about and maintain.
It also seems to duplicate a lot of logic that must also exist in specviz. Specviz can handle conversion of both spectral axis and flux units. Currently, the results of these operations in specviz are propagated back to cubeviz.
So, the question is, why maintain a bunch of separate logic in cubeviz for this? We could simply allow specviz to handle all unit conversions, and then populate the appropriate fields in cubeviz with the results. If necessary we could still retain UI elements related to this in the main cubeviz window, but they would simply call into functionality in specviz.
As @nmearl mentioned in a conversation on slack, the one caveat to this is that cubeviz allows the units of the underlying data object to be converted as well (in contrast to simply updating the displayed units). So this would still need to be handled on the cubeviz side somehow, but could still be simplified greatly.
This is an idea for an improvement.
The unit management code in cubeviz is quite complicated and a bit difficult to reason about and maintain.
It also seems to duplicate a lot of logic that must also exist in specviz. Specviz can handle conversion of both spectral axis and flux units. Currently, the results of these operations in specviz are propagated back to cubeviz.
So, the question is, why maintain a bunch of separate logic in cubeviz for this? We could simply allow specviz to handle all unit conversions, and then populate the appropriate fields in cubeviz with the results. If necessary we could still retain UI elements related to this in the main cubeviz window, but they would simply call into functionality in specviz.
As @nmearl mentioned in a conversation on slack, the one caveat to this is that cubeviz allows the units of the underlying data object to be converted as well (in contrast to simply updating the displayed units). So this would still need to be handled on the cubeviz side somehow, but could still be simplified greatly.