# Wavelet-based TFR with multiple wavelets

**URL:** <https://mne.discourse.group/t/wavelet-based-tfr-with-multiple-wavelets/5812>\
**Category:** Support & Discussions\
**Tags:** eeg, epochs\
**Created:** [October 26, 2022, 1:51pm UTC](https://mne.discourse.group/t/wavelet-based-tfr-with-multiple-wavelets/5812 "2022-10-26T13:51:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mscheltienne](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/mscheltienne/32/827_2.png) [@mscheltienne](https://mne.discourse.group/u/mscheltienne)\
**Post date:** [October 26, 2022, 1:51pm UTC](https://mne.discourse.group/t/wavelet-based-tfr-with-multiple-wavelets/5812/1 "2022-10-26T13:51:01Z")

</div>

I’ve started to look into wavelet-TFR, and MNE offers `tfr_morlet`. But what about other wavelet transformations? After discussion with colleagues, I’d like to try to compute a TFR representation with morlet wavelet + other wavelets at once.

### Morlet wavelet case

In the case of `tfr_morlet`, the function `_compute_tfr` creates one wavelet per frequency of interest to account for variable time-window duration, decreasing with frequency (depending on the number of cycles set).

> <https://github.com/mne-tools/mne-python/blob/50e2c2de3c44d08287d53a04e1e0705e8c76fca9/mne/time_frequency/tfr.py#L364-L366>

Next step, the wavelets are passed to [`_time_frequency_loop`](https://github.com/mne-tools/mne-python/blob/50e2c2de3c44d08287d53a04e1e0705e8c76fca9/mne/time_frequency/tfr.py#L482) as an array of shape `(n_tapers, n_wavelets, n_times`) with `n_tapers=1` for wavelet-based TFR.

Next step, the CWT is computed (as a generator used in `_time_frequency_loop`):

> <https://github.com/mne-tools/mne-python/blob/50e2c2de3c44d08287d53a04e1e0705e8c76fca9/mne/time_frequency/tfr.py#L536-L537>

With the wavelets `W` (`Ws` in `_cwt_gen`) provided as a list of wavelets (1D array): one wavelet per frequency of interest. The CWT generator yields the TFR for each epoch `(n_freqs, n_times)`.

### Multiple wavelets case

Now, what if I want to have both a morlet wavelet + a daubechies wavelet? (as an example only). I’m stuck at this stage:

- Should I combine both wavelets before CWT? And how?
- Should I compute 2 times the CWT, one with each wavelet, and combine the TFR? And how?

EDIT: Not entirely sure, but it looks like I’m referring to DWT.

### Addition to MNE-Python

I’m waiting for the literature that my colleague will forward me about wavelet representation of EEG data, if it checks out, I could add another TFR function in which you provide a list of wavelets to use (by name probably).
