cwt (pyleoclim.utils.wavelet.cwt)
- pyleoclim.utils.wavelet.cwt(ys, ts, freq=None, freq_method='log', freq_kwargs={}, scale=None, detrend=False, sg_kwargs={}, gaussianize=False, standardize=False, pad=False, mother='MORLET', param=None)[source]
Wrapper function to implement Torrence and Compo continuous wavelet transform
- Parameters
ys (numpy.array) – the time series.
ts (numpy.array) – the time axis.
freq (numpy.array, optional) – The frequency vector. The default is None, which will prompt the use of one the underlying functions
freq_method (string, optional) – The method by which to obtain the frequency vector. The default is ‘log’. Options are ‘log’ (default), ‘nfft’, ‘lomb_scargle’, ‘welch’, and ‘scale’
freq_kwargs (dict, optional) – Optional parameters for the choice of the frequency vector. See make_freq_vector and additional methods for details. The default is {}.
scale (numpy.array) – Optional scale vector in place of a frequency vector. Default is None. If scale is not None, frequency method and attached arguments will be ignored.
detrend (bool, string, {'linear', 'constant', 'savitzy-golay', 'emd'}) – Whether to detrend and with which option. The default is False.
sg_kwargs (dict, optional) – Additional parameters for the savitzy-golay method. The default is {}.
gaussianize (bool, optional) – Whether to gaussianize. The default is False.
standardize (bool, optional) – Whether to standardize. The default is False.
pad (bool, optional) – Whether or not to pad the timeseries. with zeroes to get N up to the next higher power of 2. This prevents wraparound from the end of the time series to the beginning, and also speeds up the FFT’s used to do the wavelet transform. This will not eliminate all edge effects. The default is False.
mother (string, optional) – the mother wavelet function. The default is ‘MORLET’. Options are: ‘MORLET’, ‘PAUL’, or ‘DOG’
param (flaot, optional) –
- the mother wavelet parameter. The default is None since it varies for each mother
For ‘MORLET’ this is k0 (wavenumber), default is 6.
For ‘PAUL’ this is m (order), default is 4.
For ‘DOG’ this is m (m-th derivative), default is 2.
- Returns
res –
- Dictionary containing:
amplitude: the wavelet amplitude
coi: cone of influence
freq: frequency vector
coeff: the wavelet coefficients
scale: the scale vector
time: the time vector
mother: the mother wavelet
param : the wavelet parameter
- Return type
dict
See also
pyleoclim.utils.wavelet.make_freq_vector
make the frequency vector with various methods
pyleoclim.utils.wavelet.tc_wavelet
the underlying wavelet function by Torrence and Compo
pyleoclim.utils.tsutils.detrend
detrending functionalities in Pyleoclim
References
Torrence, C. and G. P. Compo, 1998: A Practical Guide to Wavelet Analysis. Bull. Amer. Meteor. Soc., 79, 61-78. Python routines available at http://paos.colorado.edu/research/wavelets/