# [FieldTrip] time-frequency analysis: temporal alignment of output

Aaron Schurger aaron.schurger at gmail.com
Fri Feb 7 17:39:17 CET 2014

```Hi, Eelke,
remains then: how do I know what W is for each frequency band? I think
W will of course depend on the frequency (in the case of morlet
wavelets), being shorter for higher frequencies and longer for lower
frequencies. I know that wavelets are defined in terms of the standard
deviation of the envelope, but the window itself of course extends out
beyond 1 std of the envelope, to some point beyond where the wavelet
tapers to zero (I guess). So, if you know how I can compute W for any
arbitrary frequency band, in the case of morlet wavelets, I would be
very grateful.
Thanks again!
Aaron

On Fri, Feb 7, 2014 at 12:56 PM, Eelke Spaak <eelke.spaak at donders.ru.nl> wrote:
> Hi Aaron,
>
> Indeed, the value you get at t = 0.3 will correspond to the wavelet
> (or, equivalently, the time window that was tapered and
> Fourier-transformed) centered at that time point. So if your time
> window (cfg.t_ftimwin) is 400ms long, the wavelet will have stretched
> from t = 0.1 to t = 0.5 s.
>
> There is no default option to align the time points of interest to an
> edge of the wavelet. However, there is a very straightforward solution
> to what you are asking: if you want to make sure that the wavelet
> 'knows nothing' of the future after e.g. t = 0.5s, then only consider
> the time points up to and including t = 0.3s for any subsequent
> analyses. (Or more general up to t = tA - W/2, where tA is the point
> of interest beyond which no info can bleed into the wavelet, and W is
> the window length.)
>
> Best,
> Eelke
>
> On 7 February 2014 12:43, Aaron Schurger <aaron.schurger at gmail.com> wrote:
>> Hi,
>> I am running a time-frequency analysis using ft_freqanalysis with the
>> wavelet method. I assume that the output in each frequency band is
>> temporally aligned to the midpoint of the wavelet (thinking in terms
>> of convolution): i.e. the power value that I get at time 0.300, for a
>> given frequency f, is precisely the dot product of f's wavelet
>> CENTERED at 0.300 sec in the data. Is that correct? If so, how can I
>> ask for the output of freqanalysis to be time aligned to the leading
>> edge of the wavelet rather than the center? I.e. I want to make sure
>> that each point in the output only has information about the past and
>> knows nothing about the future, with respect to that time. Is there a
>> simple way to do this?
>> Thanks!
>> Aaron
>>
>> --
>> Aaron Schurger, PhD
>> Senior researcher
>> Laboratory of Cognitive Neuroscience
>> Brain-Mind Institute, Department of Life Sciences
>> École Polytechnique Fédérale de Lausanne
>> Station 19, AI 2101
>> 1015 Lausanne, Switzerland
>> +41 21 693 1771
>> aaron.schurger at epfl.ch
>> http://lnco.epfl.ch/
>>
>> _______________________________________________
>> 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

--
Aaron Schurger, PhD
Senior researcher
Laboratory of Cognitive Neuroscience
Brain-Mind Institute, Department of Life Sciences
École Polytechnique Fédérale de Lausanne
Station 19, AI 2101
1015 Lausanne, Switzerland
+41 21 693 1771
aaron.schurger at epfl.ch
http://lnco.epfl.ch/

```