Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mistake in the red-noise spectrum #26

Open
citrux opened this issue Sep 15, 2017 · 0 comments
Open

Mistake in the red-noise spectrum #26

citrux opened this issue Sep 15, 2017 · 0 comments

Comments

@citrux
Copy link

citrux commented Sep 15, 2017

pycwt/pycwt/wavelet.py

Lines 252 to 257 in 1bef44e

# Theoretical discrete Fourier power spectrum of the noise signal
# following Gilman et al. (1963) and Torrence and Compo (1998),
# equation 16.
def pk(k, a, N):
return (1 - a ** 2) / (1 + a ** 2 - 2 * a * np.cos(2 * np.pi * k / N))
fft_theor = pk(freq, alpha, n0)

According to equation 16 from Torrence and Compo (1998) this code should look like this

def pk(k, a, N): 
    return (1 - a ** 2) / (1 + a ** 2 - 2 * a * np.cos(2 * np.pi * k / N)) 
fft_theor = pk(freq, alpha, 1) 

This bug leads to different results of usage of significance function with signal and its variance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant