You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/ref/cwt.rst
+81-3Lines changed: 81 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -6,14 +6,82 @@
6
6
Continuous Wavelet Transform (CWT)
7
7
==================================
8
8
9
-
This section describes functions used to perform single continuous wavelet
10
-
transforms.
9
+
This section focuses on the one-dimensional Continuous Wavelet Transform. It
10
+
introduces the main function ``cwt`` alongside several helper function, and
11
+
also gives an overview over the available wavelets for this transfom.
11
12
12
-
Single level - ``cwt``
13
+
14
+
Introduction
15
+
------------
16
+
17
+
In simple terms, the Continuous Wavelet Transform is an analysis tool similar
18
+
to the Fourier Transform, in that it takes a time-domain signal and returns
19
+
the signal's components in the frequency domain. However, in contrast to the
20
+
Fourier Transform, the Continuous Wavelet Transform returns a two-dimensional
21
+
result, providing information in the frequency- as well as in time-domain.
22
+
Therefore, it is useful for periodic signals which change over time, such as
23
+
audio, seismic signals and many others (see below for examples).
24
+
25
+
For more background and an in-depth guide to the application of the Continuous
26
+
Wavelet Transform, including topics such as statistical significance, the
27
+
following well-known article is highly recommended:
28
+
29
+
`C. Torrence and G. Compo: "A Practical Guide to Wavelet Analysis", Bulletin of the American Meteorological Society, vol. 79, no. 1, pp. 61-78, January 1998 <https://paos.colorado.edu/research/wavelets/bams_79_01_0061.pdf>`_
30
+
31
+
32
+
The ``cwt`` Function
13
33
----------------------
14
34
35
+
This is the main function, which calculates the Continuous Wavelet Transform
36
+
of a one-dimensional signal.
37
+
15
38
.. autofunction:: cwt
16
39
40
+
A comprehensive example of the CWT
41
+
----------------------------------
42
+
43
+
Here is a simple end-to-end example of how to calculate the CWT of a simple
44
+
signal, and how to plot it using ``matplotlib``.
45
+
46
+
First, we generate an artificial signal to be analyzed. We are
47
+
using the sum of two sine functions with increasing frequency, known as "chirp".
48
+
For reference, we also generate a plot of the signal and the two time-dependent
49
+
frequency components it contains.
50
+
51
+
We then apply the Continuous Wavelet Transform
52
+
using a complex Morlet wavlet with a given center frequency and bandwidth
53
+
(namely ``cmor1.5-1.0``). We then plot the so-called "scaleogram", which is the
54
+
2D plot of the signal strength vs. time and frequency.
55
+
56
+
.. plot:: pyplots/plot_cwt_scaleogram.py
57
+
58
+
The Continuous Wavelet Transform can resolve the two frequency components clearly,
59
+
which is an obvious advantage over the Fourier Transform in this case. The scales
60
+
(widths) are given on a logarithmic scale in the example. The scales determine the
61
+
frequency resolution of the scaleogram. However, it is not straightforward to
62
+
convert them to frequencies, but luckily, ``cwt`` calculates the correct frequencies
63
+
for us. There are also helper functions, that perform this conversion in both ways.
64
+
For more information, see :ref:`Choosing scales` and :ref:`Converting frequency`.
65
+
66
+
Also note, that the raw output of ``cwt`` is complex if a complex wavelet is used.
67
+
For visualization, it is therefore necessary to use the absolute value.
68
+
69
+
70
+
Wavelet bandwidth and center frequencies
71
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
72
+
73
+
This example shows how the Complex Morlet Wavelet can be configured for optimum
74
+
results using the ``center_frequency`` and ``bandwidth_frequency`` parameters,
75
+
which can simply be appended to the wavelet's string identifier ``cmor`` for
76
+
convenience. It also demonstrates the importance of choosing appropriate values
77
+
for the wavelet's center frequency and bandwidth. The right values will depend
78
+
on the signal being analyzed. As shown below, bad values may lead to poor
0 commit comments