From 522688a31228e86d24dd8bedc70ab58322138930 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=BChle=2C=20Laura=20Christine=20=28lakue103=29?=
 <laura.kuehle@uni-duesseldorf.de>
Date: Fri, 2 Sep 2022 18:05:16 +0200
Subject: [PATCH] Replaced 'num_coarse_grid_cells' with Mesh.

---
 Troubled_Cell_Detector.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/Troubled_Cell_Detector.py b/Troubled_Cell_Detector.py
index 7a637c3..4d89440 100644
--- a/Troubled_Cell_Detector.py
+++ b/Troubled_Cell_Detector.py
@@ -4,7 +4,7 @@
 
 TODO: Adjust TCs for wavelet detectors (sliding window over all cells instead
     of every second) -> Done
-TODO: Replace num_coarse_grid_cells with mesh
+TODO: Replace num_coarse_grid_cells with mesh -> Done
 TODO: Introduce Adjusted Outer Fence method in Boxplot using global_mean
 TODO: Introduce overlapping cell for adjacent folds in Boxplot
 TODO: Introduce lower/upper extreme outliers in Boxplot
@@ -226,8 +226,7 @@ class WaveletDetector(TroubledCellDetector):
         """
         super()._reset(config)
 
-        # Set additional necessary parameter
-        self._num_coarse_grid_cells = self._mesh.num_grid_cells//2
+        # Set wavelet projections
         self._wavelet_projection_left, self._wavelet_projection_right \
             = self._basis.multiwavelet_projection
 
@@ -311,7 +310,7 @@ class WaveletDetector(TroubledCellDetector):
 
         # Calculate projection on coarse mesh
         output_matrix = []
-        for i in range(self._num_coarse_grid_cells):
+        for i in range(self._mesh.num_grid_cells//2):
             new_entry = 0.5 * (
                     projection[:, 2 * i] @ basis_projection_left
                     + projection[:, 2 * i + 1] @ basis_projection_right)
@@ -496,6 +495,6 @@ class Theoretical(WaveletDetector):
                         for degree in range(
             self._basis.polynomial_degree+1))/max_avg
         eps = self._cutoff_factor\
-            / (self._mesh.cell_len*self._num_coarse_grid_cells*2)
+            / (self._mesh.cell_len*self._mesh.num_grid_cells)
 
         return max_value > eps
-- 
GitLab