Skip to content

Commit

Permalink
support lists of objects when parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Jan 22, 2025
1 parent 03449c5 commit 176764c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion jdaviz/core/data_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,14 @@ def get_parser(obj, load_as_list=False):
parser : str
The parser for the data object
"""
if isinstance(obj, list):
parsers = [get_parser(o, load_as_list=load_as_list) for o in obj]
if len(set(parsers)) > 1:
raise ValueError("cannot find single parser for list of objects")
return parsers[0]
if isinstance(obj, Trace):
return 'specreduce-trace'
elif isinstance(obj, Spectrum1D):
if isinstance(obj, Spectrum1D):
if obj.flux.ndim == 1:
return 'specviz-spectrum1d-parser'
else:
Expand Down

0 comments on commit 176764c

Please sign in to comment.