# [FieldTrip] Problem with TFR calculation using multitaper

Andreas Sauer sauer.mpih at googlemail.com
Sat Nov 17 15:58:25 CET 2012

```Hi Matt, Hi Fred,

thanks for your answers! It helped a lot! The artifact seems indeed to be
due to the 60 Hz refresh rate of our beamer. I filtered the data again and
the result is pretty clear (see attached picture - one subject).

Thanks again and a nice weekend for you two!

Best,

Andreas

> 2012/11/17 Frederic Roux <f.roux at bcbl.eu>
>
>> Hi Matt, Hi Andreas,
>>
>> Indeed, I remember seeing strong 60 Hz line noise as
>> a result of the beamer refresh rate (60Hz).
>>
>> Best,
>> Fred
>>
>>
>> ----- Original Message -----
>> From: "Matt Craddock" <matt.craddock at uni-leipzig.de>
>> To: "FieldTrip discussion list" <fieldtrip at science.ru.nl>
>> Sent: Friday, November 16, 2012 4:50:06 PM
>> Subject: Re: [FieldTrip] Problem with TFR calculation using multitaper
>>
>> Dear Andreas and Frederic,
>>
>> Another possibility would be a 60 Hz signal (a steady-state evoked
>> potential to monitor refresh rate, for example) running throughout the
>> trial, including in the baseline period. Given that you're using 11 Hz
>> frequency smoothing, this would effectively be smeared across the 49-71
>> Hz range.
>>
>> You'd have a much higher baseline signal in the 49-71 Hz range (because
>> of the 60 Hz signal appearing in all those frequencies), but the
>> strength of the actual signal in those ranges wouldn't differ. So, the
>> signal-to-baseline ratio would be much lower (because your
>> signal-to-noise ratio is worse), and that'd created the appearance of
>> boundaries at the edges of the frequency smoothing (because at 71 Hz you
>> are still getting the 60Hz noise, but at 72Hz, you are not, so your
>> signal-to-noise ratio dramatically changes).
>>
>> I've attached a pic showing something similar caused by 50 Hz line noise
>> (in EEG, with ~12Hz freq smoothing).
>>
>> So I'd suggest checking the FFT of your data and possibly putting in a
>> notch at 60 Hz if there's a big peak there.
>>
>> Cheers,
>> Matt
>>
>>
>> On 16/11/2012 14:51, Frederic Roux wrote:
>> >
>> > Dear Andreas,
>> >
>> > if you used a 50 Hz notch filter in your
>> > preprocessing, that is probably the reason
>> > why you are seeing the 'artificial' cut
>> > between 30 and 70 Hz.
>> >
>> > My guess is that you ran your notch filter
>> > on segmented epochs of a few seconds (resulting
>> > in a low spectral resolution for your notch filter).
>> > This will wipe out a ~10Hz box (in your case I'm just guessing)
>> > around the line noise frequency.
>> >
>> > Running the multitaper on top of that may explain
>> > the pattern you are observing.
>> >
>> >
>> > Best,
>> >
>> > Fred
>> > ----- Original Message -----
>> > From: "Andreas Sauer" <sauer.mpih at googlemail.com>
>> > To: "FieldTrip discussion list" <fieldtrip at science.ru.nl>
>> > Sent: Friday, November 16, 2012 2:36:01 PM
>> > Subject: [FieldTrip] Problem with TFR calculation using multitaper
>> >
>> >
>> > Dear all,
>> >
>> > I have encountered a problem when trying to calculate the power
>> spectrum of my data and I was wondering if anyone could help me to
>> determine the origin of this problem.
>> >
>> > For the analysis I used multitapers (dpss) with a 11 Hz freq-smoothing
>> and a time window with a length of 500 ms ending up with 10 tapers for the
>> TFR calculation (the freq range is 20 - 200 Hz):
>> >
>> >
>> > cfg = [];
>> > cfg.output = 'pow';
>> > cfg.channel = 'MEG';
>> > cfg.method = 'mtmconvol';
>> > cfg.taper = 'dpss';
>> > cfg.keeptrials = 'no';
>> > cfg.foi = [20:1:200];
>> > cfg.toi = [-0.5:0.05:1.0]; % the preprocessed data length is 2 sec,
>> from -0.8 to 1.2 s
>> > cfg.tapsmofrq = ones(length(cfg.foi),1).*11; % spectral smoothing = +/-
>> 11 Hz
>> > cfg.t_ftimwin = ones(length(cfg.foi),1).*0.5; % length of time window =
>> 500 ms
>> > cfg.pad = 'maxperlen';
>> >
>> > TFR_Mult_DPSS_10tapers_fmin20Hz_fmax200Hz =
>> ft_freqanalysis(cfg,DataOut);
>> >
>> > After calculation I did a baseline normalization:
>> >
>> >
>> > cfg = [];
>> > cfg.baseline = [-0.4 -0.1];
>> > cfg.baselinetype = 'relchange';
>> >
>> > TFR_HighGamma{subject,condition} =
>> ft_freqbaseline(cfg,TFR_file.TFR_Mult_DPSS_10tapers_fmin20Hz_fmax200Hz);
>> >
>> > averaged:
>> >
>> >
>> > cfg = [];
>> > cfg.channel = 'ParOcc'; % parietal and occipital channels
>> > GA_TFR_HighGamma{condition} =
>> ft_freqgrandaverage(cfg,TFR_HighGamma{:,condition});
>> >
>> > and finally plotted the spectrum:
>> >
>> >
>> > time(1) = 3; % -400 ms
>> > time(2) = 27; % 800 ms
>> > indFreq = [20 200];
>> > freq = find(ismember(GA_TFR_HighGamma{i}.freq, indFreq) == 1);
>> >
>> > power = squeeze(mean(GA_TFR_HighGamma{i}.powspctrm,1));
>> > power = mean(GA_TFR_HighGamma{i}.powspctrm(:,:,time(1):time(2)),1);
>> > power = mean(power,1);
>> >
>> > fig = figure;
>> > set(fig,'PaperUnits','centimeters');
>> > set(fig,'Units','centimeters');
>> > set(fig,'PaperSize',[15 15]);
>> > set(fig,'PaperPosition',[0 0 14 14]);
>> > set(gcf,'Color',[1 1 1]);
>> >
>> > ha = gca;
>> >
>> pcolor(GA_TFR_HighGamma{i}.time(time(1):time(2)),GA_TFR_HighGamma{i}.freq,squeeze(power));
>> > set(ha,'FontName','Arial','FontSize',10,'LineWidth',1.5);
>> > shading interp;
>> > xlim([-0.4 0.8]);
>> > ylim([40 120]);
>> > caxis([-.2 .2]);
>> > hold on;
>> > ha = gca;
>> > plot([0 0],[40 120],'k--','LineWidth',1);
>> > set(ha,'FontName','Arial','FontSize',10,'LineWidth',1.5);
>> > set(ha,'YTick',[40 60 80 100 120]);
>> > colorbar('SouthOutside');
>> > xlabel('Time [sec]');
>> > ylabel('Frequency [Hz]');
>> >
>> > The resulting plot looks strange to me since there is this artifical
>> "cut" at 70 Hz and at 50 Hz. I checked the FAQs but my plot looks different
>> from the "strange" ones described there.
>> > I also attached a screenshot of the MultiplotTFR and there you can see
>> the strange "effect" clearly in channels MLO22 or MRO22 for example.
>> >
>> > Is something wrong with my TFR calculation? Or does the problem arise
>> from an earlier step in the preprocessing?
>> >
>> > Any help or advice would be greatly appreciated!
>> >
>> > Best,
>> >
>> > Andreas
>> >
>>
>>
>> --
>> Dr. Matt Craddock
>>
>> Post-doctoral researcher,
>> Institute of Psychology,
>> University of Leipzig,
>> Seeburgstr. 14-20,
>> 04103 Leipzig, Germany
>> Phone: +49 341 973 95 44
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>
>
>
> --
> Dipl.-Psych. Andreas Sauer
> Max Planck Institute for Brain Research
> Deutschordenstraße 46
> 60528 Frankfurt am Main
> Germany
>
> T: +49 69 96769 278
> F: +49 69 96769 327
> Email: sauer.mpih at gmail.com
> www.brain.mpg.de
>
>

--
Dipl.-Psych. Andreas Sauer
Max Planck Institute for Brain Research
Deutschordenstraße 46
60528 Frankfurt am Main
Germany

T: +49 69 96769 278
F: +49 69 96769 327
Email: sauer.mpih at gmail.com
www.brain.mpg.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20121117/6dbbd9b0/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 60HzFiltered.jpg
Type: image/jpeg
Size: 82747 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20121117/6dbbd9b0/attachment-0004.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Not60HzFiltered.jpg
Type: image/jpeg
Size: 83986 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20121117/6dbbd9b0/attachment-0005.jpg>
```