Back to the main page.

Bug 540 - wavelet convolution in ft_freqanalysis flips phase of signal

Status CLOSED FIXED
Reported 2011-03-22 10:01:00 +0100
Modified 2011-04-20 20:18:17 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P1 major
Assigned to: Roemer van der Meij
URL:
Tags:
Depends on:
Blocks:
See also:

Eelke Spaak - 2011-03-22 10:01:58 +0100

When performing a wavelet convolution using ft_freqanalysis, using cfg.toi = data.trial{1} and cfg.output = 'fourier' (so estimating an amplitude and a phase value for each sample in the original data), the phase is the opposite of what it should be. See the attachment for an illustration. Also, note that performing wavelet convolution using non-FT code gives the correct phase, so the issue is not in wavelet convolution per se. I will look around the FT implementation for wavelet convolution to identify a sign change, but it would probably be wise if someone else looks at it as well -- I do not consider myself an expert on this type of stuff yet :)


Eelke Spaak - 2011-03-22 10:02:29 +0100

Created attachment 33 illutration


Roemer van der Meij - 2011-03-22 19:41:19 +0100

I agree, the convention that I implemented in mtmconvol is that the peak of an oscillation should always be 0, and going counter-clockwise (wavelt: cosine at peak, sine = 0 in upgoing flank). However, the way it is done in specest_wavelet atm, is identical to how it has always been, and this makes me doubt whether it should be changed (it is some ways an arbitrary convention). However, as it used to be impossible to get fourier-output using wltconvol (now specest_wavelet), the absolute phase could never be used, as CSDs only show relative phases (and that was the only one with complex output). How do JM/Robert feel about this? BTW, I would not use 'wavelet' as a method, it's terribly slow compared to mtmconvol, which should give the same (apart from the phase) output in general. Unless you specifically want to use the width and gwidth parameters for manipulating your time and freq res of course... Anyway, you probably now this already but I thought I'd mention it anyway.


Jan-Mathijs Schoffelen - 2011-04-06 13:34:02 +0200

JM and Robert agree: peak at phase 0.