[FieldTrip] [ext] Re: Load already preprocessed data to fieldtrip functions

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Thu Jun 6 09:33:48 CEST 2019


Hi Daniel,

The data needs to be internally consistent:

npoint = size(data.trial{1},2);
fsample = 1000;

data.time{1} = (1:npoint)./fsample;
data.fsample = 1000;

Good luck,
Jan-Mathijs

> On 6 Jun 2019, at 09:20, daniel.strahnen at uni-ulm.de wrote:
> 
> Hi all,
> 
> sorry for bothering you again, but importing already preprocessed LFP data to fieldtrip is still giving me trouble.
> I now try to create the following data structure:
> 
> data.label		 = 	{'CH1'; 'CH2'; 'CH3'; 'CH4'; 'CH5'; 'CH6'; 'CH7'};
> data.time{1} 		 = 	1:1800; % time is 30 minutes, so 1800 seconds
> data.trial{1}		= 	Output_data'; % Output_data' is a matrix: Channels x timepoints
>                             			            % timepoints = 1800000 (1800 seconds  x 1000
>                              			            % samples per second
> data.fsample 		= 	1000; % Sampling rate of 1kHz
> 
> The error I get: Error using ft_datatype_raw (line 83)
> inconsistent number of samples in trial 1
> As I can see this is because I use 1800 for time, but the amount of samples are 1800000 (multiplied with the sampling rate), but when I change the time to 1800000 other errors occur within the analysis functions.
> I only have one long trial with 7 channels  of 30 minutes that I want to analyse using ft_freqanalysis and the connectivity functions.
> 
> Thank you very much in advance and best regards
> 
> Daniel
> 
> -----Ursprüngliche Nachricht-----
> Von: Mathis Kaiser <mathis.kaiser at charite.de> 
> Gesendet: Dienstag, 4. Juni 2019 18:26
> An: daniel.strahnen at uni-ulm.de
> Betreff: Re: [ext] Re: [FieldTrip] Load already preprocessed data to fieldtrip functions
> 
> Hi Daniel,
> 
> also see
> http://www.fieldtriptoolbox.org/faq/how_are_the_various_data_structures_defined/
> and e.g. http://www.fieldtriptoolbox.org/reference/ft_datatype_timelock/
> for info on required fields of your data structure.
> 
> Here's a Matlab code snippet that creates a minimal working timelock
> structure:
> 
> %%%
> 
> prePost = [-1 1]; % time around stimulus onset sampleFreq = 500; timeVec = prePost(1):1/sampleFreq:prePost(2);
> 
> nChan = 32;
> nSamples = length(timeVec);
> 
> data.avg = randn(nChan,nSamples); % just some random data data.dimord = 'chan_time'; data.label = compose('e%02i', 1:nChan); data.time = timeVec;
> 
> figure;
> ft_singleplotER([],data)
> 
> %%%
> 
> Best,
> Mathis
> 
> 
> On 04.06.19 17:00, daniel.strahnen at uni-ulm.de wrote:
>> Thanks for the advice! Would it be possible for you to send me just 
>> the structure the you mentioned since I don’t have any data here that 
>> is compatible to the Fieldtrip pipeline?
>> 
>> 
>> 
>> *Von:* fieldtrip <fieldtrip-bounces at science.ru.nl> *Im Auftrag von 
>> *Stephen Politzer-Ahles
>> *Gesendet:* Montag, 3. Juni 2019 17:40
>> *An:* fieldtrip at science.ru.nl
>> *Betreff:* Re: [FieldTrip] Load already preprocessed data to fieldtrip 
>> functions
>> 
>> 
>> 
>> An easy way to hack it is to preprocess some other data using the 
>> Fieldtrip pipeline, grab the structure that's created, and then 
>> manually replace the appropriate fields (like .trial, .average, .time, 
>> etc.) with the fields from your own data. You may also have to replace 
>> some other fields, like .dimord, if they don't match yours; but this 
>> is pretty straightforward to do once you get familiar with the 
>> Fieldtrip data structure. This is what I've done in the past when I 
>> have data I processed in some other software or toolbox but then I 
>> want to use Fieldtrip's functions for cluster-based permutation tests or whatnot.
>> There may be more proper or more efficient ways to do it, but this 
>> hack has worked fine for me so far.
>> 
>> 
>> 
>> ---
>> 
>> Stephen Politzer-Ahles
>> The Hong Kong Polytechnic University
>> Department of Chinese and Bilingual Studies 
>> http://www.mypolyuweb.hk/~sjpolit/
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>    Message: 1
>>    Date: Sun, 2 Jun 2019 16:28:08 +0200
>>    From: <daniel.strahnen at uni-ulm.de <mailto:daniel.strahnen at uni-ulm.de>>
>>    To: <fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl>>
>>    Subject: [FieldTrip] Load already preprocessed data to fieldtrip
>>            functions
>>    Message-ID: <000401d5194f$66ece690$34c6b3b0$@uni-ulm.de
>>    <http://uni-ulm.de>>
>>    Content-Type: text/plain; charset="utf-8"
>> 
>>    Is it possible to use the fieldtrip functions for already
>>    preprocessed data
>>    that is organized in a .mat file.
>> 
>>    The data is stored in a matrix organized as follows: Channels x 
>> samples
>> 
>>    -------------- next part --------------
>>    An HTML attachment was scrubbed...
>>    URL:
>> 
>> <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190602
>> /37bb8ec8/attachment.html>
>> 
>>    ------------------------------
>> 
>> 
>> _______________________________________________
>> fieldtrip mailing list
>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> https://doi.org/10.1371/journal.pcbi.1002202
>> 
> 
> 
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202


_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202


More information about the fieldtrip mailing list