Skip to content
Snippets Groups Projects
Commit 74901fe3 authored by Laura Christine Kühle's avatar Laura Christine Kühle
Browse files

Changed code to report troubled cells on fine instead of coarse grid for wavelet detection.

parent c17369b0
No related branches found
No related tags found
No related merge requests found
......@@ -118,7 +118,7 @@ def plot_shock_tube(num_grid_cells: int, troubled_cell_history: list,
current_cells = troubled_cell_history[pos]
for cell in current_cells:
plt.plot(cell, time_history[pos], 'k.')
plt.xlim((0, num_grid_cells // 2))
plt.xlim((0, num_grid_cells))
plt.xlabel('Cell')
plt.ylabel('Time')
plt.title('Shock Tubes')
......
......@@ -3,7 +3,8 @@
@author: Laura C. Kühle, Soraya Terrab (sorayaterrab)
TODO: Adjust TCs for wavelet detectors (sliding window over all cells instead
of every second)
of every second) -> Done
TODO: Replace num_coarse_grid_cells with mesh
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
......@@ -244,8 +245,7 @@ class WaveletDetector(TroubledCellDetector):
List of indices for all detected troubled cells.
"""
multiwavelet_coeffs = self._calculate_wavelet_coeffs(
projection[:, 1: -1])
multiwavelet_coeffs = self._calculate_wavelet_coeffs(projection)
return self._get_cells(multiwavelet_coeffs, projection)
def _calculate_wavelet_coeffs(self, projection):
......@@ -263,10 +263,10 @@ class WaveletDetector(TroubledCellDetector):
"""
output_matrix = []
for i in range(self._num_coarse_grid_cells):
for i in range(self._mesh.num_grid_cells):
new_entry = 0.5*(
projection[:, 2*i] @ self._wavelet_projection_left
+ projection[:, 2*i+1] @ self._wavelet_projection_right)
projection[:, i] @ self._wavelet_projection_left
+ projection[:, i+1] @ self._wavelet_projection_right)
output_matrix.append(new_entry)
return np.transpose(np.array(output_matrix))
......@@ -377,12 +377,12 @@ class Boxplot(WaveletDetector):
"""
indexed_coeffs = [[multiwavelet_coeffs[0, i], i]
for i in range(self._num_coarse_grid_cells)]
for i in range(self._mesh.num_grid_cells)]
if self._num_coarse_grid_cells < self._fold_len:
self._fold_len = self._num_coarse_grid_cells
if self._mesh.num_grid_cells < self._fold_len:
self._fold_len = self._mesh.num_grid_cells
num_folds = self._num_coarse_grid_cells//self._fold_len
num_folds = self._mesh.num_grid_cells//self._fold_len
troubled_cells = []
for fold in range(num_folds):
......@@ -466,9 +466,9 @@ class Theoretical(WaveletDetector):
troubled_cells = []
max_avg = np.sqrt(0.5) \
* max(1, max(abs(projection[0][cell+1])
for cell in range(self._num_coarse_grid_cells)))
for cell in range(self._mesh.num_grid_cells)))
for cell in range(self._num_coarse_grid_cells):
for cell in range(self._mesh.num_grid_cells):
if self._is_troubled_cell(multiwavelet_coeffs, cell, max_avg):
troubled_cells.append(cell)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment