[FieldTrip] downsampling CTF data prior to ft_preprocessing

Max Cantor mcantor at umich.edu
Thu Jan 16 17:17:01 CET 2014


Hi,

So I'm having an issue involving, well I think the issue may not be the
downsampling per se, but it does involve attempting to recreate a code
similar to the above but in fieldtrip.

I'm currently attempting two different methods:

1. Method One: Define trials as a cfg_(condition), with the preprocessing
parameters contained within the cfg. Then preprocess the cfg_condition.
Finally, downsample using ft_resampledata

2. Method Two: Preprocess the data by channel in a for loop, then
concatenate using ft_appenddata, followed by epoching, and finally
downsampling. In the original version of this method I downsampled in the
for loop, as doing it without downsampling in the loop still strains my
computers memory, but when I do that the epoching doesn't seem to work for
reasons I partially understand, but in any case can't figure out a
workaround for that would be reasonably straightforward.

In any case, when I do either of these methods, I run into an error:

1. For the first method

reading and preprocessing trial 1 from 100
getCTFdata: dataList error: points=21086:21085  trial=1
            points/trial=1584000   No. of trials=1


2. The Second method

Attempted to access data.time.%cell(1); index out of bounds because
numel(data.time.%cell)=0.

Error in ft_resampledata (line 149)
    firstsmp(itr) = data.time{itr}(1);

Again, I'm not entirely convinced the issue is with downsampling per se,
but that is my best guess at the moment. Any help would be greatly
appreciated.

Max Cantor
Research Assistant
Computational Neurolinguistics Lab
University of Michigan


On Thu, Jan 16, 2014 at 9:58 AM, Vladimir Litvak
<litvak.vladimir at gmail.com>wrote:

> Here it is, just in case some else will need it in the future.
>
> #!/bin/sh
> files=`ls -1Ad ${1}`
>
> for f in $files
> do
>   newSingleTrialDs $f ./s_`basename $f`
>   newDs -f -filter processing.cfg -resample 8  ./s_`basename $f`
> ./r_`basename $f`
>   rm -rf ./s_`basename $f`
> done
>
>
>
>
> On Thu, Jan 16, 2014 at 2:51 PM, Frédéric Roux <f.roux at bcbl.eu> wrote:
>
>> Hi Vladimir,
>>
>> looks like the shell-script got blocked my the mail-server.
>> would you mind sending it to froux at bcbl.eu ?
>>
>> Thanks,
>>
>> Fred
>>
>> Frédéric Roux
>>
>> ----- Original Message -----
>> From: "Vladimir Litvak" <litvak.vladimir at gmail.com>
>> To: "FieldTrip discussion list" <fieldtrip at science.ru.nl>
>> Sent: Thursday, January 16, 2014 2:28:03 PM
>> Subject: Re: [FieldTrip] downsampling CTF data prior to ft_preprocessing
>>
>>
>> [Text File:warning1.txt]
>>
>>
>>
>> Here is my old code. Actually the config file is just for filtering but I
>> think you must low-pass before downsampling as it won't do it
>> automatically. It might do more than you need as I also had to convert
>> pseudo-epoched to continuous data.
>>
>>
>> Vladimir
>>
>>
>>
>> On Thu, Jan 16, 2014 at 1:10 PM, Frédéric Roux < f.roux at bcbl.eu > wrote:
>>
>>
>> Hi Vladimir,
>>
>> yes now I remember - newDs - will give it a try.
>>
>> Thanks a lot everyone for the fast and helpful comments!
>>
>> Fred
>>
>>
>> ----- Original Message -----
>> From: "Vladimir Litvak" < litvak.vladimir at gmail.com >
>> To: "FieldTrip discussion list" < fieldtrip at science.ru.nl >
>>
>>
>> Sent: Thursday, January 16, 2014 1:57:25 PM
>> Subject: Re: [FieldTrip] downsampling CTF data prior to ft_preprocessing
>>
>>
>>
>> Dear Fred,
>>
>>
>> The CTF command line tool is called newDs . There is a configuration file
>> that you should set-up to specify that you want it to downsample. I used it
>> a long time ago but I can try to find out more details if you can't figure
>> it out yourself. The documentation for the function should be in CTF PDF
>> files.
>>
>>
>> Best,
>>
>>
>> Vladimir
>>
>>
>>
>> On Thu, Jan 16, 2014 at 12:30 PM, Frédéric Roux < f.roux at bcbl.eu > wrote:
>>
>>
>> Hi Jim, Hi Eelke,
>>
>> thanks for the fast response.
>>
>> My issue is that I would like to use ft_definetrial
>> to get to my trigger events, hence the reason why
>> I want to downsample the raw-data before accessing it
>> with ft.
>>
>> But technically, I guess I should be able to write up
>> my own trigger detection code. It's just more convenient
>> without having to do that extra step.
>>
>> I thought I'd ask before doing that.
>>
>> In any case if anyone comes up with an idea how to do the
>> downsampling on the raw-data, please let me know.
>>
>> Best,
>> Fred
>>
>>
>>
>> Frédéric Roux
>>
>>
>> ----- Original Message -----
>> From: "J.D. Herring (Jim)" < j.herring at fcdonders.ru.nl >
>> To: "FieldTrip discussion list" < fieldtrip at science.ru.nl >
>> Sent: Thursday, January 16, 2014 1:22:07 PM
>> Subject: Re: [FieldTrip] downsampling CTF data prior to ft_preprocessing
>>
>> Hi Fred,
>>
>>
>> If memory is an issue you could try reading-in the data per channel,
>> resample, and appending afterwards.
>>
>> Best,
>>
>> Jim
>>
>>
>> -----Original Message-----
>> From: fieldtrip-bounces at science.ru.nl
>> [mailto: fieldtrip-bounces at science.ru.nl ] On Behalf Of Frédéric Roux
>> Sent: donderdag 16 januari 2014 13:00
>> To: FieldTrip discussion list
>>
>>
>> Subject: [FieldTrip] downsampling CTF data prior to ft_preprocessing
>>
>> Dear all,
>>
>> does anyone know of a good method to downsample MEG-data acquired with a
>> CTF system before reading it into Matlab/fieldtrip.
>>
>> I remember that there is a command-line tool provided by CTF which can do
>> preprocessing, but I don't remember exactly if it does the job.
>>
>> Or does anyone know of a good alternative solution?
>>
>> Best,
>> Fred
>>
>> _______________________________________________
>> 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
>>
>> _______________________________________________
>> 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
>>
>> _______________________________________________
>> 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
>>
>> _______________________________________________
>> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140116/2652abbc/attachment-0001.html>


More information about the fieldtrip mailing list