Define Wavelets

Authors

Joseph Paillard

Denis Engemann

In this tutorial we present the meeglet for creating wavelets API for creating wavelets.

For a deep-dive into mathematical background and comparison against alternative definitions, please see Morlet wavelet definition

import numpy as np
import matplotlib.pyplot as plt
from meeglet import define_frequencies, define_wavelets, plot_wavelet_family

The following examples illustrate default settings and options to change smoothing, number of wavelets, frequency shifts an other options.

Default settings

foi, sigma_time, sigma_freq, bw_oct, qt = define_frequencies(
    foi_start=1, foi_end=32, bw_oct=0.5, delta_oct=0.5 / 4.0
)

wavelets = define_wavelets(
    foi=foi, sigma_time=sigma_time, sfreq=250., density='oct'
)

plot_wavelet_family(wavelets, foi, fmax=250);
plt.gcf().set_size_inches(12, 8)

Fewer wavelets

foi, sigma_time, sigma_freq, bw_oct, qt = define_frequencies(
    foi_start=1, foi_end=32, bw_oct=0.5, delta_oct=0.5
)

wavelets = define_wavelets(
    foi=foi, sigma_time=sigma_time, sfreq=250., density='oct'
)

plot_wavelet_family(wavelets, foi, fmax=250);
plt.gcf().set_size_inches(12, 8)

Fewer wavelets, narrower width

foi, sigma_time, sigma_freq, bw_oct, qt = define_frequencies(
    foi_start=1, foi_end=32, bw_oct=0.25, delta_oct=0.5
)

wavelets = define_wavelets(
    foi=foi, sigma_time=sigma_time, sfreq=250., density='oct'
)

plot_wavelet_family(wavelets, foi, fmax=250);
plt.gcf().set_size_inches(12, 8)

Fewer wavelets, clip kernel

foi, sigma_time, sigma_freq, bw_oct, qt = define_frequencies(
    foi_start=1, foi_end=32, bw_oct=0.25, delta_oct=0.5
)

wavelets = define_wavelets(
    foi=foi, sigma_time=sigma_time, sfreq=250., density='oct',
    kernel_width=2
)

plot_wavelet_family(wavelets, foi, fmax=250);
plt.gcf().set_size_inches(12, 8)

Fewer wavelets, shift 150%

foi, sigma_time, sigma_freq, bw_oct, qt = define_frequencies(
    foi_start=1, foi_end=32, bw_oct=0.25, delta_oct=0.5,
    freq_shift_factor=1.5
)

wavelets = define_wavelets(
    foi=foi, sigma_time=sigma_time, sfreq=250., 
)

plot_wavelet_family(wavelets, foi, fmax=250);
plt.gcf().set_size_inches(12, 8)