diff --git a/jdaviz/configs/cubeviz/plugins/tests/test_parsers.py b/jdaviz/configs/cubeviz/plugins/tests/test_parsers.py index 0949f02c06..f951c146c5 100644 --- a/jdaviz/configs/cubeviz/plugins/tests/test_parsers.py +++ b/jdaviz/configs/cubeviz/plugins/tests/test_parsers.py @@ -6,6 +6,7 @@ from glue_astronomy.translators.spectrum1d import PaddedSpectrumWCS from numpy.testing import assert_allclose, assert_array_equal +from jdaviz.core.custom_units import PIX2 from jdaviz.utils import PRIHDR_KEY @@ -147,8 +148,9 @@ def test_spectrum3d_parse(image_cube_hdu_obj, cubeviz_helper): assert label_mouseover.as_text() == ('', '', '') -def test_spectrum3d_no_wcs_parse(cubeviz_helper): - sc = Spectrum1D(flux=np.ones(24).reshape((2, 3, 4)) * u.nJy) # x, y, z +@pytest.mark.parametrize("flux_unit", [u.nJy, u.DN, u.DN / u.s]) +def test_spectrum3d_no_wcs_parse(cubeviz_helper, flux_unit): + sc = Spectrum1D(flux=np.ones(24).reshape((2, 3, 4)) * flux_unit) # x, y, z cubeviz_helper.load_data(sc) assert sc.spectral_axis.unit == u.pix @@ -158,7 +160,7 @@ def test_spectrum3d_no_wcs_parse(cubeviz_helper): assert data.shape == (2, 3, 4) # x, y, z assert isinstance(data.coords, PaddedSpectrumWCS) assert_array_equal(flux.data, 1) - assert flux.units == 'nJy / pix2' + assert flux.units == f'{flux_unit / PIX2}' def test_spectrum1d_parse(spectrum1d, cubeviz_helper): diff --git a/jdaviz/utils.py b/jdaviz/utils.py index d49552d4a6..26be688d5f 100644 --- a/jdaviz/utils.py +++ b/jdaviz/utils.py @@ -557,7 +557,9 @@ def _eqv_flux_to_sb_pixel(): u.erg / (u.s * u.cm**2 * u.Angstrom), u.ph / (u.Angstrom * u.s * u.cm**2), u.ph / (u.Hz * u.s * u.cm**2), - u.ct] + u.ct, + u.DN, + u.DN / u.s] return [(flux_unit, flux_unit / PIX2, lambda x: x, lambda x: x) for flux_unit in flux_units]