From d70ef886436f54878d43a49fec0c39181eaad06c Mon Sep 17 00:00:00 2001 From: LukasK13 Date: Fri, 26 Jun 2020 16:04:00 +0200 Subject: [PATCH] Bugfix: allow spectral quantities of length 1 --- esbo_etc/classes/SpectralQty.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/esbo_etc/classes/SpectralQty.py b/esbo_etc/classes/SpectralQty.py index e61c99a..698bd7b 100644 --- a/esbo_etc/classes/SpectralQty.py +++ b/esbo_etc/classes/SpectralQty.py @@ -35,7 +35,7 @@ class SpectralQty: The created spectral quantity. """ # Check if both lengths are equal - if len(wl) == len(qty): + if wl.value.size == qty.value.size: # check if units are given. If not, add a dimensionless unit if hasattr(wl, "unit"): self.wl = wl @@ -315,7 +315,8 @@ class SpectralQty: if not wl.unit.is_equivalent(self.wl.unit): logger.error("Mismatching units for rebinning: " + wl.unit + ", " + self.wl.unit) - if min(wl) < min(self.wl) or max(wl) > max(self.wl): + if (wl.value.size == 1 and (wl < min(self.wl) or wl > max(self.wl))) or ( + wl.value.size > 1 and (min(wl) < min(self.wl) or max(wl) > max(self.wl))): if isinstance(self._fill_value, bool): if not self._fill_value: logger.warning("Extrapolation disabled, bandwidth will be reduced.")