Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

Commit

Permalink
Merge pull request #507 from astrofrog/fix-glue-specviz-tests
Browse files Browse the repository at this point in the history
Fix glue plugin tests and functionality
  • Loading branch information
javerbukh committed Oct 30, 2018
2 parents 7178ed7 + 381d63e commit 774b6c9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 1 addition & 2 deletions specviz/third_party/glue/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
from ..utils import glue_data_has_spectral_axis, glue_data_to_spectrum1d


@pytest.mark.xfail(run=False, reason="at this point, unknown reason")
def test_conversion_utils():
def test_conversion_utils_1d():

# Set up simple spectral WCS
wcs = WCS(naxis=1)
Expand Down
1 change: 0 additions & 1 deletion specviz/third_party/glue/tests/test_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from ..viewer import SpecvizDataViewer


@pytest.mark.xfail(run=False, reason="at this point, unknown reason")
class TestSpecvizDataViewer(object):

def setup_method(self, method):
Expand Down
10 changes: 7 additions & 3 deletions specviz/third_party/glue/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from glue.core.subset import Subset
from glue.core.coordinates import WCSCoordinates

__all__ = ['is_glue_data_1d_spectrum', 'glue_data_to_spectrum1d']
__all__ = ['glue_data_has_spectral_axis', 'glue_data_to_spectrum1d']


def glue_data_has_spectral_axis(data):
Expand All @@ -17,9 +17,13 @@ def glue_data_has_spectral_axis(data):
data : `glue.core.data.Data`
The data to check
"""

if isinstance(data, Subset):
data = data.data

if not isinstance(data.coords, WCSCoordinates):
return False

spec_axis = data.coords.wcs.naxis - 1 - data.coords.wcs.wcs.spec

return (isinstance(data.coords, WCSCoordinates) and
Expand Down Expand Up @@ -67,6 +71,6 @@ def glue_data_to_spectrum1d(data_or_subset, attribute, statistic='mean'):
else:
values = values * u.Unit(component.units)

spec1d = Spectrum1D(values, wcs=data.coords.wcs)
wcs_spec = data.coords.wcs.sub([WCSSUB_SPECTRAL])

return spec1d
return Spectrum1D(values, wcs=wcs_spec)

0 comments on commit 774b6c9

Please sign in to comment.