# Calculate Time-varying PSD

**URL:** <https://mne.discourse.group/t/calculate-time-varying-psd/4423>\
**Category:** Support & Discussions\
**Tags:** eeg, ieeg-and-ecog\
**Created:** [February 17, 2022, 2:25am UTC](https://mne.discourse.group/t/calculate-time-varying-psd/4423 "2022-02-17T02:25:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BarryLiu97](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/barryliu97/32/33_2.png) [@BarryLiu97](https://mne.discourse.group/u/BarryLiu97)\
**Post date:** [February 17, 2022, 2:25am UTC](https://mne.discourse.group/t/calculate-time-varying-psd/4423/1 "2022-02-17T02:25:28Z")

</div>

Hi, I want to get the time-varying PSD.  
If I do `average=None` for psd\_welch, then the output would be (n\_channels, n\_freqs, n\_segments), which is a time-varying PSD.  
However, I want to make sure that, will the functions like ` mne.time_frequency.tfr_morlet`,`mne.time_frequency.tfr_multitaper` or `mne.time_frequency.tfr_stockwell` give me the same result?

---

<div class="post-metadata">

**Author:** ![larsoner](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/larsoner/32/3_2.png) [@larsoner](https://mne.discourse.group/u/larsoner)\
**Post date:** [February 21, 2022, 3:36pm UTC](https://mne.discourse.group/t/calculate-time-varying-psd/4423/2 "2022-02-21T15:36:27Z")

</div>

> [@BarryLiu97](#):
>
> However, I want to make sure that, will the functions like ` mne.time_frequency.tfr_morlet` , `mne.time_frequency.tfr_multitaper` or `mne.time_frequency.tfr_stockwell` give me the same result?

They won’t give the _same_ result, but they should all give _similar_ results whose differences are explained by the differences in underlying computations. IIRC the `tfr_*` functions will return objects with the same `times` as the original input, and this will be longer than the Welch output unless you use `n_overlap=n_window - 1` (i.e., a 1-sample sliding window).
