# Why are wavelet transforms implemented in Python/Matlab often called Continuous wavelet transform when they take discrete-time input?

The implementations of Synchrosqueezing wavelet transform in Python (ssqueezepy) and MATLAB both write in their documentation that they implement the synchrosqueezing algorithm on the Continuous Wavelet Transform. However, these functions take in discrete-time input and return discrete frequency/scale output. It is my understanding that the name for the wavelet transform that takes in discrete time and outputs discrete scale is called the Distrete-Time Wavelet Transform (DTWT), see (Wavelets & Wavelet Transforms by C. Sidney Burrus page 158 or page 200 here).

Why do these libraries use the term CWT to refer to their functions, and what are the equations used to handle discrete time inputs and discrete outputs?

Good question.

## From nomenclature standpoint

Sampling a continuous-time result (called discretization) most often inherits the original name. For example, we still say "IIR filters", though they're surely finite on a computer.

The following are my observations that are sometimes applicable:

• discrete is reserved for methods that are designed to work with finite sequences, and often enjoy exact properties. DFT and DWT are examples.
• discrete-time, as in DTFT, is a mix of continuous and infinite-discrete; the methods are defined over the entirety of input $$x$$, even if we don't have it (as is the case in practice). It's subject to discretization, again without name change.

### From 'meaning' standpoint

If implemented properly, doing operations with finite sequences and sampling the continuous-time result produce the same result - for example, CWT of cosine. A non-CWT example is, adding two continuous sines and sampling them, is same as adding two sampled continuous sines:

$$(\cos(\omega_0 t) + \cos(\omega_1 t))(n) = \cos(\omega_0 n) + \cos(\omega_1 n)$$

With a caveat, it's also why we can say "integrating" on discrete sequences while doing a sum:

$$\int_{t=0}^1 |\cos(2\pi t)|^2 dt = \sum_{n=0}^{N - 1} |\cos(2 \pi n / N)|$$

This caveat is aliasing, and it's also applicable to CWT, but that's more of a "sampled equations may behave unexpectedly", as these effects are certainly computable in continuous-time (e.g. spectral leakage).

Another perspective is to consider the operations and domains involved: CFT is all continuous, DTFT continuous-discrete, DFT discrete-discrete. While these specifically are carefully related, it's not guaranteed to be the case following the above bolded definitions - "meaning" can change if a continuous kernel operates over a discrete sequence. I've not ascertained but discretized "DTWT" and discretized CWT might be identical.

Also, theory is done as CWT instead of "DTWT" as latter entails accounting for aliasing and possibly finiteness, which is extremely complicated and unnecessary for what can be predicted and handled in practice.

### Re: source

I've checked after writing this answer - it mirrors some of my comments, also remarks on inconsistency (hence arbitrarity). It also gives an example per my "theory is done" paragraph,

Because the wavelet basis functions are concentrated in time and not periodic, both the DTWT and DWT will represent in ̋nitely long signals.

but also says

in most practical cases, they are made periodic to facilitate efficient computation.

This needs careful interpreting and wish it was presented differently: nothing is actually made periodic, it just refers to the continuous-time spectrum being periodized, as is the case with all discrete sequences.

### Implementation CWT formula

Fast CWT is implemented with FFT convolution, i.e. circular convolution, that in time domain writes:

$$Wf[n, s] = \sum_{m=0}^{N-1} f[m] \psi_s^{*}[m - n] = (f \circledast \bar{\psi_s})[n]$$

where $$\psi_s[n] = \frac{1}{s} \psi (n/s)$$, $$\bar{\psi_s}[n] = \psi_s^*[-n]$$, and $$s$$ is scale. What's missing is, $$f$$ is usually $$f_\text{padded}$$ to avoid boundary effects and circular aliasing - and unpadding.

Example case where a discrete computation matches the sampling of a continuous result is 'reflect'-padded pure sine, which is circularly continuous and equivalently infinite (per effectively vanishing wavelet support under float precision): which one can confirm matches linked "CWT of cosine".

import numpy as np
from ssqueezepy import cwt
from ssqueezepy.visuals import imshow

t = np.linspace(0, 1, 257, endpoint=True)
x = np.cos(2*np.pi * 5 * t)