Helpers
PyCWT helper functions.
ar1(x)
Allen and Smith autoregressive lag-1 autocorrelation coefficient. In an AR(1) model
x(t) - <x> = \gamma(x(t-1) - <x>) + lpha z(t) ,
where
Parameters
x : numpy.ndarray, list Univariate time series
Returns
g : float Estimate of the lag-one autocorrelation. a : float Estimate of the noise variance [var(x) ~= a2/(1-g2)] mu2 : float Estimated square on the mean of a finite segment of AR(1) noise, mormalized by the process variance.
References
[1] Allen, M. R. and Smith, L. A. Monte Carlo SSA: detecting irregular oscillations in the presence of colored noise. Journal of Climate, 1996, 9(12), 3373-3404. <http://dx.doi.org/10.1175/1520-0442(1996)009<3373:MCSDIO>2.0.CO;2> [2] http://www.madsci.org/posts/archives/may97/864012045.Eg.r.html
Source code in pycwt/helpers.py
ar1_spectrum(freqs, ar1=0.0)
Lag-1 autoregressive theoretical power spectrum.
Parameters
freqs : numpy.ndarray, list Frequencies at which to calculate the theoretical power spectrum. ar1 : float Autoregressive lag-1 correlation coefficient.
Returns
Pk : numpy.ndarray Theoretical discrete Fourier power spectrum of noise signal.
References
[1] http://www.madsci.org/posts/archives/may97/864012045.Eg.r.html
Source code in pycwt/helpers.py
boxpdf(x)
Forces the probability density function of the input data to have a boxed distribution.
Parameters
x (array like) : Input data
Returns
X (array like) : Boxed data varying between zero and one. Bx, By (array like) : Data lookup table.
Source code in pycwt/helpers.py
fft_kwargs(signal, **kwargs)
find(condition)
get_cache_dir()
Returns the location of the cache directory.
Source code in pycwt/helpers.py
rect(x, normalize=False)
TODO: describe what I do.
Source code in pycwt/helpers.py
rednoise(N, g, a=1.0)
Red noise generator using filter.
Parameters
N : int Length of the desired time series. g : float Lag-1 autocorrelation coefficient. a : float, optional Noise innovation variance parameter.
Returns
y : numpy.ndarray Red noise time series.