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

Make jdaviz unit converter more robust to different data types #2811

Closed
2 tasks
astrofrog opened this issue Apr 16, 2024 · 1 comment · Fixed by #2820
Closed
2 tasks

Make jdaviz unit converter more robust to different data types #2811

astrofrog opened this issue Apr 16, 2024 · 1 comment · Fixed by #2820
Labels
bug Something isn't working cubeviz specviz

Comments

@astrofrog
Copy link
Collaborator

astrofrog commented Apr 16, 2024

The issue highlighted in #2805 was identified as being due to the new glue-core v1.19.0 release. In fact, there is no bug in glue v1.19.0 as such, but there are now more cases where the unit conversion machinery is called. However, the unit converter in jdaviz is not sufficiently robust, and the following fails if the data is a 2D image with no spectral component:

jdaviz/jdaviz/app.py

Lines 91 to 98 in 620ccfe

def to_unit(self, data, cid, values, original_units, target_units):
# Given a glue data object (data), a component ID (cid), the values
# to convert, and the original and target units of the values, this method
# should return the converted values. Note that original_units
# gives the units of the values array, which might not be the same
# as the original native units of the component in the data.
if cid.label == "flux":
spec = data.get_object(cls=Spectrum1D)

To work with glue-core v1.19.0, the unit converter will need to be made a little more robust and not assume that any dataset that has a flux also has a spectral axis.

There is a separate issue here that 0-d WCSes should not emit errors deep in astropy.wcs but that is another matter (astropy/astropy#16298)

🐱

@pllim
Copy link
Contributor

pllim commented Apr 16, 2024

I am not satisfied with #2812 but not sure how to proceed.

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 specviz
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants