Skip to content

Commit

Permalink
scattering: plot_scattering_coefficients_normalisation
Browse files Browse the repository at this point in the history
  • Loading branch information
zerafachris committed May 28, 2024
1 parent e796952 commit fd52d6b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions scatcluster/processing/scattering.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,31 @@ def load_scattering_coefficients_xarray(self):
self.scattering_coefficients_xarray = scat_coeff_xr
return scat_coeff_xr


def plot_scattering_coefficients_normalisation(self):
"""
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.
Parameters:
self (object): The instance of the class.
Returns:
None
"""
scat_vec = self.vectorize_scattering_coefficients_xarray(self.load_scattering_coefficients_xarray())
_, axs = plt.subplots(1, 1, figsize=(10, 7))
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'
'Scattering Coefficients Normalization')

plt.savefig(
f'{self.data_network}_{self.data_station}_{self.data_location}_{self.network_name}_Scattering_Coefficients_Normalization.png')

plt.show()


def preload_times(self):
"""
Preloads the times data from a numpy file and assigns it to the `data_times` attribute of the class.
Expand Down

0 comments on commit fd52d6b

Please sign in to comment.