diff --git a/setup.cfg b/setup.cfg index 8e38b0eff..60fcc2f27 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,8 +23,8 @@ install_requires = gwcs>=0.18 asdf-astropy>=0.3 asdf>=2.14 + jsonschema<4.18;asdf<2.15 ndcube>=2.0 - jsonschema<4.18 [options.extras_require] test = diff --git a/specutils/io/asdf/converters.py b/specutils/io/asdf/converters.py index e723f00e6..8e0bd15c5 100644 --- a/specutils/io/asdf/converters.py +++ b/specutils/io/asdf/converters.py @@ -1,6 +1,4 @@ -""" -Contains classes that serialize spectral data types into ASDF representations. -""" +"""Contains classes that serialize spectral data types into ASDF representations.""" from asdf.extension import Converter from asdf_astropy.converters import SpectralCoordConverter from astropy.nddata import (StdDevUncertainty, VarianceUncertainty, diff --git a/specutils/io/asdf/helpers.py b/specutils/io/asdf/tests/helpers.py similarity index 92% rename from specutils/io/asdf/helpers.py rename to specutils/io/asdf/tests/helpers.py index 20aa55388..05b3ead1f 100644 --- a/specutils/io/asdf/helpers.py +++ b/specutils/io/asdf/tests/helpers.py @@ -1,11 +1,11 @@ """Helpers for testing specutils objects in ASDF files. These are similar to those in ``asdf_astropy.testing.helpers``. """ -from astropy.tests.helper import assert_quantity_allclose from asdf_astropy.testing.helpers import assert_spectral_coord_equal +from astropy.tests.helper import assert_quantity_allclose from numpy.testing import assert_allclose -__all__ = ["assert_spectrum1d_equal", "assert_spectrumlist_equal"] +__all__ = ["assert_spectral_axis_equal", "assert_spectrum1d_equal", "assert_spectrumlist_equal"] def assert_spectral_axis_equal(a, b): diff --git a/specutils/io/asdf/tests/test_spectra.py b/specutils/io/asdf/tests/test_spectra.py index cde240c94..53e592ee8 100644 --- a/specutils/io/asdf/tests/test_spectra.py +++ b/specutils/io/asdf/tests/test_spectra.py @@ -6,22 +6,21 @@ from astropy.nddata import StdDevUncertainty from specutils import Spectrum1D, SpectrumList, SpectralAxis -from specutils.io.asdf.helpers import ( +from specutils.io.asdf.tests.helpers import ( assert_spectrum1d_equal, assert_spectrumlist_equal, assert_spectral_axis_equal) def create_spectrum1d(xmin, xmax, uncertainty=None): flux = np.ones(xmax - xmin) * u.Jy - wavelength = np.arange(xmin, xmax) * u.AA + wavelength = np.arange(xmin, xmax) * u.nm uncertainty = StdDevUncertainty(np.ones(xmax - xmin) * u.Jy) if uncertainty is not None else None return Spectrum1D(spectral_axis=wavelength, flux=flux, uncertainty=uncertainty) @pytest.mark.parametrize('uncertainty', [False, True]) -@pytest.mark.filterwarnings("ignore:.*The unit 'Angstrom' has been deprecated.*") def test_asdf_spectrum1d(tmp_path, uncertainty): file_path = tmp_path / "test.asdf" - spectrum = create_spectrum1d(5100, 5300, uncertainty=uncertainty) + spectrum = create_spectrum1d(510, 530, uncertainty=uncertainty) with asdf.AsdfFile() as af: af["spectrum"] = spectrum af.write_to(file_path) @@ -30,10 +29,9 @@ def test_asdf_spectrum1d(tmp_path, uncertainty): assert_spectrum1d_equal(af["spectrum"], spectrum) -@pytest.mark.filterwarnings("ignore:.*The unit 'Angstrom' has been deprecated.*") def test_asdf_spectralaxis(tmp_path): file_path = tmp_path / "test.asdf" - wavelengths = np.arange(5100, 5300) * u.AA + wavelengths = np.arange(510, 530) * u.nm spectral_axis = SpectralAxis(wavelengths, bin_specification="edges") with asdf.AsdfFile() as af: @@ -44,14 +42,13 @@ def test_asdf_spectralaxis(tmp_path): assert_spectral_axis_equal(af["spectral_axis"], spectral_axis) -@pytest.mark.filterwarnings("ignore:.*The unit 'Angstrom' has been deprecated.*") def test_asdf_spectrumlist(tmp_path): file_path = tmp_path / "test.asdf" spectra = SpectrumList([ - create_spectrum1d(5100, 5300), - create_spectrum1d(5000, 5500), - create_spectrum1d(0, 100), - create_spectrum1d(1, 5) + create_spectrum1d(510, 530), + create_spectrum1d(500, 550), + create_spectrum1d(0, 10), + create_spectrum1d(0.1, 0.5) ]) with asdf.AsdfFile() as af: af["spectrum_list"] = spectra