Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions glue_astronomy/translators/tests/test_spectrum1d.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import warnings

import pytest
import numpy as np
from numpy.testing import assert_allclose, assert_equal
Expand Down Expand Up @@ -283,8 +285,12 @@ def test_spectrum1d_2d_data(spec_ndim):
s, o = data.coords.pixel_to_world(1, 2)
assert isinstance(s, SpectralCoord)

# Check round-tripping of coordinates
with pytest.warns(AstropyUserWarning, match='No observer defined on WCS'):
# Check round-tripping of coordinates. Older astropy emits a warning
# about no observer being defined on the WCS, but newer versions do not,
# so we ignore it if present rather than requiring it.
with warnings.catch_warnings():
warnings.filterwarnings('ignore', message='No observer defined on WCS',
category=AstropyUserWarning)
px, py = data.coords.world_to_pixel(s, o)
assert_allclose(px, 1)
assert_allclose(py, 2)
Expand All @@ -311,8 +317,12 @@ def test_spectrum1d_2d_data(spec_ndim):
s, o1, o2 = data.coords.pixel_to_world(1, 2, 0)
assert isinstance(s, SpectralCoord)

# Check round-tripping of coordinates
with pytest.warns(AstropyUserWarning, match='No observer defined on WCS'):
# Check round-tripping of coordinates. Older astropy emits a warning
# about no observer being defined on the WCS, but newer versions do not,
# so we ignore it if present rather than requiring it.
with warnings.catch_warnings():
warnings.filterwarnings('ignore', message='No observer defined on WCS',
category=AstropyUserWarning)
px, py, pz = data.coords.world_to_pixel(s, o1, o2)
assert_allclose(px, 1)
assert_allclose(py, 2)
Expand Down
1 change: 1 addition & 0 deletions glue_astronomy/translators/tests/test_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@


@pytest.mark.filterwarnings('ignore:The Spectrum1D class is deprecated')
@pytest.mark.filterwarnings('ignore:The make_2d_trace_image function is deprecated')
def test_trace():

image = make_2d_trace_image(**trace_args)
Expand Down
Loading