spacetelescope / jdaviz

JWST astronomical data analysis tools in the Jupyter platform
https://jdaviz.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
139 stars 74 forks source link

[FEAT] Cubeviz: update cubeviz load_data method to handle loading spectral and 2D data #700

Open rosteen opened 3 years ago

rosteen commented 3 years ago

It's totally legitimate to want to load 2D or 1D spectral data into Cubeviz to view in one of the image or spectrum viewers, respectively. Right now cubeviz.load_data accepts Spectrum1D objects as input, but using files or HDUs that contain 2D images or spectra fails. Images in particular are silently skipped over and the Data Loaded snackbar message is still displayed, which is confusing for the user.

I think that the ideal result is that the cubeviz.load_data method falls back on the Imviz or Specviz parsers for the appropriate data type, perhaps appending "[Spectrum]" or "[Image]" to the data label so that it's obvious in the data menus that the data isn't a full cube.

pllim commented 3 years ago

On the "imviz" side, you can call this directly:

https://github.com/spacetelescope/jdaviz/blob/8a0d08590f2ef4ba2c59ab4f4b7fd6eea8f20ccc/jdaviz/configs/imviz/plugins/parsers.py#L71

pllim commented 2 years ago

Looking at this again, I dunno if we should support. 2D image should use Imviz. 2D spectrum should use Specviz2d.