From f2f3a3cbd5f04eccfcb9112315ce4999b9f51be3 Mon Sep 17 00:00:00 2001 From: wasikj Date: Tue, 17 Feb 2026 06:58:43 +0100 Subject: [PATCH 1/2] Support complex types --- backend/ibex/data_source/imas_python_source.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/ibex/data_source/imas_python_source.py b/backend/ibex/data_source/imas_python_source.py index 0471bee..6f24463 100644 --- a/backend/ibex/data_source/imas_python_source.py +++ b/backend/ibex/data_source/imas_python_source.py @@ -58,6 +58,10 @@ def data_serializer_custom(self, obj): return obj.value if isinstance(obj, np.ndarray) and not obj.flags.c_contiguous: return np.ascontiguousarray(obj) + if isinstance(obj, (np.ndarray, IDSNumericArray)): # np.arrays with not supported dtype + return obj.tolist() + if isinstance(obj, complex): # not supported dtype extracted from np.array + return (obj.real, obj.imag) raise TypeError def _open_entry(self, uri: str) -> imas.DBEntry: From 303d70820a37255576ca53215c80008ece060831 Mon Sep 17 00:00:00 2001 From: wasikj Date: Tue, 17 Feb 2026 07:01:09 +0100 Subject: [PATCH 2/2] Apply ruff format --- backend/ibex/data_source/imas_python_source.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/ibex/data_source/imas_python_source.py b/backend/ibex/data_source/imas_python_source.py index 6f24463..3658229 100644 --- a/backend/ibex/data_source/imas_python_source.py +++ b/backend/ibex/data_source/imas_python_source.py @@ -58,9 +58,9 @@ def data_serializer_custom(self, obj): return obj.value if isinstance(obj, np.ndarray) and not obj.flags.c_contiguous: return np.ascontiguousarray(obj) - if isinstance(obj, (np.ndarray, IDSNumericArray)): # np.arrays with not supported dtype + if isinstance(obj, (np.ndarray, IDSNumericArray)): # np.arrays with not supported dtype return obj.tolist() - if isinstance(obj, complex): # not supported dtype extracted from np.array + if isinstance(obj, complex): # not supported dtype extracted from np.array return (obj.real, obj.imag) raise TypeError