Skip to content

Mistake in the red-noise spectrum #26

@citrux

Description

@citrux

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions