Skip to content
Snippets Groups Projects
Commit a2d781e9 authored by kohlhaasrebecca's avatar kohlhaasrebecca
Browse files

Linting of PostProcessing

parent 894e80d7
No related branches found
No related tags found
1 merge request!37Fix/post processing
#!/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':
refValue = ref_BME_KLD[0]
ref_value = ref_BME_KLD[0]
plot_label = r'BME/BME$^{Ref.}$'
if plot == 'KLD':
refValue = ref_BME_KLD[1]
ref_value = 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),
refValue))
ref_value))
# 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':
refValue = ref_BME_KLD[0]
ref_value = ref_BME_KLD[0]
plot_label = r'BME/BME$^{Ref.}$'
if plot == 'KLD':
refValue = ref_BME_KLD[1]
ref_value = 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),
refValue))
ref_value))
# 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 = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment