krischer / mtspec

Python library for multitaper spectral estimations
http://krischer.github.io/mtspec/
GNU General Public License v3.0
69 stars 44 forks source link

Clarifying the definition of spectral ratio in mt_deconvolve #35

Open ebeauce opened 3 years ago

ebeauce commented 3 years ago

Hi,

Thank you for providing this great library that really helps study earthquake source properties. While you state clearly in the doc string of mtspec that the "spectrum" is the PSD, the definition of "spectral_ratio" returned by the mt_deconvolve function is not stated, which can lead to quite bad mistakes in analyses.

The word "spectrum" is a confusing word as people freely use it to talk about different physical quantities. The documentation says that "spectral_ratio" is the ratio of the two spectra, and says that "spectrum_a" and "spectrum_b" are the spectra of the time series a and b, respectively. However, a simple test can show that spectrum_a/spectrum_b does not give spectral_ratio, instead it is equal to the square root of that: sqrt(spectrum_a/spectrum_b). I believe that this is the desired behavior for spectral_ratio, as what we want is the ratio between the Fourier transform of the two source terms, and not the ratio between the PSD of the two source terms. But this is in complete contradiction with the definition of "spectrum" used for "spectrum_a" and "spectrum_b", and given in the rest of the library.

I suggest to explicitly say in the docstring of mt_deconvolve that "spectrum_a" and "spectrum_b" are PSDs, whereas "spectral_ratio" is the ratio of the two moduli of the Fourier transforms (or anything that would clarify this).

Thanks!

Eric