Where can I see the list of built-in wavelet functions that I can pass to scipy.signal.cwt?

2024/10/9 6:27:33

scipy.signal.cwt's documentation says:

scipy.signal.cwt(data, wavelet, widths)

wavelet : functionWavelet function, which should take 2 arguments. The first argument is the number of points that the returned vectorwill have (len(wavelet(width,length)) == length). The second is awidth parameter, defining the size of the wavelet (e.g. standarddeviation of a gaussian). See ricker, which satisfies theserequirements.wavelet : function Wavelet function, which should take 2 arguments.

Beyond scipy.signal.ricket, what are the other built-in wavelet functions that I can pass to scipy.signal.cwt?

I see in scipy / scipy / signal / wavelets.py

__all__ = ['daub', 'qmf', 'cascade', 'morlet', 'ricker', 'cwt']

and looking at the arguments of each of those wavelet functions, only ricket seems to work with scipy.signal.cwt(data, wavelet, widths) (as only ricker takes precisely 2 arguments).

Answer

I asked the question on the SciPy Users List , answer 1:

I found the module for CWT quite confusing, so I rolled my own:

https://github.com/Dapid/fast-pycwt

It is built for speed (I got my running time from 4 h down to 20 min).It is not thoroughly tested, and it is limited to single and double;but for me it is in a "good enough" state.

Answer 2:

You might also find my version useful:

https://github.com/aaren/wavelets

I also found scipy wavelets confusing. My version includes a fastercwt that can take wavelets expressed in either frequency or time.

I found it more intuitive to have wavelet functions that taketime/frequency and width as arguments rather than the present method(I prefer thinking in real space rather than sample space).

Presently, the morlet wavelet that comes with scipy,scipy.signal.wavelets.morlet, cannot be used as input to cwt. Thisis unfortunate I think.

Additionally, the present cwt doesn't allow complex output. Thisdoesn't make a difference for ricker but wavelet functions are complexin general.

My modified 'cwt' method is here:

https://github.com/aaren/wavelets/blob/master/wavelets.py#L15

It can accept wavelet functions defined in time or frequency space,uses fftconvolve, and allows complex output.

My background on this is based on a reading of Torrence and Compo:

Torrence and Compo, 'A Practical Guide to Wavelet Analysis' (BAMS,1998)

http://paos.colorado.edu/research/wavelets/

hope that helps a bit,

aaron

https://en.xdnf.cn/q/70049.html

Related Q&A

How to play sound in Python WITHOUT interrupting music/other sounds from playing

Im working on a timer in python which sounds a chime when the waiting time is over. I use the following code:from wave import open as wave_open from ossaudiodev import open as oss_opendef _play_chime()…

How can I use click to parse a string for arguments?

Say I have a list of strings containing arguments and options, with argparse, I’m able to parse this list using the parse_args function into an object, as follows:import argparseextra_params = [‘—su…

Tornado and WTForms

I am using WTForms for the first time. Using WTForms to validate POST requests in Tornado Below is my forms forms.pyclass UserForm(Form):user = TextField(user, [validators.Length(min=23, max=23)])In t…

Modifying a python docstring with a decorator: Is it a good idea?

A python docstring must be given as a literal string; but sometimes its useful to have similar docstrings for several functions (e.g., different constructors), or several access methods might accept th…

Counting number of columns in text file with Python

I have two text files composed of spaced-separated columns. These are excerpts of these two files:FileA1 1742.420 -0.410 20.1530 0.4190 1.7080 0.59402 1872.060 0.070 21.4710 0.2950 0.0…

Django on Apache web server dict object has no attribute render_context

Im having a bit of a problem, I uploaded my Django project to a webserver running apache, mod_python, and django. On the computer I developed on the following works finenameBox = getNamesBox().render(l…

Verbose log abbriviations meaning in SVC, scikit-learn

I am looking for the meaning of verbose log abbriviations of SVC function in scikit-learn?If nSV is the number of support vectors, #iter is the number of iteration, what dose nBSV, rho,obj mean?This …

networkx draw_networkx_edges capstyle

Does anyone know if it is possible to have fine-grained control over line properties when drawing networkx edges via (for example) draw_networkx_edges? I would like to control the line solid_capstyle …

Setting up the path so AWS cli works properly

I installed AWSCLI by using:pip install --upgrade --user awscliNow if I type aws configure in the cmd I get: aws is not recognized as an internal or external command...Im pretty sure the path needs to …

Comparing value with neighbor elements in numpy

Lets say I have a numpy arraya b c A = i j ku v wI want to compare the value central element with some of its eight neighbor elements (along the axis or along the diagonal). Is there any faster way exc…