From 2a0176ce247e2017aabb9f7f9ed296d9bb575c5a Mon Sep 17 00:00:00 2001 From: zerafachris PERSONAL Date: Wed, 29 May 2024 21:44:49 +0200 Subject: [PATCH] scattering: fixed ordering of coefficients processing and not so dependent on waterlevel for log --- scatcluster/processing/scattering.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scatcluster/processing/scattering.py b/scatcluster/processing/scattering.py index 4073001..28e8cb2 100644 --- a/scatcluster/processing/scattering.py +++ b/scatcluster/processing/scattering.py @@ -571,9 +571,9 @@ def process_vectorized_scattering_coefficients(self) -> None: coefficients.order_1.sum(dim=('f1', 'channel')) > 0, drop=True, ) - coefficients = self.log(coefficients, waterlevel=1e-15) coefficients = self.nyquist_mask(coefficients) coefficients = self.normalize(coefficients) + coefficients = self.log(coefficients, waterlevel=1e-5) coefficients = self.min_max_scaling(coefficients) print(coefficients) @@ -623,7 +623,7 @@ def load_scattering_coefficients_xarray(self): return scat_coeff_xr - def plot_scattering_coefficients_normalisation(self): + def plot_scattering_coefficients_normalisation(self, **kwargs): """ Plot the normalization of scattering coefficients. This function loads the scattering coefficients from an xarray dataset file and plots the normalization of the coefficients. The plot is saved as a PNG file in the specified directory. @@ -634,8 +634,9 @@ def plot_scattering_coefficients_normalisation(self): Returns: None """ + kwargs['figsize'] = (10, 7) if kwargs.get('figsize') is None else kwargs.get('figsize') scat_vec = self.vectorize_scattering_coefficients_xarray(self.load_scattering_coefficients_xarray()) - _, axs = plt.subplots(1, 1, figsize=(10, 7)) + _, axs = plt.subplots(1, 1, **kwargs) for col in range(scat_vec.shape[1]): axs.plot(scat_vec[col], 'b', alpha=0.1) plt.title(f'{self.data_network}_{self.data_station}_{self.data_location}_{self.network_name}\n'