Skip to main page content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Access keys NCBI Homepage MyNCBI Homepage Main Content Main Navigation
. 2022 Jan;2(1):47-58.
doi: 10.1038/s43588-021-00183-z. Epub 2022 Jan 27.

The fast continuous wavelet transformation (fCWT) for real-time, high-quality, noise-resistant time-frequency analysis

Affiliations

The fast continuous wavelet transformation (fCWT) for real-time, high-quality, noise-resistant time-frequency analysis

Lukas P A Arts et al. Nat Comput Sci. 2022 Jan.

Abstract

The spectral analysis of signals is currently either dominated by the speed-accuracy trade-off or ignores a signal's often non-stationary character. Here we introduce an open-source algorithm to calculate the fast continuous wavelet transform (fCWT). The parallel environment of fCWT separates scale-independent and scale-dependent operations, while utilizing optimized fast Fourier transforms that exploit downsampled wavelets. fCWT is benchmarked for speed against eight competitive algorithms, tested on noise resistance and validated on synthetic electroencephalography and in vivo extracellular local field potential data. fCWT is shown to have the accuracy of CWT, to have 100 times higher spectral resolution than algorithms equal in speed, to be 122 times and 34 times faster than the reference and fastest state-of-the-art implementations and we demonstrate its real-time performance, as confirmed by the real-time analysis ratio. fCWT provides an improved balance between speed and accuracy, which enables real-time, wide-band, high-quality, time-frequency analysis of non-stationary noisy signals.

PubMed Disclaimer

Conflict of interest statement

The authors declare no competing interests.

Figures

