From 80a78bbe938417b8b2c35546bcaf5fc76c6d53f1 Mon Sep 17 00:00:00 2001 From: Ricky O'Steen Date: Mon, 21 Mar 2022 16:15:54 -0400 Subject: [PATCH] Add more spectral x-att options, fix codestyle --- jdaviz/configs/cubeviz/plugins/parsers.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jdaviz/configs/cubeviz/plugins/parsers.py b/jdaviz/configs/cubeviz/plugins/parsers.py index 8ad57d1000..4258914c06 100644 --- a/jdaviz/configs/cubeviz/plugins/parsers.py +++ b/jdaviz/configs/cubeviz/plugins/parsers.py @@ -115,6 +115,8 @@ def _parse_hdu(app, hdulist, file_name=None): app.add_data(sc, data_label) + # Get id for correct x axis attribute + # If the data type is some kind of integer, assume it's the mask/dq if hdu.data.dtype in (int, np.uint, np.uint32) or \ any(x in hdu.name.lower() for x in EXT_TYPES['mask']): @@ -136,7 +138,10 @@ def _parse_hdu(app, hdulist, file_name=None): # Add flux to spectrum viewer app.add_data_to_viewer('spectrum-viewer', data_label) viewer = app.get_viewer('spectrum-viewer') - viewer.state.x_att = app.data_collection[data_label].id['Wave'] + for att_name in ["Wave", "Wavelength", "Freq", "Frequency"]: + if att_name in app.data_collection[data_label].component_ids(): + viewer.state.x_att = app.data_collection[data_label].id[att_name] + def _parse_jwst_s3d(app, hdulist, data_label, ext='SCI', viewer_name='flux-viewer'): from specutils import Spectrum1D