From 7b8d71343e2717730e4dba59f86e2e1b8f589975 Mon Sep 17 00:00:00 2001 From: "Brett M. Morris" Date: Mon, 10 Apr 2023 10:25:28 -0400 Subject: [PATCH] adding support for manga cubes --- jdaviz/core/data_formats.py | 8 ++++++++ jdaviz/core/tests/test_data_menu.py | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/jdaviz/core/data_formats.py b/jdaviz/core/data_formats.py index c04373d9f9..7caa29253b 100644 --- a/jdaviz/core/data_formats.py +++ b/jdaviz/core/data_formats.py @@ -259,6 +259,14 @@ def identify_helper(filename, ext=1): elif n_axes == 1: return 'specviz' + try: + # try using the specutils registry: + valid_format, config = identify_data(filename) + return config + except ValueError: + # if file type not recognized: + pass + if n_axes == 2 and not has_spectral_axis: # at this point, non-spectral 2D data are likely images: return 'imviz' diff --git a/jdaviz/core/tests/test_data_menu.py b/jdaviz/core/tests/test_data_menu.py index f6beb303a3..c48e5f3ec7 100644 --- a/jdaviz/core/tests/test_data_menu.py +++ b/jdaviz/core/tests/test_data_menu.py @@ -111,3 +111,15 @@ def test_auto_config_detection(uri, expected_helper): fn = download_file(url, cache=True) helper_name = identify_helper(fn) assert helper_name == expected_helper + + +@pytest.mark.remote_data +@pytest.mark.filterwarnings(r"ignore::astropy.wcs.wcs.FITSFixedWarning") +def test_auto_config_manga(): + # Check that MaNGA cubes go to cubeviz. This file is + # originally from + # https://data.sdss.org/sas/dr14/manga/spectro/redux/v2_1_2/7495/stack/manga-7495-12704-LOGCUBE.fits.gz + URL = 'https://stsci.box.com/shared/static/28a88k1qfipo4yxc4p4d40v4axtlal8y.fits' + fn = download_file(URL, cache=True) + helper_name = identify_helper(fn) + assert helper_name == 'cubeviz'