Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
14d1a45f
Commit
14d1a45f
authored
Nov 16, 2020
by
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
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nomad/metainfo/metainfo.py
View file @
14d1a45f
...
...
@@ -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
=
value
.
to
(
quantity_def
.
unit
).
magnitude
if
type
(
value
)
!=
np
.
ndarray
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment