[SciPy-dev] Continuous Wavelet Transform for SciPy
Sean Arms
lesserwhirls@gmail....
Fri Mar 27 13:44:31 CDT 2009
Greetings!
With the help of Pauli, I've created a git clone of the scipy tree and
made a cwt branch. The branch is located at
http://github.com/lesserwhirls/scipy-cwt/tree/cwt
Here is an example using the cwt code with the Mexican Hat wavelet:
==============
import numpy as np
from scipy.signal import SDG, Morlet, cwt
# create data array - number of tropical cyclones per year (1970-2006) in the
# Northwest Australian region
data = np.array([5,6,8,8,11,6,4,4,2,6,7,9,4,8,10,8,4,14,5,5,2,2,7,3,7,5,5,7,9,5,3,6,5,5,7])
# remove mean
data = (data - data.mean())
# create the scales at which you wish to do the analysis
scales = np.arange(1,15,0.1)
# initialize the mother wavelet
mother_wavelet = SDG(len_signal = len(data), pad_to = np.power(2,10),
scales = scales)
# perform continuous wavelet transform on `data` using `mother_wavelet`
wavelet=cwt(data, mother_wavelet)
# plot scalogram, wavelet power spectrum, and time series
wavelet.scalogram(ts = data, show_coi = True, show_wps = True,
use_period = True, ylog_base = 2)
==============
I'll add an enhancement ticket in Scipy's Trac once I get some initial feedback.
Cheers!
Sean Arms
Graduate Research Assistant
School of Meteorology
University of Oklahoma
On Mon, Mar 2, 2009 at 10:25 PM, Sean Arms <lesserwhirls@gmail.com> wrote:
> Greetings!
>
> My name is Sean Arms and I'm a graduate student at the University of
> Oklahoma in the School of Meteorology. As part of my PhD research, I'm
> studying coherent structures in atmospheric boundary layer turbulence,
> primarily using in-situ observations and, secondarily, Direct Numerical
> Simulation (DNS) output. One common approach for detecting coherent
> structures in observational datasets relies on the use of the global wavelet
> power spectrum as estimated from a continuous wavelet transform (CWT). I
> know SciPy has a DWT impementation, and I've already been in contact with
> Filip. He recommeded that I post my code in hopes that it would add some
> momentum to the python-cwt development and create some feedback (I'm
> currently looking for a good place to post my code). I've implemented the
> CWT using pure python (that is, I did not write any C extension code myself
> - nothing to build), along with one mother wavelet (second derivitive of a
> Gaussian, or the Mexican Hat) - I'll be adding more Mother wavelets as I go
> along. I've made it a point to (try to) design my MotherWavelet class to be
> easily extendable. I'm working on documentation and a few tests at the
> moment, but so far my code compares well with other wavelet routines.
>
> The point of this email is to introduce myself and let the SciPy dev
> community know that I am willing to help develop CWT support for SciPy -
> I'll already be doing the work for my research, so I might as well put in
> the extra effort to make is usable by the larger community!
>
> Cheers!
>
> Sean Arms
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
>
More information about the Scipy-dev
mailing list