# time frequency analysis

**URL:** <https://mne.discourse.group/t/time-frequency-analysis/1707>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [January 9, 2019, 1:43pm UTC](https://mne.discourse.group/t/time-frequency-analysis/1707 "2019-01-09T13:43:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [January 9, 2019, 1:43pm UTC](https://mne.discourse.group/t/time-frequency-analysis/1707/1 "2019-01-09T13:43:22Z")

</div>

External Email - Use Caution

Hi all~  
&nbsp;&nbsp;&nbsp;&nbsp;I have run tfr\_wavelet with my epochs data. But the averaged results  
make me confused. Following are the script and results. I did not know why  
there is a large power both in started and ended time point. it is wrong ?  
or any problems with my script? I have tried a different time segment but  
have similar results.  
&nbsp;&nbsp;&nbsp;&nbsp;best wishes,  
script:  
import mne  
import os  
import numpy as np  
from mne.time\_frequency import tfr\_morlet  
raw\_fname=('/\*\*\*\*\*\*\*')  
subjectlist=os.listdir(raw\_fname)  
power\_list=list()  
freqs=np.arange(1,21,1)  
n\_cycles=np.logspace(math.log10(2),math.log10(10),20)

for raw\_name in subjectlist:  
raw\_name\_path1=os.path.join(raw\_fname1,raw\_name1)  
epochs=mne.epochs.read\_epochs(raw\_name\_path1)  
epochs.apply\_baseline(baseline=(None,0))  
epochs.pick\_types(meg=False, eeg=True,stim=False,eog=True)  
power, itc=tfr\_morlet(epochs, freqs=freqs,n\_cycles=n\_cycles,  
return\_itc=True, average=True)  
power.apply\_baseline(baseline=(None,0),mode='zscore')  
data1=power.data  
power\_list.append(data1)  
all=np.array(power\_list)  
all\_power=high.mean(0)  
all\_power=mne.time\_frequency.AverageTFR(info=power.info  
,data=all\_power,times=power.times,freqs=power.freqs,nave=14)

[image: image.png]

Tao Xia  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20190109/7fd4629d/attachment-0001.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190109/7fd4629d/attachment-0001.html)  
-------------- next part --------------  
A non-text attachment was scrubbed...  
Name: image.png  
Type: image/png  
Size: 57326 bytes  
Desc: not available  
Url : [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20190109/7fd4629d/attachment-0001.png](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190109/7fd4629d/attachment-0001.png)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [January 9, 2019, 6:06pm UTC](https://mne.discourse.group/t/time-frequency-analysis/1707/2 "2019-01-09T18:06:42Z")

</div>

External Email - Use Caution

hi Tao,

this is expect edge artifacts. you should crop the tfr object after  
estimation  
to remove the corrupted edges.

HTH  
Alex
