obspy.signal.konnoohmachismoothing.calculate_smoothing_matrix

calculate_smoothing_matrix(frequencies, bandwidth=40.0, normalize=False)[source]

Calculates a len(frequencies) x len(frequencies) matrix with the Konno & Ohmachi window for each frequency as the center frequency.

Any spectrum with the same frequency bins as this matrix can later be smoothed by a simple matrix multiplication with this matrix:

smoothed_spectrum = np.dot(spectrum, smoothing_matrix)

This also works for many spectra stored in one large matrix and is even more efficient.

This makes it very efficient for smoothing the same spectra again and again but it comes with a high memory consumption for larger frequency arrays!

Parameters:
  • frequencies (numpy.ndarray (float32 or float64)) The input frequencies.
  • bandwidth (float) Determines the width of the smoothing peak. Lower values result in a broader peak. Must be greater than 0. Defaults to 40.
  • normalize (bool, optional) The Konno-Ohmachi smoothing window is normalized on a logarithmic scale. Set this parameter to True to normalize it on a normal scale. Default to False.