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
0fa21175
Commit
0fa21175
authored
Jun 10, 2020
by
Lauri Himanen
Browse files
Fixed issue with missing statistics values.
parent
381d9e24
Pipeline
#76398
passed with stages
in 24 minutes and 27 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nomad/app/api/encyclopedia.py
View file @
0fa21175
...
...
@@ -790,7 +790,7 @@ statistics = api.model("statistics", {
"min"
:
fields
.
Float
,
"max"
:
fields
.
Float
,
"avg"
:
fields
.
Float
,
"histogram"
:
fields
.
Nested
(
histogram
)
"histogram"
:
fields
.
Nested
(
histogram
,
skip_none
=
True
)
})
statistics_result
=
api
.
model
(
"statistics_result"
,
{
"cell_volume"
:
fields
.
Nested
(
statistics
,
skip_none
=
True
),
...
...
@@ -875,6 +875,8 @@ class EncStatisticsResource(Resource):
n_bins
=
data
[
"n_histogram_bins"
]
for
prop
in
properties
:
stats
=
getattr
(
response
.
aggs
,
"{}_stats"
.
format
(
prop
))
if
stats
.
count
==
0
:
continue
interval
=
(
stats
.
max
*
1.001
-
stats
.
min
)
/
n_bins
if
interval
==
0
:
interval
=
1
...
...
@@ -886,6 +888,8 @@ class EncStatisticsResource(Resource):
result
=
{}
for
prop
in
properties
:
stats
=
getattr
(
response
.
aggs
,
"{}_stats"
.
format
(
prop
))
if
stats
.
count
==
0
:
continue
hist
=
getattr
(
response_hist
.
aggs
,
"{}_hist"
.
format
(
prop
))
occurrences
=
[
x
.
doc_count
for
x
in
hist
.
buckets
]
values
=
[
x
.
key
for
x
in
hist
.
buckets
]
...
...
@@ -1178,7 +1182,7 @@ class EncCalculationResource(Resource):
value
[
"specific_heat_capacity"
]
=
specific_heat_capacity
value
[
"specific_vibrational_free_energy_at_constant_volume"
]
=
specific_free_energy
# DOS results are simplified
# DOS results are simplified
.
if
key
==
"electronic_dos"
:
if
"dos_energies_normalized"
in
value
:
value
[
"dos_energies"
]
=
value
[
"dos_energies_normalized"
]
...
...
@@ -1186,8 +1190,6 @@ class EncCalculationResource(Resource):
if
"dos_values_normalized"
in
value
:
value
[
"dos_values"
]
=
value
[
"dos_values_normalized"
]
del
value
[
"dos_values_normalized"
]
del
value
[
"dos_integrated_values"
]
del
value
[
"dos_fermi_energy"
]
result
[
key
]
=
value
...
...
Write
Preview
Markdown
is supported
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