[FieldTrip] single-trial phase at stimulus onset using Hilbert transform

Hussain, Sara (NIH/NINDS) [F] sara.hussain at nih.gov
Thu Jun 18 15:25:49 CEST 2020


Hey Georgios-

This can definitely be a tricky problem. I have run into this in the past when trying to sort responses to TMS based on when the stimulus occurs relative to the phase. My colleagues and I came up with a non-fieldtrip implementation of this which is published here: https://academic.oup.com/cercor/article/29/9/3766/5218042

What happens is because filters use a window of samples, anything after the stimulus can contaminate phase estimates at the stimulus timepoint. We ended up using a clamping approach in which all values beginning 1 sample before stimulus to the end of the epoch are clamped to the value of the sample preceding the stimulus. Then we use a one pass FIR filter and correct for the phase delay to get the filtered data.

I’ve attached a function I wrote to perform this process– you would have to modify some of the parameters in the function (sampling rate, filtering freqs, etc). If you end up using this please cite the above paper in which we’ve validated the phase estimates this filtering approach produces. After you get the filtered data, you can do the Hilbert and phase extraction as you mention.

Hope this helps-
Sara


From: george michael <gmichael_ at hotmail.com>
Reply-To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Date: Thursday, June 18, 2020 at 9:11 AM
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Subject: [FieldTrip] single-trial phase at stimulus onset using Hilbert transform

Dear Fieldtrip Community,

I am trying to extract the alpha phase at stimulus onset from single trials.
My approach is to :
1) Band-pass filter the trial segments from -500ms to 0 (±1Hz around individual alpha frequency).
I use the filter 'firws' and filter direction 'onepass' to avoid smearing poststimulus activity into the prestimulus interval.
2) Compute Hilbert transform to extract the instantaneous phase of the bandpass signal.
3) Select the phase at the last sample (t=0) as the one representing phase at stimulus onset.

 cfg=[];
cfg.channel = 'O1';
cfg.bpfilter='yes';
cfg.bpfreq=[foi-1 foi+1];
cfg.bpfilttype= 'firws';
cfg.bpfiltdir= 'onepass';
cfg.hilbert='angle';
phase = ft_preprocessing(cfg , trials_prestim);

 for tr=1:length(phase .trial)
       phase_onset(tr,:)=phase .trial{tr}(:,end); % select phase at last sample
 end

The problem is that the band-bass signal looks quite weird at the right edge, towards t=0s (see attached figure).

Do you have any idea what would be the reason for this problem?
And which would be the optimal way to extract phase at stimulus onset?

Many thanks,
Georgios
-----------------------
Georgios Michail, MSc.
Department of Psychiatry and Psychotherapy
Charite-Universitätsmedizin Berlin



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20200618/3aa1cc99/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mu_filt_rtms.m
Type: application/octet-stream
Size: 2843 bytes
Desc: mu_filt_rtms.m
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20200618/3aa1cc99/attachment.obj>


More information about the fieldtrip mailing list