From 4c1466a6000dd64ff1a871ab7902015a37344e3f Mon Sep 17 00:00:00 2001 From: "Pey Lian Lim (Github)" <2090236+pllim@users.noreply.github.com> Date: Tue, 16 Nov 2021 14:57:00 -0500 Subject: [PATCH] BUG: Minimal fix for AttributeError --- glue_astronomy/translators/spectrum1d.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/glue_astronomy/translators/spectrum1d.py b/glue_astronomy/translators/spectrum1d.py index 169aeb4..65875c1 100644 --- a/glue_astronomy/translators/spectrum1d.py +++ b/glue_astronomy/translators/spectrum1d.py @@ -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 "