[FieldTrip] ft_freqanalysis wavelet problem

Silvia Formica Silvia.Formica at UGent.be
Thu Jul 26 12:45:26 CEST 2018

Dear Stephen,

thanks a lot for your reply.

I actually figured out the baseline was the issue, as I was computing the Morlet on a shorter time-window and I was trying to baseline-correct with an interval that was outside of my TFR. With this adjustment I do see the plot as I expected it.

Concerning the warning on the cfg.toi, I chose on purpose the step according to my sampling rate, but I will consider increasing it. My concern is that I might somehow be losing information due to this mismatch between input and output time-bins.




From: fieldtrip <fieldtrip-bounces at science.ru.nl> on behalf of Stephen Whitmarsh <stephen.whitmarsh at gmail.com>
Sent: 26 July 2018 11:32
To: FieldTrip discussion list
Subject: Re: [FieldTrip] ft_freqanalysis wavelet problem

Dear Silvia,

The warning seems reasonable to me, as the output times probably don't map perfectly on the input times. (BTW, your cfg.toi is rather dense, given that you use a width of 7, you can probably increase the time intervals a lot without losing much information, speeding it up as well)

Why you get a 'blue output' is hard to say, but you can set the zlim e.g. as 'absmax'. Take a look at the ft_freqanalysis function help in the beginning of the code (or type 'help ft_freqanalysis' in the MATLAB command window), to see your options there. You might want to play with a baseline correction in ft_freqanalysis to help visualise data with is otherwise affected with 1/f power. Also, check out FieldTrip visualisation tutorial, which should help you explore the options.

Best wishes,

On 26 July 2018 at 09:57, Silvia Formica <Silvia.Formica at ugent.be<mailto:Silvia.Formica at ugent.be>> wrote:

Dear all,

I am new to fieldtrip so I apologize in advance if my question is trivial.

I am trying to run a time frequency analysis with Morlet wavelets.

Here is the code I am using:

cfg = [];
cfg.channel    = 1:64;
cfg.method     = 'wavelet';
cfg.pad        = 10;
cfg.width      = 7;
cfg.output     = 'pow';
cfg.foi        = 4:1:30;
cfg.toi        = 0:0.0039:2;    % my sampling rate is 512 Hz
TFRwave        = ft_freqanalysis(cfg, data_clean);

Where data_clean is the struct containing my trials. All my trials are the same length.

When I run this code, I get the following warning:

Warning: output time-bins are different from input time-bins
trial 1, frequency 26 (29.00 Hz)
Warning: output time-bins aretrial 2, frequency 25 (28.00 Hz)
Warning: output time-bins aretrial 3, frequency 24 (27.00 Hz)
Warning: output time-bins aretrial 4, frequency 25 (28.00 Hz)
Warning: output time-bins aretrial 5, frequency 23 (26.00 Hz)

I have no idea what this means. Any suggestion?

Despite the warning, the TRFwave is computed, but when I try to plot it I get a completely blue output. Here is the code I am using for the plot:

cfg = [];
cfg.baseline     = [-0.5 -0.1];
cfg.baselinetype = 'absolute';
cfg.zlim         = [-3e-27 3e-27];
cfg.showlabels   = 'yes';
cfg.layout       = 'biosemi64.lay';
ft_multiplotTFR(cfg, TFRwave)

When I check the content of my TFRwave I can see it is not made of NaNs.
Is the problem due to the setting cfg.zlim? It is not clear to me how to set it.

Thanks in advance for any help!


fieldtrip mailing list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20180726/95db435e/attachment.html>

More information about the fieldtrip mailing list