Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
BayesValidRox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
inversemodeling
BayesValidRox
Commits
a2d781e9
Commit
a2d781e9
authored
4 months ago
by
kohlhaasrebecca
Browse files
Options
Downloads
Patches
Plain Diff
Linting of PostProcessing
parent
894e80d7
No related branches found
No related tags found
1 merge request
!37
Fix/post processing
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/bayesvalidrox/post_processing/post_processing.py
+12
-10
12 additions, 10 deletions
src/bayesvalidrox/post_processing/post_processing.py
with
12 additions
and
10 deletions
src/bayesvalidrox/post_processing/post_processing.py
+
12
−
10
View file @
a2d781e9
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Collection of postprocessing functions into a class.
"""
import
math
import
os
from
itertools
import
combinations
,
cycle
import
numpy
as
np
...
...
@@ -377,10 +379,10 @@ class PostProcessing:
# BME convergence if refBME is provided
if
ref_BME_KLD
is
not
None
:
if
plot
==
'
BME
'
:
ref
V
alue
=
ref_BME_KLD
[
0
]
ref
_v
alue
=
ref_BME_KLD
[
0
]
plot_label
=
r
'
BME/BME$^{Ref.}$
'
if
plot
==
'
KLD
'
:
ref
V
alue
=
ref_BME_KLD
[
1
]
ref
_v
alue
=
ref_BME_KLD
[
1
]
plot_label
=
'
$D_{KL}[p(
\\
theta|y_*),p(
\\
theta)]
'
\
'
/ D_{KL}^{Ref.}[p(
\\
theta|y_*),
'
\
'
p(
\\
theta)]$
'
...
...
@@ -388,7 +390,7 @@ class PostProcessing:
# Difference between BME/KLD and the ref. values
all_errors
=
np
.
divide
(
all_errors
,
np
.
full
((
all_errors
.
shape
),
ref
V
alue
))
ref
_v
alue
))
# Plot baseline for zero, i.e. no difference
plt
.
axhline
(
y
=
1.0
,
xmin
=
0
,
xmax
=
1
,
c
=
'
green
'
,
...
...
@@ -449,10 +451,10 @@ class PostProcessing:
# BME convergence if refBME is provided
if
ref_BME_KLD
is
not
None
:
if
plot
==
'
BME
'
:
ref
V
alue
=
ref_BME_KLD
[
0
]
ref
_v
alue
=
ref_BME_KLD
[
0
]
plot_label
=
r
'
BME/BME$^{Ref.}$
'
if
plot
==
'
KLD
'
:
ref
V
alue
=
ref_BME_KLD
[
1
]
ref
_v
alue
=
ref_BME_KLD
[
1
]
plot_label
=
'
$D_{KL}[p(
\\
theta|y_*),p(
\\
theta)]
'
\
'
/ D_{KL}^{Ref.}[p(
\\
theta|y_*),
'
\
'
p(
\\
theta)]$
'
...
...
@@ -460,7 +462,7 @@ class PostProcessing:
# Difference between BME/KLD and the ref. values
values
=
np
.
divide
(
seq_values
,
np
.
full
((
seq_values
.
shape
),
ref
V
alue
))
ref
_v
alue
))
# Plot baseline for zero, i.e. no difference
plt
.
axhline
(
y
=
1.0
,
xmin
=
0
,
xmax
=
1
,
c
=
'
green
'
,
...
...
@@ -586,7 +588,7 @@ class PostProcessing:
# Check if the x_values match the number of metamodel outputs
# TODO: How relevant is this check?
if
(
np
.
array
(
x_values_orig
).
shape
[
0
]
!=
total_sobol_all
[
outputs
[
0
]].
shape
[
1
]
)
:
if
np
.
array
(
x_values_orig
).
shape
[
0
]
!=
total_sobol_all
[
outputs
[
0
]].
shape
[
1
]:
print
(
"
The number of MetaModel outputs does not match the x_values
"
"
specified in ExpDesign. Images are created with
"
...
...
@@ -611,7 +613,7 @@ class PostProcessing:
q_5
=
np
.
quantile
(
sobol_all
[
i_order
][
output
],
q
=
0.05
,
axis
=
0
)
q_97_5
=
np
.
quantile
(
sobol_all
[
i_order
][
output
],
q
=
0.975
,
axis
=
0
)
if
plot_type
is
"
bar
"
:
if
plot_type
==
"
bar
"
:
ax
=
fig
.
add_axes
([
0
,
0
,
1
,
1
])
dict1
=
{
xlabel
:
x
}
dict2
=
{
...
...
@@ -663,7 +665,7 @@ class PostProcessing:
q_5
=
np
.
quantile
(
total_sobol_all
[
output
],
q
=
0.05
,
axis
=
0
)
q_97_5
=
np
.
quantile
(
total_sobol_all
[
output
],
q
=
0.975
,
axis
=
0
)
if
plot_type
is
"
bar
"
:
if
plot_type
==
"
bar
"
:
ax
=
fig
.
add_axes
([
0
,
0
,
1
,
1
])
dict1
=
{
xlabel
:
x
}
dict2
=
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment