From a2d781e9bcbf880605c8abc82ac221c78d16ad08 Mon Sep 17 00:00:00 2001
From: kohlhaasrebecca <rebecca.kohlhaas@outlook.com>
Date: Thu, 14 Nov 2024 09:29:33 +0100
Subject: [PATCH] Linting of PostProcessing

---
 .../post_processing/post_processing.py        | 22 ++++++++++---------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/bayesvalidrox/post_processing/post_processing.py b/src/bayesvalidrox/post_processing/post_processing.py
index e61de97c7..bed985105 100644
--- a/src/bayesvalidrox/post_processing/post_processing.py
+++ b/src/bayesvalidrox/post_processing/post_processing.py
@@ -1,7 +1,9 @@
 #!/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 = {
-- 
GitLab