Skip to content

Commit

Permalink
Merge pull request #45 from astrofrog/gwcs-spec
Browse files Browse the repository at this point in the history
Add back use of SpectralCoordinate to wrap GWCS for now
  • Loading branch information
astrofrog authored Sep 3, 2021
2 parents 91a2013 + 728a904 commit 4ae6e0a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion glue_astronomy/translators/spectrum1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from glue.config import data_translator
from glue.core import Data, Subset

from gwcs import WCS as GWCS

from astropy.wcs import WCS
from astropy import units as u
from astropy.wcs import WCSSUB_SPECTRAL
Expand Down Expand Up @@ -122,7 +124,9 @@ def to_data(self, obj):
data['flux'] = np.swapaxes(obj.flux, -1, 0)
data.get_component('flux').units = str(obj.unit)
else:
if obj.flux.ndim == 2 and obj.wcs.world_n_dim == 1:
if obj.flux.ndim == 1 and obj.wcs.world_n_dim == 1 and isinstance(obj.wcs, GWCS):
data = Data(coords=SpectralCoordinates(obj.spectral_axis))
elif obj.flux.ndim == 2 and obj.wcs.world_n_dim == 1:
data = Data(coords=PaddedSpectrumWCS(obj.wcs))
else:
data = Data(coords=obj.wcs)
Expand Down

0 comments on commit 4ae6e0a

Please sign in to comment.