Skip to content

Commit

Permalink
Merge pull request #56 from pllim/fix-no-attr
Browse files Browse the repository at this point in the history
Fix attribute handling for Jdaviz/Cubeviz parser
  • Loading branch information
astrofrog authored Dec 2, 2021
2 parents 5b8a32c + 4c1466a commit 25d7711
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions glue_astronomy/translators/spectrum1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,11 @@ def to_object(self, data_or_subset, attribute=None, statistic='mean'):
if len(data.main_components) == 1:
attribute = data.main_components[0]
# If no specific attribute is defined, attempt to retrieve
# both the flux and uncertainties
# the flux and uncertainty, if available
elif any([x.label in ('flux', 'uncertainty') for x in data.components]):
attribute = [data.find_component_id('flux'),
data.find_component_id('uncertainty')]
attribute = [data.find_component_id(x)
for x in ('flux', 'uncertainty')
if data.find_component_id(x) is not None]
else:
raise ValueError("Data object has more than one attribute, so "
"you will need to specify which one to use as "
Expand Down

0 comments on commit 25d7711

Please sign in to comment.