Skip to content

Commit

Permalink
support load_as_list for 2d spectra
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Jan 22, 2025
1 parent c64f14c commit 03449c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion jdaviz/configs/specviz/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def load_data(self, data, data_label=None, format=None, show_in_viewer=True,
`~astropy.utils.data.download_file` or
`~astroquery.mast.Conf.timeout`).
"""
parser = data_formats.get_parser(data)
parser = data_formats.get_parser(data, load_as_list=load_as_list)
if not self._dev_deconfig and parser != 'specviz-spectrum1d-parser':
raise NotImplementedError("Only Spectrum1D data is supported in Specviz.")

Expand Down
5 changes: 3 additions & 2 deletions jdaviz/core/data_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def get_valid_format(filename):
return valid_file_format, recommended_config


def get_parser(obj):
def get_parser(obj, load_as_list=False):
"""
Identify the data parser from a filename or data object
Expand All @@ -107,7 +107,8 @@ def get_parser(obj):
if obj.flux.ndim == 1:
return 'specviz-spectrum1d-parser'
else:
# TODO: how to determine if multiple spectra or an image?
if load_as_list:
return 'specviz-spectrumlist-parser'
return 'mosviz-spec2d-parser'
_, config = get_valid_format(obj)
parsers = {'specviz': 'specviz-spectrum1d-parser', 'specviz2d': 'mosviz-spec2d-parser'}
Expand Down

0 comments on commit 03449c5

Please sign in to comment.