Skip to content

Commit

Permalink
scattering: fixed ordering of coefficients processing and not so depe…
Browse files Browse the repository at this point in the history
…ndent on waterlevel for log
  • Loading branch information
zerafachris committed May 29, 2024
1 parent efcbb28 commit 2a0176c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scatcluster/processing/scattering.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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.
Expand All @@ -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'
Expand Down

0 comments on commit 2a0176c

Please sign in to comment.