Fig. 1
Fig. 1. The impact of time–frequency analysis across society.
In both nature and technology, signals enable communication, and processing techniques such as the CWT (also called IWT) are applied throughout. CWT was the primary processing method used in the Laser Interferometer Gravitational-wave Observatory (LIGO) experiment to detect gravity waves in highly non-stationary gravitational wave data. In industry, CWT has been applied to enhance mineral detection and speech segmentation. CWT also allows the detailed analysis of biosignals such as an electrocardiogram in the medical domain. BCI, brain–computer interface; BPM, beats per minute. Image credits: (left) adapted with permission from ref. , Caltech/MIT/LIGO Laboratory; (center) adapted from ref. under a CC BY license.
Fig. 2
Fig. 2. Comparison of DWT and CWT.
A time-varying pulse signal of a sonar device is analyzed in the range 0–60 kHz using the DWT and the CWT. The DWT uses a coarse time–frequency discretization to favor speed. By contrast, the CWT uses a time-consuming near-continuous discretization of the time and frequency scales to favor resolution. Source data
Fig. 3
Fig. 3. Benchmarking with fCWT and six state-of-the-art time–frequency methods.
a, The average speed-up of fCWT and six publicly available implementations after 100 runs on a signal of length N = 100,000 with accompanying statistics (in seconds). The signal was analyzed using 3,000 frequencies ranging from f0 = 1 Hz to f1 = 32 Hz. b, The RAR (equation (1)) of fCWT (600 frequencies, σ = 6), the fastest CWT available (PyWavelet’s CWT, 600 frequencies, σ = 6), STFT (500-ms Blackman with 400-ms overlap) and DWT (four-order Debauchie 20 levels) versus sampling frequency on a 10-s synthetic signal. Parameters were chosen to reflect actual usage in real-world applications. Jumps in the performance of fCWT are explained in the Methods. Source data
Fig. 4
Fig. 4. Benchmark results for synthetic data.
a, Synthetic data composed of wavepackets WP1, WP2 and WP3 (see Methods for details). Seven time–frequency estimation techniques that cover a frequency range from f0 = 0.25 Hz to the Nyquist frequency f1 = 250 Hz are shown. fCWT and CWT use the Morlet wavelet (σ = 6) and 480 frequencies to divide the spectrum, DWT uses 11 levels of 15-order Debauchie wavelet decomposition, and STFT uses a 500-ms Blackman window with 400-ms overlap to obtain optimal time–frequency resolution. WVD takes no parameters. HHT and EWT have a frequency resolution of 0.25 Hz and rely on an adaptive iterating process. HHT uses seven intrinsic modes that were extracted using a maximum signal-to-residual ratio stopping criterion. A close-up of the time–frequency estimation of the third wavepacket is also shown for comparison. As relative intensity is of primary interest, the spectra are normalized to a [0, 1] range. b, As in a, but 0-dB white Gaussian noise is added to the synthetic data. The parameters remained the same. c, MAPE scores for the clean and noisy data. Boxes show the median and 25th to 75th percentile range; whiskers show minima and maxima. In the top plot only medians are visible as results on the clean dataset are deterministic and, hence, contain no variance. See Supplementary Table 1 for the distribution statistics. Source data
Fig. 5
Fig. 5. Benchmark results of human EEG data.
a, The Fp1 and Fp2 pre-frontal and Fz mid-frontal EEG electrodes, which were averaged to assess mental workload. Credit: Imagewriter/Alamy. b, Full fCWT and CWT, 3.0%CWT, STFT and DWT of EEG, recorded during 30 s of rest and 30 s of mental arithmetic. Full fCWT and 3.0%CWT analyze the signal using the Morlet wavelet (σ = 20) at 650 and 20 scales, evenly spaced in exponential space, respectively. STFT uses a 500-ms Blackman window with 400-ms overlap and DWT uses 11 levels of 15-order Daubechie wavelet decomposition. Spectra are normalized to [0, 1], except for a few spectra that are amplified to enhance visibility. c, Zoomed view during the arithmetic task to show each algorithm’s ability to extract the intricate time–frequency details of the β frequency band (13–30 Hz). d, The RAR (equation (1)) of full fCWT and CWT, 3.0%CWT, STFT and DWT versus the number of electrodes with a 1-kHz EEG signal. Source data
Fig. 6
Fig. 6. Benchmark results of in vivo electrophysiology data.
a, In vivo electrophysiology measurements were obtained by the insertion of a Neuropixel inside the anteromedial area of a rodent’s visual cortex. Mouse drawing adapted from ref. under a CC BY license. b, Time–frequency estimations by fCWT, CWT, STFT and DWT during 9 s of four 250-ms full-field, high- and low-contrast flashes. The LFP shows exclusive activation after the black stimuli. Full fCWT and 3.0%CWT analyze the signal using the Morlet wavelet (σ = 16) at 520 and 16 scales evenly spaced in exponential space, respectively. STFT uses a 500-ms Blackman window with 400-ms overlap and DWT uses 11 levels of 15-order Daubechie wavelet decomposition. Spectra are normalized to [0, 1], except for a few spectra that are amplified to enhance visibility. c, Zoom-in of the β- (15–30 Hz), γ- (32–100 Hz) and high γ-frequency bands (>100 Hz), immediately after a black stimulus. Three frequency components in the β-frequency band and two γ bursts are present. Plot scales are aligned as well as possible, despite differences in exponential scale (fCWT and CWT) and linear scale (STFT). d, The RAR (equation (1)) of full-resolution fCWT and CWT, 3.0%CWT, STFT and DWT versus the number of channels in a 2.5-kHz electrophysiology signal. Source data
Extended Data Fig. 1
Extended Data Fig. 1. Algorithmic implementation of fCWT
The algorithmic implementation behind fCWT can be divided into: i) scale-independent and ii) scale-dependent operations. The scale-dependent operations each calculate the wavelet coefficients of a single scale-factor in the final time–frequency matrix. By repeating the scale-dependent part m = ∣a∣ times, the time–frequency matrix is build up one row at a time.
Extended Data Fig. 2
Extended Data Fig. 2. FFTW’s interleaving storing format
Using an interleaving value format, the Fastest Fourier Transform in the West (FFTW) writes a complex-valued Fourier transform to memory. As the CPU caches adjacent values when accessing memory, accessing the complex and real part only requires single memory access instead of two.
Extended Data Fig. 3
Extended Data Fig. 3. From mother to daughter wavelet
The generation of the daughter wavelet ψ^a[k] is done efficiently by downsampling the mother wavelet Ψ^[k]. This eliminates the need for expensive Gaussian calculations in the scale-dependent step. The mother wavelet is only calculated once in the scale-independent step.
Extended Data Fig. 4
Extended Data Fig. 4. SIMD multiplication
fCWT combines the generation of the daughter wavelet and its multiplication with the Fourier transformed input signal together in one Single Instruction, Multiple Data (SIMD) multiplication. As the Fourier transformed input signal is complex-valued, the real daughter wavelet values are copied twice such that SIMD can perform an element-wise multiplication between both buffers. In this example a scale-factor of a = 3 is used.
Extended Data Fig. 5
Extended Data Fig. 5. Boundary effects in fCWT and MATLAB
With fCWT we perform zero extension to mitigate boundary effects. In contrast, by default MATLAB uses a content dependent mirror extension. In some cases, such an extension strategy can increase boundary effect severity instead of decreasing it as can be seen here. Source data

Similar articles

Cited by

References

    1. Gabor D. Theory of communication. Part 1: the analysis of information. J. Inst. Electr. Eng. 1946;93:429–441.
    1. Fano, R. M. Transmission of Information: A Statistical Theory of Communications (MIT Press, 1961).
    1. Boukouvala, E., Miridakis, N. & Veloni, A. Digital and Statistical Signal Processing (CRC Press, 2019).
    1. Boashash, B. Time–Frequency Signal Analysis and Processing: A Comprehensive Reference 2nd edn (Academic, 2016).
    1. Addison PS. Introduction to redundancy rules: the Continuous Wavelet Transform comes of age. Philos. Trans. R. Soc. A Math. Phys. Eng. Sci. 2018;376:20170258. doi: 10.1098/rsta.2017.0258. - DOI - PMC - PubMed