[FieldTrip] single-trial phase at stimulus onset using Hilbert transform
george michael
gmichael_ at hotmail.com
Thu Jun 18 16:49:19 CEST 2020
Hi Sara,
thank you very much for the suggestion and for sharing the script.
I 'll definitely give it a try and compare it with the outcome from Fieldtrip (using firws and onepass-zerophase filter).
All the best,
Georgios
________________________________
From: fieldtrip <fieldtrip-bounces at science.ru.nl> on behalf of Hussain, Sara (NIH/NINDS) [F] <sara.hussain at nih.gov>
Sent: Thursday, June 18, 2020 16:03
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Subject: Re: [FieldTrip] single-trial phase at stimulus onset using Hilbert transform
I sent this reply to your question Georgios but it has yet to go through. Trying again – see below.
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<https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Facademic.oup.com%2Fcercor%2Farticle%2F29%2F9%2F3766%2F5218042&data=02%7C01%7C%7C56db724561a84059bb3f08d8139079b0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637280858538599729&sdata=GkObc1Qr3AlUeQ9RY9zLWHX2DjXIpR9vaLsGlWzZZ%2F8%3D&reserved=0>
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: Tzvetan Popov <tzvetan.popov at uni-konstanz.de>
Reply-To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Date: Thursday, June 18, 2020 at 9:56 AM
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Subject: Re: [FieldTrip] single-trial phase at stimulus onset using Hilbert transform
Using filters is always a “problem”. A symmetric filter will at least not misplace your signal of interest. My reply referred to the “weirdness at the right edge”.
Best
tzvetan
Am 18.06.2020 um 14:44 schrieb george michael <gmichael_ at hotmail.com<mailto:gmichael_ at hotmail.com>>:
Dear Tzvetan,
thanks you for the quick reply.
Wouldn't be a problem to use "onepass-zerophase" or "twopass" given that I am interested in phase at stimulus onset?
Don't both filter-types smear poststimulus activity into the prestimulus interval?
Best,
Georgios
________________________________
From: fieldtrip <fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl>> on behalf of Tzvetan Popov <tzvetan.popov at uni-konstanz.de<mailto:tzvetan.popov at uni-konstanz.de>>
Sent: Thursday, June 18, 2020 14:27
To: FieldTrip discussion list <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>>
Subject: Re: [FieldTrip] single-trial phase at stimulus onset using Hilbert transform
Dear Georgios,
the reason is your cfg.bpfiltdir = ‘onepass’. This should be zero phase or twopass filter. Yet, you will still get filter artefacts at the edges. I suggest you should re-segment your data, e.g. -1000 to 500ms, filter and then re-segment to -500 to 0 again.
Good luck,
tzvetan
Am 18.06.2020 um 14:14 schrieb george michael <gmichael_ at hotmail.com<mailto:gmichael_ at hotmail.com>>:
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
<bandpass_alpha_singlesubj.png>_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip<https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=02%7C01%7C%7C56db724561a84059bb3f08d8139079b0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637280858538609723&sdata=OIGuMA5s5QEkQMJ3Vl%2Fw%2FUH8jNL7ZSozd1ojtP4gnbU%3D&reserved=0>
https://doi.org/10.1371/journal.pcbi.1002202<https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=02%7C01%7C%7C56db724561a84059bb3f08d8139079b0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637280858538629711&sdata=2xfm7gr%2BmKlkmWJCak2FNS8WFgfs2GYgjr5phJp22Ck%3D&reserved=0>
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip<https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=02%7C01%7C%7C56db724561a84059bb3f08d8139079b0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637280858538639705&sdata=Daxb1GMmcQazvBjEfrWy9vtTKELVexCDyZopBriKPg8%3D&reserved=0>
https://doi.org/10.1371/journal.pcbi.1002202<https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=02%7C01%7C%7C56db724561a84059bb3f08d8139079b0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637280858538659694&sdata=jVLuHCF0ey%2FF3FL6OJA25vC7pyRkXMPcX9JkDa7pBus%3D&reserved=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20200618/b5eb9388/attachment.htm>
More information about the fieldtrip
mailing list