[FieldTrip] ft_preprocessing high-pass filtering question

Thomas Hartmann thomas.hartmann at th-ht.de
Fri Jul 5 10:16:11 CEST 2013


hi,
i would do this:

/% do definetrial for all data...//
//cfg = [];//
//cfg.dataset = 'younameit.data';//
//cfg.trialdef.triallength = Inf;//
//cfg.trialdef.ntrials = 1;//
//
//cfg = ft_definetrial(cfg);//
//
//% preprocess all the data//
//cfg.hpfilter = 'yes';//
//cfg.hpfreq = 0.5;//
//
//alldata = ft_preprocessing(cfg);//
//
//% now we do definetrials for our trials...//
//cfg = [];//
//cfg.//trialdef.prestim = 2;//
//cfg.trialdef.poststim = 2;//
//cfg.trialdef.eventype = 'YourEventType';//
//cfg.trialdef.eventvalue = [1 2 3 4 5];//
//
//cfg = ft_definetrial(cfg);//
//
//% now we use the trl field we just created for ft_redefinetrial...//
//data_epochs = ft_redefinetrial(cfg, alldata);/

i havent tested the code but it should be more or less fine.. and the 
good thing is that you stay within the high level fieldtrip functions....

best,
thomas



On 05.07.2013 08:41, "Jörn M. Horschig" wrote:
> Hi Aaron,
>
> in that case you need to define only one trial, going from 0 to the 
> end of the recording and call ft_preprocessing. Not sure if this will 
> work, but  something like
>
> /  cfg = [];//
> //   ...//
> //  hdr = ft_read_header(cfg.dataset);//
> //  cfg.trl = [0 hdr.nSamples 0];//
> //  data = ft_preprocessing(cfg);/
>
> Subsequently you might want to try using ft_redefinetrial to get the 
> epochs you are interested in.
>
> Note however that you need to have sufficient memory for reading all 
> your data in. I am not sure how much memory you have, how long your 
> recording is, how high your sampling rate and how many channels you 
> have. If Matlab crashes when reading in everything, you would need to 
> use trialpadding, or need to think of something clever yourself :)
>
> Would be great if you could let us know how you solve this in the end 
> so that we can refer to that if someone else in future has a similar 
> question.
>
> Best,
> Jörn
> On 7/5/2013 3:51 AM, Aaron Schurger wrote:
>> Thanks, Thomas. What if I wanted to apply the filtering to the entire
>> time series first, and then extract the trial epochs after filtering?
>> Is there a way to do that?
>> Thanks,
>> Aaron
>>
>> On Thu, Jul 4, 2013 at 4:31 PM, Thomas Hartmann
>> <thomas.hartmann at th-ht.de>  wrote:
>>> hi aaron,
>>> filtering is generally applied after the data have been epoched. to avoid
>>> the filter artifacts you are speaking about, we normally define epochs that
>>> are sufficiently larger so that these artifacts would be in data we are not
>>> interested in. about 1s at both ends of the epoch should be enough in most
>>> cases. but you better check... later you can use ft_redefinetrial to discard
>>> that extra data.
>>> hope this helps.
>>> best,
>>> thomas
>>>
>>>
>>>
>>> Aaron Schurger<aaron.schurger at gmail.com>  schrieb:
>>>> Hi,
>>>> When you read in a data file using ft_preprocessing, with high-pass
>>>> filtering, is the high-pass filter applied before the data are epoched
>>>> (i.e. on the entire time series for the whole data file), or is the
>>>> high-pass filter applied separately to each epoch? For very low
>>>> frequencies (with period longer than one data epoch) this will make a
>>>> difference.
>>>> Thanks!
>>>> Aaron
>>>>
>>>> --
>>>> Aaron Schurger, PhD
>>>> Post-doctoral researcher
>>>> INSERM U992 / NeuroSpin
>>>> CEA - Saclay, France
>>>> +33-1-69-08-66-47
>>>> aaron.schurger at gmail.com
>>>> http://www.unicog.org
>>>> ________________________________
>>>>
>>>> fieldtrip mailing list
>>>> fieldtrip at donders.ru.nl
>>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>> Dr. Thomas Hartmann
>>>
>>> CIMeC - Center for Mind/Brain Sciences
>>> Università degli Studi di Trento
>>> via delle Regole, 101
>>> 38060 Mattarello (TN)
>>> ITALY
>>>
>>> Tel: +39 0461 28 2779
>>> Fax: +39 0461 28 3066
>>> Email:thomas.hartmann at th-ht.de
>>> Homepage:http://sites.google.com/site/obobcimec/
>>>
>>> "I am a brain, Watson. The rest of me is a mere appendix. " (Arthur Conan
>>> Doyle)
>>>
>>> _______________________________________________
>>> fieldtrip mailing list
>>> fieldtrip at donders.ru.nl
>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>
>
> -- 
> Jörn M. Horschig
> PhD Student
> Donders Institute for Brain, Cognition and Behaviour
> Centre for Cognitive Neuroimaging
> Radboud University Nijmegen
> Neuronal Oscillations Group
> FieldTrip Development Team
>
> P.O. Box 9101
> NL-6500 HB Nijmegen
> The Netherlands
>
> Contact:
> E-Mail:jm.horschig at donders.ru.nl
> Tel:    +31-(0)24-36-68493
> Web:http://www.ru.nl/donders
>
> Visiting address:
> Trigon, room 2.30
> Kapittelweg 29
> NL-6525 EN Nijmegen
> The Netherlands
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip


-- 
Dr. Thomas Hartmann

CIMeC - Center for Mind/Brain Sciences
Università degli Studi di Trento
via delle Regole, 101
38060 Mattarello (TN)
ITALY

Tel: +39 0461 28 2779
Fax: +39 0461 28 3066
Email: thomas.hartmann at th-ht.de
Homepage: http://sites.google.com/site/obobcimec/

"I am a brain, Watson. The rest of me is a mere appendix. " (Arthur Conan Doyle)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130705/27e108a2/attachment-0002.html>


More information about the fieldtrip mailing list