Commit 14d1a45f authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added dtype conversion for ndarray with pint unit.

parent d548c92e
Pipeline #88467 passed with stages
in 24 minutes and 1 second
......@@ -905,6 +905,10 @@ class MSection(metaclass=MObjectMeta): # TODO find a way to make this a subclas
raise MetainfoError(
'The quantity %s has not a unit, but value %s has.' %
(quantity_def, value))
if type(value.magnitude) == np.ndarray and quantity_def.type != value.dtype:
value = value.astype(quantity_def.type)
value =
if type(value) != np.ndarray:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment