glue-viz / glue-astronomy

Plugin to add astronomy-specific functionality to glue
https://glue-astronomy.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
11 stars 12 forks source link

Support Spectrum1D objects with 2D data and 1D WCS #41

Closed astrofrog closed 2 years ago

astrofrog commented 2 years ago

This adds a way to translate Spectrum1D objects with 1D spectral WCS and 2D datasets to glue objects and back, and is needed for https://github.com/spacetelescope/jdaviz/pull/733. In future we should just support ND datasets with 1D WCS but the code for that will be a bit more complex and it would be easier to just wait for a release of NDCube so that we can use the compound WCS class from there. For now this PR makes it possible to support 2D spectra.

This also removes the use of SpectralCoordinate in to_data as glue and Spectrum1D now both support GWCS.

codecov[bot] commented 2 years ago

Codecov Report

Merging #41 (e26342b) into main (90f6376) will decrease coverage by 1.40%. The diff coverage is 91.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #41      +/-   ##
==========================================
- Coverage   95.84%   94.43%   -1.41%     
==========================================
  Files          15       15              
  Lines        1034     1114      +80     
==========================================
+ Hits          991     1052      +61     
- Misses         43       62      +19     
Impacted Files Coverage Δ
glue_astronomy/translators/spectrum1d.py 89.05% <86.88%> (-7.38%) :arrow_down:
...lue_astronomy/translators/tests/test_spectrum1d.py 91.33% <100.00%> (-3.79%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 90f6376...e26342b. Read the comment docs.

pllim commented 2 years ago

Did this break jdaviz? 😬 spacetelescope/jdaviz#837

astrofrog commented 2 years ago

Yes because we now leave GWCS objects untouched instead of transforming to SpectralCoordinate. I think jdaviz needs to be updated to reflect this.