From 2e8602f70c9da624afc2cdac7e91c5e6123f79c8 Mon Sep 17 00:00:00 2001 From: "Lumberbot (aka Jack)" <39504233+meeseeksmachine@users.noreply.github.com> Date: Mon, 1 Jul 2024 14:21:24 +0200 Subject: [PATCH] Backport PR #122: fix CDIPS parsing support (column filled with strings) (#123) Co-authored-by: Kyle Conroy --- CHANGES.rst | 2 ++ lcviz/utils.py | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 48ed04c..337ea9d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,8 @@ 0.4.1 (unreleased) ------------------ +* Fixes CDIPS support by handling columns filled with strings with empty units. [#122] + 0.4.0 (06-11-2024) ------------------ diff --git a/lcviz/utils.py b/lcviz/utils.py index 549b6b3..27245da 100644 --- a/lcviz/utils.py +++ b/lcviz/utils.py @@ -282,7 +282,13 @@ def to_object(self, data_or_subset): if len(values) and isinstance(values[0], Time): values = Time(values.base) elif hasattr(component, 'units') and component.units != "None": - values = u.Quantity(values, component.units) + try: + values = u.Quantity(values, component.units) + except TypeError: + if component.units != "": + raise + # values could have been an array of strings with units "" + values = values if component_id.label not in names: columns.append(values)