From c9512bfd9810d8a7fc89e97175addca311b4c779 Mon Sep 17 00:00:00 2001 From: "Tobias Hangleiter (Triton 200)" Date: Mon, 22 Nov 2021 12:29:25 +0100 Subject: [PATCH] Improve handling of arrays of sympy types --- qupulse/expressions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qupulse/expressions.py b/qupulse/expressions.py index bf0a85751..a5a26065b 100644 --- a/qupulse/expressions.py +++ b/qupulse/expressions.py @@ -58,10 +58,10 @@ def _parse_evaluate_numeric_result(self, return result else: obj_types = set(map(type, result.flat)) - if obj_types == {sympy.Float} or obj_types == {sympy.Float, sympy.Integer}: - return result.astype(float) - elif obj_types == {sympy.Integer}: + if all(issubclass(obj_type, sympy.Integer) for obj_type in obj_types): return result.astype(numpy.int64) + if all(issubclass(obj_type, (sympy.Integer, sympy.Float)) for obj_type in obj_types): + return result.astype(float) else: raise NonNumericEvaluation(self, result, call_arguments) elif isinstance(result, allowed_types):