[FieldTrip] ft_globalmeanfield : Undefined function of variable 'abort'
barbara.schorr at uni-ulm.de
barbara.schorr at uni-ulm.de
Wed Sep 10 14:07:14 CEST 2014
Dear fieldtripers.
as mentioned in the subject line I would like to anaylse my timelocked
ERP Data with the function ft_globalmeanfield.
I get the Error: Undefined function or variable 'abort'
Error in ft_globalmeanfield (line84)
if abort
in the function it says:
%the abort variable is set to true or false in ft_preamble_inti
if abort
% do not continue function execution in case the outputfile is
present and the user indicated to keep it
return
end
I don't understand what this means. I would really appreciate your
help to get this running.
Also, what is the result when I run this function on my data? (This
method was proposed from a reviewer. I never used it before, so I
don't exactly know what it does and what the result will look like).
Thank you very much in advance!
Best,
Barbara Schorr
Zitat von fieldtrip-request at science.ru.nl:
> Send fieldtrip mailing list submissions to
> fieldtrip at science.ru.nl
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> or, via email, send a message with subject or body 'help' to
> fieldtrip-request at science.ru.nl
>
> You can reach the person managing the list at
> fieldtrip-owner at science.ru.nl
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of fieldtrip digest..."
>
>
> Today's Topics:
>
> 1. Re: Question regarding nonparametric testing for coherence
> differences (Eric Maris)
> 2. Re: Problem with Geodesic 129 layout!! (KatrinH Heimann)
> 3. Re: Problem with Geodesic 129 layout!! (Joseph Dien)
> 4. Re: ft_rejectvisual: removing trials marked as bad
> (Caspar, Emilie)
> 5. Re: TRENTOOL pipeline help (Patricia Wollstadt)
> 6. Latest FT version on ftp-server is from three days ago
> (Holger Krause)
> 7. Re: TRENTOOL pipeline help (Max Cantor)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 8 Sep 2014 15:46:11 +0200 (CEST)
> From: "Eric Maris" <e.maris at psych.ru.nl>
> To: <hweeling.lee at gmail.com>, "'FieldTrip discussion list'"
> <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] Question regarding nonparametric testing for
> coherence differences
> Message-ID: <015901cfcb6b$3fdf1f00$bf9d5d00$@maris at psych.ru.nl>
> Content-Type: text/plain; charset="utf-8"
>
> Dear Hwee Ling,
>
>
>
> In the paper you refer to (Maris et al, JNM, 2007), I did not perform a
> cluster-based permutation test at the level of the channel pairs. Instead,
> all coherences mentioned in the paper are coherence between a single EMG
> channel (2 electrodes mounted on the forearm) and all MEG electrodes. Thus,
> there are as many EMG-MEG coherences as there are MEG channels (275 in our
> lab), and the clustering of these coherences involves the same neighbourhood
> structure as the clustering of channel-specific statistics on power or
> evoked response. The analysis you propose involves clustering in a much more
> complex space, namely the formed by all (MEG,MEG) channel pairs
> (275*275=75625 pairs). In the early days of cluster-based permutation
> statistics, I have worked on this problem but did not pursue it because the
> resulting clusters are very hard to interpret.
>
>
>
> Best,
>
>
>
> Eric Maris
>
>
>
>
>
> Dear all and Prof Maris,
>
> I'm re-posting this question again, as I didn't get any replies previously.
>
> I?m interested to investigate if there are any differences in phase
> synchronization in resting state data at timepoint 2 versus timepoint 1. The
> EEG data was collected using 64 EEG channels, resting state, eyes opened and
> eyes closed. I?ve arbitrarily segmented the resting state data into epochs
> of 2s each, and the epochs with artifacts are excluded completely from
> further analyses. I then performed mtmfft to get the fourier representation
> of the data, extracted the coherence, and compared the coherence difference
> of timepoint 2 versus timepoint 1 of all channels paired with all other
> channels.
>
> I figured that if I extract the connectivity analyses without specifying the
> channelcmb, I get a 'chan_chan_freq' dimord variable that would allow me to
> perform cluster-based statistical analyses. I get an output with ?chan_chan?
> dimord variable. However, I was not 100% sure that this is correct,
> hence, I?ve
> inserted my code (see below). It?ll be great if you could tell me if what I?m
> doing makes any sense at all. Also, I don?t know how I can plot the results
> to see if it make any sense at all.
>
> Also, I checked the values obtained from when I specified "cfg.channelcmb"
> and when I did not specify "cfg.channelcmb", I noticed that the values were
> somehow different. I would assume that the values to be similar, although
> I'm not sure why they would have differences in the values obtained from
> specifying "cfg.channelcmb".
>
> This is my code that I've used thus far:
>
> for sub = 1:5
>
> cfg = [];
>
> cfg.output = 'fourier';
>
> cfg.channel = {'all'};
>
> cfg.method = 'mtmfft';
>
> cfg.keeptrials = 'yes';
>
> cfg.tapsmofrq = 5;
>
> cfg.foilim = [0 100];
>
> cfg.taper = 'dpss';
>
> % find the index for the c200 condition
>
> pre_c200_idx = find(data5.trialinfo == 201);
>
> cfg.trials = pre_c200_idx;
>
> HLF_pre_c200 = ft_freqanalysis(cfg, data5);
>
> post_c200_idx = find(data5.trialinfo == 200);
>
> cfg.trials = post_c200_idx;
>
> HLF_post_c200 = ft_freqanalysis(cfg, data5);
>
>
>
> cfg = [];
>
> cfg.keeptrials = 'no';
>
> cfg.channel = {'all'};
>
> cfg.removemean = 'yes';
>
> cfg.method = 'coh';
>
> HLF_pre_c200coh{sub} = ft_connectivityanalysis(cfg, HLF_pre_c200);
>
> HLF_post_c200coh{sub} = ft_connectivityanalysis(cfg,
> HLF_post_c200);
>
> end
>
>
>
> load('D:\Hweeling_Programs\fieldtrip-20140330\template\layout\easycapM11.mat');
>
> cfg_neighb.method = 'template';
>
> cfg_neighb.layout = lay;
>
> cfg_neighb.channel = 'all';
>
> neighbours = ft_prepare_neighbours(cfg_neighb, sub_HLF_pre_c200coh{1});
>
>
>
> cfg = [];
>
> cfg.layout = lay;
>
> cfg.neighbours = neighbours;
>
> cfg.channel = 'all';
>
> cfg.channelcmb = {cfg.channel, cfg.channel};
>
> cfg.latency = 'all';
>
> cfg.avgovertime = 'no';
>
> cfg.avgoverchan = 'no';
>
> cfg.parameter = 'cohspctrm';
>
> cfg.method = 'montecarlo';
>
> cfg.statistic = 'depsamplesT';
>
> cfg.correctm = 'cluster';
>
> cfg.tail = 0;
>
> % cfg.clustertail = 0;
>
> cfg.alpha = 0.05/8; % to correct for multiple comparisons across 8 frequency
> bands.
>
> cfg.numrandomization = 10000;
>
> cfg.ivar = 2;
>
> cfg.uvar = 1;
>
>
>
> % design matrices
>
> clear design;
>
> design(1,:) = [1:5, 1:5];
>
> design(2,:) = [ones(1,5), ones(1,5) * 2];
>
> cfg.design = design;
>
> % for theta band
>
> cfg.avgoverfreq = 'yes';
>
> cfg.frequency = [4 8]; % I also performed the statistics for delta (2-4),
> alpha (8-10.5), alpha (10.5-13), beta (13-20), beta (20-30), gamma (30-40),
> and gamma (40-100).
>
> [diffc200_theta_stat] = ft_freqstatistics(cfg, sub_HLF_post_c200coh{:},
> sub_HLF_pre_c200coh{:});
>
>
>
> When I tried to plot the results, I used this code:
>
> cfg = [];
>
> cfg.channel = 'all';
>
> cfg.layout = 'lay';
>
> cfg.zlim = [-1 1];
>
> cfg.alpha = 0.05;
>
> cfg.refchannel = 'all';
>
> ft_clusterplot(cfg, diffc200_theta_stat);
>
> However, I was not sure how I could plot the results. I get an error message
> from Fieldtrip when using ft_clusterplot:
>
> Error using topoplot_common (line 366)
>
> no reference channel is specified
>
> Error in ft_topoplotTFR (line 192)
>
> [cfg] = topoplot_common(cfg, varargin{:});
>
> Error in ft_clusterplot (line 372)
>
> ft_topoplotTFR(cfgtopo, stat);
>
>
>
> According to your paper in 2007, the topoplot of the results were masked by
> the spatio-spectral pattern of the significant clusters. I don't know how to
> do this, and I would really appreciate if you can show me how to make such a
> plot.
>
> Thank you very much.
>
> Kind regards,
>
> Hweeling
>
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140908/98b85280/attachment-0001.html>
>
> ------------------------------
>
> Message: 2
> Date: Mon, 8 Sep 2014 21:38:01 +0200
> From: KatrinH Heimann <katrinheimann at gmail.com>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] Problem with Geodesic 129 layout!!
> Message-ID:
> <CACnHcBeqEoQMirfZ-hCKK8rSmbfcNYzxFQH1mmSaeGCuKMN-uA at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Dear Joseph, thanks so much, I really appreciate your help. I was also
> wandering, if maybe there is another bug in my code.
> Our nets are 128 channels, Hydrocel, but as a colleague of me adviced me to
> do so, I also tried the 129 layout.
> My code you find below (without selection of bad channels etc.)
> If you need also the data of two subjects to have a look, let me know!!!
> Best and thanks really!
> Katrin
>
>
> subject=input('Which subject do you want to analyse? ','s');
>
> name = strcat(subject,'.raw');
>
> subjectnumber=input('Which is the subjectnumber?', 's');
>
> sb=subjectnumber
>
> %subjectnumber = strcat(subjectnumber, '.txt')
>
> %%
>
>
> cfg = [];
>
> cfg.dataset = name;
>
> cfg.trialfun = 'ft_trialfun_general'; % this is the default
>
> cfg.trialdef.eventtype = 'trigger';
>
> cfg.trialdef.eventvalue = 'stim'; % the value of the stimulus trigger
>
> cfg.trialdef.prestim = 0.234; % in seconds
>
> cfg.trialdef.poststim = 7.266; % in seconds (whole time of video
> observation, but maybe we need less)
>
> cfg = ft_definetrial(cfg);
>
>
> cfg.trl([1:7],:) = [];
>
>
> %change timeline according to constant offset of 16 ms = 8 samples (because
> recorded with 500 hz)in
>
> %structure trial
>
> cfg.trl(:,3)=cfg.trl(:,3)-8
>
>
> %change timeline to make the cut the zeropoint
>
>
> cfg.trl(:,3)=cfg.trl(:,3)- 1000;
>
>
>
> %% preprocess data
>
> cfg.channel = 'all';
>
> cfg.preproc.detrend = 'yes';
>
> cfg.preproc.demean = 'yes';
>
> cfg.preproc.baselinewindow = [-2.1 -2.0]
>
> %cfg.preproc.bpfilter = 'yes'; - the data here has to be already filtered
>
> %(0.1-45) and bad channels have to be replaced!!!!
>
> %cfg.preproc.bpfreq = [6 32];
>
> %
>
> %
>
> obs_data = ft_preprocessing(cfg);
>
> %
>
> save (strcat(sb,'obs_data') , 'obs_data')
>
>
> %% determining channel neighbours (necessary for Artifact detection)
>
> cfg = [];
>
> cfg.channel = obs_data.label;
>
> cfg.layout = 'GSN128.sfp';
>
> cfg.feedback = 'yes';
>
> lay = ft_prepare_layout(cfg);
>
>
>
> cfg_neighb = [];
>
> cfg_neighb.feedback = 'yes';
>
>
> cfg_neighb.method = 'triangulation';
>
> cfg_neighb.layout = 'GSN128.sfp';
>
> neighbours = ft_prepare_neighbours(cfg_neighb, obs_data);
>
>
> obs_data.elec = ft_read_sens('GSN128.sfp');
>
>
> %% Artifacts - to detect bad channels - is not saved!!!
>
>
>
> cfg.method = 'summary';
>
> cfg.latency=[0 1];
>
> cfg.layout = 'GSN128.sfp'; % this allows for plotting
>
> obs_data_try = ft_rejectvisual(cfg, obs_data);
>
>
> cfg = [];
>
> cfg.viewmode = 'vertical';
>
> cfg.latency=[0 1];
>
> cfg.continuous = 'no';
>
> cfg.plotlabels='yes'
>
> cfg = ft_databrowser(cfg,obs_data);
>
> %cfg.artfctdef.reject = 'complete';
>
> obs_data_try = ft_rejectartifact (cfg,obs_data);
>
>
>
> %% Preparing neighbours for channel repair - but bad channel info in!!!
>
>
> % cfg_neighb = [];
>
> % cfg_neighb.feedback = 'yes';
>
> % cfg_neighb.method = 'triangulation';
>
> % cfg_neighb.layout = 'GSN-HydroCel-128.sfp';
>
> % neighbours = ft_prepare_neighbours(cfg_neighb, obs_data);
>
>
> % Interpolate and put into new data structure
>
> cfg = [];
>
> cfg.badchannel = {};
>
> cfg.layout = 'GSN128.sfp';
>
> cfg.method = 'nearest';
>
> cfg.neighbours = neighbours;
>
> obs_data_channelrepaired = ft_channelrepair(cfg,obs_data)
>
>
> % Check reconstruction
>
> cfg = [];
>
> cfg.viewmode = 'vertical';
>
> cfg.continuous = 'no';
>
> cfg.plotlabels='yes'
>
> cfg = ft_databrowser(cfg,obs_data_channelrepaired);
>
> %cfg.artfctdef.reject = 'complete';
>
> obs_data_clean1 = ft_rejectartifact (cfg,obs_data_channelrepaired);
>
>
> % dat1=obs_data;
>
> % dat2=obs_data_channelrepaired;
>
> %
>
> % x=dat1.trial{1}(62,:); % 68 is channel index of E68
>
> % y=dat2.trial{1}(62,:);
>
> % plot(x);hold on;plot(y,'r');
>
> %
>
> % x=dat1.trial{1}(72,:);
>
> % y=dat2.trial{1}(75,:);
>
> % figure;
>
> % plot(x);hold on;plot(y,'r')
>
> %
>
> % x=dat1.trial{1}(75,:);
>
> % y=dat2.trial{1}(75,:);
>
> % figure;
>
> % plot(x);hold on;plot(y,'r')
>
> %% artifact rejection/trial inspection - throw out electrode jumps etc.
>
>
>
> cfg = [];
>
> cfg.viewmode = 'vertical';
>
> cfg.continuous = 'no';
>
> cfg.plotlabels='yes'
>
> cfg = ft_databrowser(cfg,obs_data_channelrepaired);
>
> %cfg.artfctdef.reject = 'complete';
>
> obs_data_clean1 = ft_rejectartifact (cfg,obs_data_channelrepaired);
>
>
> %% ICA - Anzahl der Komponenten anpassen!- adapt numcomponent according to
> channels interpolated %% 128-number of interp. channels)
>
>
>
> cfg = [];
>
> cfg.channel = {'all'};
>
> cfg.numcomponent = 128
>
> comp = ft_componentanalysis(cfg,obs_data_clean1);
>
> save (strcat(sb,'comp_all') , 'comp')
>
>
> %%
>
> cfg = [];
>
> cfg.viewmode = 'component';
>
> cfg.continuous = 'no';
>
> cfg.plotlabels='some';
>
> cfg.layout = 'GSN128.sfp';
>
> ft_databrowser(cfg,comp);
>
>
> %% poweranalysis components
>
> cfg = [];
>
> cfg.output = 'pow';
>
> cfg.channel = 'all';%compute the power spectrum in all ICs
>
> cfg.method = 'mtmfft';
>
> cfg.taper = 'hanning';
>
> cfg.foi = 0:0.2:50;
>
> obs_freq = ft_freqanalysis(cfg, comp);
>
>
> %And you can plot the spectra:
>
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> nsubplots = 16;
>
> nbyn = sqrt(nsubplots);% sqrt(nsubplots) should not contain decimals, type
> doc subplot
>
>
> Nfigs = ceil(size(comp.topo,1)/nsubplots);
>
> tot = Nfigs*nsubplots;
>
>
> rptvect = 1:size(comp.topo,1);
>
> rptvect = padarray(rptvect, [0 tot-size(comp.topo,1)], 0,'post');
>
> rptvect = reshape(rptvect,nsubplots,Nfigs)';
>
>
> for r=1:size(rptvect,1);
>
> figure;set(gcf,'units','normalized','outerposition',[0 0 1 1]);%full
> screen
>
> k=0;
>
> for j=1:size(rptvect,2);
>
> if~(rptvect(r,j)==0);
>
> k=k+1;
>
> cfg=[];
>
> cfg.channel = rptvect(r,j);
>
> cfg.ylim =[0 500]
>
> cfg.xlim =[0 50]
>
> subplot(nbyn,nbyn,k);ft_singleplotER(cfg,obs_freq);
>
> end
>
> end
>
> end
>
>
> %For the IC topos you'll follow the same logic as above but with:
>
>
> figure
>
> cfg = [];
>
> cfg.component = [1:20]; % specify the component(s) that should be
> plotted
>
> cfg.layout = 'GSN128.sfp';
>
> cfg.comment = 'no';
>
> ft_topoplotIC(cfg, comp)
>
>
> figure
>
> cfg = [];
>
> cfg.component = [21:40]; % specify the component(s) that should be
> plotted
>
> cfg.layout = 'GSN128.sfp';
>
> cfg.comment = 'no';
>
> ft_topoplotIC(cfg, comp)
>
>
> figure
>
> cfg = [];
>
> cfg.component = [41:60]; % specify the component(s) that should be
> plotted
>
> cfg.layout = 'GSN128.sfp';
>
> cfg.comment = 'no';
>
> ft_topoplotIC(cfg, comp)
>
>
> figure
>
> cfg = [];
>
> cfg.component = [61:80]; % specify the component(s) that should be
> plotted
>
> cfg.layout = 'GSN128.sfp';
>
> cfg.comment = 'no';
>
> ft_topoplotIC(cfg, comp)
>
>
>
>
>
>
> %% Seperate observation conditions
>
>
> name1= strcat(num2str(sb),'_90.xls');
>
> list1=xlsread (name1)
>
>
>
>
>
> name2= strcat(num2str(sb),'_180.xls');
>
> list2=xlsread (name2)
>
>
>
> %
>
>
> cfg = []
>
> cfg.trials = [list1]
>
> obs90_data = ft_redefinetrial(cfg,obs_data_channelrepaired)
>
>
> cfg = []
>
> cfg.trials = [list2]
>
> obs180_data = ft_redefinetrial(cfg,obs_data_channelrepaired)
>
>
> %%PIPELINE FOR obs90
>
>
> %% Decompose original data according to the components found before
>
> load (strcat(sb,'comp_all'))
>
>
> cfg = [];
>
> cfg.numcomponent = 128;
>
> cfg.unmixing = comp.unmixing;
>
> cfg.topolabel = comp.topolabel;
>
>
> comp_1 = ft_componentanalysis(cfg, obs90_data);
>
>
>
> %% Reject component
>
> cfg = [];
>
> cfg.component = [];
>
> obs90_data_ica_cleaned = ft_rejectcomponent(cfg, comp_1, obs90_data);
>
>
>
>
> save (strcat(sb,'obs90_ica_cleaned') , 'obs90_data_ica_cleaned')
>
>
>
>
> %% Artifacts - final detection
>
>
>
> cfg.method = 'summary';
>
> cfg.latency=[0 1];
>
> cfg.layout = 'GSN128.sfp'; % this allows for plotting
>
> obs90_data_clean3 = ft_rejectvisual(cfg, obs90_data_ica_cleaned);
>
>
> cfg = [];
>
> cfg.viewmode = 'vertical';
>
> cfg.latency=[0 1];
>
> cfg.continuous = 'no';
>
> cfg.plotlabels='yes'
>
> cfg = ft_databrowser(cfg,obs90_data_clean3);
>
> %cfg.artfctdef.reject = 'complete';
>
> obs90_data_clean2 = ft_rejectartifact (cfg,obs90_data_clean3);
>
>
>
> % Save clean data
>
>
> save (strcat(subject,'obs90_clean') , 'obs90_data_clean2')
>
>
>
> %% Rereferencing data
>
> cfg = [];
>
>
> cfg.channel = 'all';
>
> cfg.preproc.reref = 'yes';
>
> cfg.preproc.refchannel = 'all';
>
> obs90_data_ref= ft_preprocessing(cfg,obs90_data_clean2)
>
>
> save (strcat(subject,'obs90_ref') , 'obs90_data_ref')
>
> %% Snap out smaller pieces (the third second)
>
>
> cfg = []
>
> cfg.toilim = [0 1]
>
>
> obs90_data_small = ft_redefinetrial(cfg,obs90_data_ref)
>
>
> %% TIMELOCK ERP
>
> obs90_data_ERP = ft_timelockanalysis(cfg, obs90_data_small);
>
>
> save (strcat(subject,'obs90_ERP') , 'obs90_data_ERP')
>
>
> %% plot it
>
> cfg = [];
>
> cfg.layout = lay ;
>
> cfg.interactive = 'yes';
>
> ft_multiplotER(cfg, obs90_data_ERP)
>
>
>
>
>
>
>
> %% PIPELINE FOR obs180
>
>
>
> %% Decompose original data according to the components found before
>
> load (strcat(sb,'comp_all'))
>
>
> cfg = [];
>
> cfg.numcomponent = 128
>
> cfg.unmixing = comp.unmixing;
>
> cfg.topolabel = comp.topolabel;
>
> comp_2 = ft_componentanalysis(cfg, obs180_data);
>
>
>
> %% Reject component
>
> cfg = [];
>
> cfg.component = [];
>
> obs180_data_ica_cleaned = ft_rejectcomponent(cfg, comp_2, obs180_data);
>
>
>
>
> save (strcat(sb,'obs180_ica_cleaned') , 'obs180_data_ica_cleaned')
>
>
>
>
> %% Artifacts final 180
>
>
>
> cfg.method = 'summary';
>
> cfg.latency=[0 1];
>
> cfg.layout = 'GSN128.sfp'; % this allows for plotting
>
> obs180_data_clean3 = ft_rejectvisual(cfg, obs180_data_ica_cleaned);
>
>
> cfg = [];
>
> cfg.viewmode = 'vertical';
>
> cfg.latency=[0 1];
>
> cfg.continuous = 'no';
>
> cfg.plotlabels='yes'
>
> cfg = ft_databrowser(cfg,obs180_data_clean3);
>
> %cfg.artfctdef.reject = 'complete';
>
> obs180_data_clean2 = ft_rejectartifact (cfg,obs180_data_clean3);
>
>
>
> % Save clean data
>
>
> save (strcat(subject,'obs180_clean') , 'obs180_data_clean2')
>
>
>
> %% Rereferencing data
>
> cfg = [];
>
> cfg.channel = 'all';
>
> cfg.preproc.reref = 'yes';
>
> cfg.preproc.refchannel = 'all';
>
> obs180_data_ref= ft_preprocessing(cfg,obs180_data_clean2)
>
>
> save (strcat(subject,'obs180_ref') , 'obs180_data_ref')
>
> %% Snap out smaller pieces (the third second)
>
>
> cfg = []
>
> cfg.toilim = [0 1]
>
>
> obs180_data_small = ft_redefinetrial(cfg,obs180_data_ref)
>
>
> %% TIMELOCK ERP
>
> obs180_data_ERP = ft_timelockanalysis(cfg, obs180_data_small);
>
>
> save (strcat(subject,'obs180_ERP') , 'obs180_data_ERP')
>
>
> %% plot 180 ERP
>
>
> cfg = [];
>
> cfg.layout = lay ;
>
> cfg.interactive = 'yes';
>
> ft_multiplotER(cfg, obs180_data_ERP)
>
>
> %% plot both ERPs
>
>
> cfg = [];
>
> cfg.layout = lay ;
>
> cfg.interactive = 'yes';
>
> cfg.showlabels = 'yes';
>
> ft_multiplotER(cfg, obs90_data_ERP, obs180_data_ERP)
>
>
> %% plot difference wave
>
>
> difference = obs180_data_ERP; % copy one of the
> structures
>
> difference.avg = obs180_data_ERP.avg - obs90_data_ERP.avg; % compute the
> difference ERP
>
>
>
> cfg = [];
>
> cfg.layout = lay;
>
> cfg.interactive = 'yes';
>
> ft_multiplotER(cfg, difference)
>
> 2014-09-07 7:53 GMT+02:00 Joseph Dien <jdien07 at mac.com>:
>
>> Hi,
>> I?m one of the main Fieldtrip contributors working on supporting EGI
>> data. A couple things. First of all, exactly which net do you use? If
>> they are 129-channel, there is still the question of whether they are the
>> Hydrocel or the older geodesic nets. Regardless, that shouldn't cause an
>> error like this. Could you send me the file you are trying to process and
>> the script you are using and I?ll try troubleshooting it.
>>
>> Joe
>>
>>
>> On Aug 26, 2014, at 12:53 AM, Ana Laura Diez Martini <
>> diezmartini at gmail.com> wrote:
>>
>> Which nets do you use? I use EGI. I tried both the ones you mention and
>> they didn't work. It was hard to find that exact one online but it was the
>> only file that actually worked.
>>
>>
>> On Mon, Aug 25, 2014 at 7:52 AM, KatrinH Heimann <katrinheimann at gmail.com>
>> wrote:
>>
>>> Dear Ana, dear all,
>>> the layout you used does not correspond to our nets. I tried the
>>> GSN-HydroCel-128.sfp and the GSN-HydroCel-129.sfp. Both don't work.
>>> Please can anybody help?
>>> Cheers
>>> Katrin
>>>
>>>
>>> 2014-08-24 5:40 GMT+02:00 Ana Laura Diez Martini <diezmartini at gmail.com>:
>>>
>>> Try this one <https://www.dropbox.com/s/58zv658rtdant2c/GSN129.sfp?dl=0>
>>>> I use
>>>>
>>>>
>>>> On Sun, Aug 24, 2014 at 4:08 AM, KatrinH Heimann <
>>>> katrinheimann at gmail.com> wrote:
>>>>
>>>>> Dear all, my problems seem neverending. This time however i really need
>>>>> help.
>>>>> I implemented a pipeline for ERPs. All works now, trialdefinition,
>>>>> preprocessing, channelreplacement, ica, componentrejection, final
>>>>> artifactdetection, timelock of the single subject data. However, when I
>>>>> wanna compute the grandaverage of the single subjects I get the following
>>>>> error message:
>>>>>
>>>>> computing average of avg over 19 subjects
>>>>> Warning: discarding electrode information because it cannot be averaged
>>>>> > In ft_timelockgrandaverage at 249
>>>>> the call to "ft_timelockgrandaverage" took 0 seconds and required the
>>>>> additional allocation of an estimated 3 MB
>>>>> computing average of avg over 2 subjects
>>>>> Warning: discarding electrode information because it cannot be averaged
>>>>> > In ft_timelockgrandaverage at 249
>>>>> the call to "ft_timelockgrandaverage" took 0 seconds and required the
>>>>> additional allocation of an estimated 0 MB
>>>>> the call to "ft_prepare_layout" took 0 seconds and required the
>>>>> additional allocation of an estimated 0 MB
>>>>> the call to "ft_topoplotER" took 0 seconds and required the additional
>>>>> allocation of an estimated 0 MB
>>>>>
>>>>> Furthermore in the plot of the significant clusters, the channelnames
>>>>> are mixed up (do not correspond to my net)
>>>>>
>>>>>
>>>>> I guess that there is a problem with the layout I use.
>>>>> Here the code that I use
>>>>>
>>>>> %For generating the layout (also in the single subjects):
>>>>>
>>>>> cfg = [];
>>>>>
>>>>> cfg.channel = obs_data.label;
>>>>>
>>>>> cfg.layout = 'GSN-HydroCel-129.sfp';
>>>>>
>>>>> cfg.feedback = 'yes';
>>>>>
>>>>> lay = ft_prepare_layout(cfg);
>>>>>
>>>>>
>>>>> cfg_neighb = [];
>>>>>
>>>>> cfg_neighb.feedback = 'yes';
>>>>>
>>>>> cfg_neighb.method = 'triangulation';
>>>>>
>>>>> cfg_neighb.layout = lay;
>>>>>
>>>>> neighbours = ft_prepare_neighbours(cfg_neighb, obs_data);
>>>>>
>>>>>
>>>>> obs_data.elec = ft_read_sens('GSN-HydroCel-129.sfp');
>>>>>
>>>>>
>>>>> %For computing the grand average
>>>>>
>>>>> cfg = [];
>>>>>
>>>>> cfg.channel = 'all';
>>>>>
>>>>> cfg.latency = 'all';
>>>>>
>>>>> cfg.parameter = 'avg';
>>>>>
>>>>> cfg.keepindividual = 'no'
>>>>>
>>>>> GA_90 = ft_timelockgrandaverage(cfg,all90{:});
>>>>>
>>>>> GA_180 = ft_timelockgrandaverage(cfg,all180{:});
>>>>>
>>>>> % "{:}" means to use data from all elements of the variable
>>>>>
>>>>>
>>>>> For plotting the significant clusters
>>>>>
>>>>> cfg = [];
>>>>>
>>>>> cfg.style = 'blank';
>>>>>
>>>>> cfg.layout = lay;
>>>>>
>>>>> cfg.channellabels = 'yes';
>>>>>
>>>>> cfg.highlight = 'labels';
>>>>>
>>>>> cfg.highlightchannel = find(stat.mask);
>>>>>
>>>>> cfg.comment = 'no';
>>>>>
>>>>> figure; ft_topoplotER(cfg, GA_90)
>>>>>
>>>>> title('Nonparametric: significant with cluster multiple comparison
>>>>> correction')
>>>>>
>>>>>
>>>>> Do you have ANY idea to this? I am really completely helpless....
>>>>>
>>>>> thanks and best
>>>>>
>>>>> Katrin
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>
>>
>>
>> --------------------------------------------------------------------------------
>>
>> Joseph Dien, PhD
>> Research Associate
>> Cognitive Neurology
>> The Johns Hopkins University School of Medicine
>>
>> Lab E-mail: jdien1 at jhmi.edu
>> Private E-mail: jdien07 at mac.com
>> Office Phone: 410-614-3115
>> Cell Phone: 202-297-8117
>> Fax: 410-955-0188
>> http://joedien.com
>>
>>
>> _______________________________________________
>> 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/20140908/e8846b61/attachment-0001.html>
>
> ------------------------------
>
> Message: 3
> Date: Mon, 08 Sep 2014 21:55:44 -0400
> From: Joseph Dien <jdien07 at mac.com>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] Problem with Geodesic 129 layout!!
> Message-ID: <148A801A-8CEA-4F88-A7D0-130637BDAC03 at mac.com>
> Content-Type: text/plain; charset="windows-1252"
>
> yes, please do send me the data.
>
> Thanks!
>
> Joe
>
> On Sep 8, 2014, at 3:38 PM, KatrinH Heimann <katrinheimann at gmail.com> wrote:
>
>> Dear Joseph, thanks so much, I really appreciate your help. I was
>> also wandering, if maybe there is another bug in my code.
>> Our nets are 128 channels, Hydrocel, but as a colleague of me
>> adviced me to do so, I also tried the 129 layout.
>> My code you find below (without selection of bad channels etc.)
>> If you need also the data of two subjects to have a look, let me know!!!
>> Best and thanks really!
>> Katrin
>>
>>
>>
>> subject=input('Which subject do you want to analyse? ','s');
>>
>> name = strcat(subject,'.raw');
>>
>> subjectnumber=input('Which is the subjectnumber?', 's');
>>
>> sb=subjectnumber
>>
>> %subjectnumber = strcat(subjectnumber, '.txt')
>>
>> %%
>>
>>
>>
>> cfg = [];
>>
>> cfg.dataset = name;
>>
>> cfg.trialfun = 'ft_trialfun_general'; % this is the default
>>
>> cfg.trialdef.eventtype = 'trigger';
>>
>> cfg.trialdef.eventvalue = 'stim'; % the value of the stimulus trigger
>>
>> cfg.trialdef.prestim = 0.234; % in seconds
>>
>> cfg.trialdef.poststim = 7.266; % in seconds (whole time of video
>> observation, but maybe we need less)
>>
>> cfg = ft_definetrial(cfg);
>>
>>
>>
>> cfg.trl([1:7],:) = [];
>>
>>
>>
>> %change timeline according to constant offset of 16 ms = 8 samples
>> (because recorded with 500 hz)in
>>
>> %structure trial
>>
>> cfg.trl(:,3)=cfg.trl(:,3)-8
>>
>>
>>
>> %change timeline to make the cut the zeropoint
>>
>>
>>
>> cfg.trl(:,3)=cfg.trl(:,3)- 1000;
>>
>>
>>
>>
>>
>> %% preprocess data
>>
>> cfg.channel = 'all';
>>
>> cfg.preproc.detrend = 'yes';
>>
>> cfg.preproc.demean = 'yes';
>>
>> cfg.preproc.baselinewindow = [-2.1 -2.0]
>>
>> %cfg.preproc.bpfilter = 'yes'; - the data here has to be already filtered
>>
>> %(0.1-45) and bad channels have to be replaced!!!!
>>
>> %cfg.preproc.bpfreq = [6 32];
>>
>> %
>>
>> %
>>
>> obs_data = ft_preprocessing(cfg);
>>
>> %
>>
>> save (strcat(sb,'obs_data') , 'obs_data')
>>
>>
>>
>> %% determining channel neighbours (necessary for Artifact detection)
>>
>> cfg = [];
>>
>> cfg.channel = obs_data.label;
>>
>> cfg.layout = 'GSN128.sfp';
>>
>> cfg.feedback = 'yes';
>>
>> lay = ft_prepare_layout(cfg);
>>
>>
>> cfg_neighb = [];
>>
>> cfg_neighb.feedback = 'yes';
>>
>>
>>
>> cfg_neighb.method = 'triangulation';
>>
>> cfg_neighb.layout = 'GSN128.sfp';
>>
>> neighbours = ft_prepare_neighbours(cfg_neighb, obs_data);
>>
>>
>>
>> obs_data.elec = ft_read_sens('GSN128.sfp');
>>
>>
>>
>> %% Artifacts - to detect bad channels - is not saved!!!
>>
>>
>>
>>
>>
>> cfg.method = 'summary';
>>
>> cfg.latency=[0 1];
>>
>> cfg.layout = 'GSN128.sfp'; % this allows for plotting
>>
>> obs_data_try = ft_rejectvisual(cfg, obs_data);
>>
>>
>>
>> cfg = [];
>>
>> cfg.viewmode = 'vertical';
>>
>> cfg.latency=[0 1];
>>
>> cfg.continuous = 'no';
>>
>> cfg.plotlabels='yes'
>>
>> cfg = ft_databrowser(cfg,obs_data);
>>
>> %cfg.artfctdef.reject = 'complete';
>>
>> obs_data_try = ft_rejectartifact (cfg,obs_data);
>>
>>
>>
>>
>>
>> %% Preparing neighbours for channel repair - but bad channel info in!!!
>>
>>
>>
>> % cfg_neighb = [];
>>
>> % cfg_neighb.feedback = 'yes';
>>
>> % cfg_neighb.method = 'triangulation';
>>
>> % cfg_neighb.layout = 'GSN-HydroCel-128.sfp';
>>
>> % neighbours = ft_prepare_neighbours(cfg_neighb, obs_data);
>>
>>
>>
>> % Interpolate and put into new data structure
>>
>> cfg = [];
>>
>> cfg.badchannel = {};
>>
>> cfg.layout = 'GSN128.sfp';
>>
>> cfg.method = 'nearest';
>>
>> cfg.neighbours = neighbours;
>>
>> obs_data_channelrepaired = ft_channelrepair(cfg,obs_data)
>>
>>
>>
>> % Check reconstruction
>>
>> cfg = [];
>>
>> cfg.viewmode = 'vertical';
>>
>> cfg.continuous = 'no';
>>
>> cfg.plotlabels='yes'
>>
>> cfg = ft_databrowser(cfg,obs_data_channelrepaired);
>>
>> %cfg.artfctdef.reject = 'complete';
>>
>> obs_data_clean1 = ft_rejectartifact (cfg,obs_data_channelrepaired);
>>
>>
>>
>> % dat1=obs_data;
>>
>> % dat2=obs_data_channelrepaired;
>>
>> %
>>
>> % x=dat1.trial{1}(62,:); % 68 is channel index of E68
>>
>> % y=dat2.trial{1}(62,:);
>>
>> % plot(x);hold on;plot(y,'r');
>>
>> %
>>
>> % x=dat1.trial{1}(72,:);
>>
>> % y=dat2.trial{1}(75,:);
>>
>> % figure;
>>
>> % plot(x);hold on;plot(y,'r')
>>
>> %
>>
>> % x=dat1.trial{1}(75,:);
>>
>> % y=dat2.trial{1}(75,:);
>>
>> % figure;
>>
>> % plot(x);hold on;plot(y,'r')
>>
>> %% artifact rejection/trial inspection - throw out electrode jumps etc.
>>
>>
>>
>>
>>
>> cfg = [];
>>
>> cfg.viewmode = 'vertical';
>>
>> cfg.continuous = 'no';
>>
>> cfg.plotlabels='yes'
>>
>> cfg = ft_databrowser(cfg,obs_data_channelrepaired);
>>
>> %cfg.artfctdef.reject = 'complete';
>>
>> obs_data_clean1 = ft_rejectartifact (cfg,obs_data_channelrepaired);
>>
>>
>>
>> %% ICA - Anzahl der Komponenten anpassen!- adapt numcomponent
>> according to channels interpolated %% 128-number of interp. channels)
>>
>>
>> cfg = [];
>>
>> cfg.channel = {'all'};
>>
>> cfg.numcomponent = 128
>>
>> comp = ft_componentanalysis(cfg,obs_data_clean1);
>>
>> save (strcat(sb,'comp_all') , 'comp')
>>
>>
>>
>> %%
>>
>> cfg = [];
>>
>> cfg.viewmode = 'component';
>>
>> cfg.continuous = 'no';
>>
>> cfg.plotlabels='some';
>>
>> cfg.layout = 'GSN128.sfp';
>>
>> ft_databrowser(cfg,comp);
>>
>>
>>
>> %% poweranalysis components
>>
>> cfg = [];
>>
>> cfg.output = 'pow';
>>
>> cfg.channel = 'all';%compute the power spectrum in all ICs
>>
>> cfg.method = 'mtmfft';
>>
>> cfg.taper = 'hanning';
>>
>> cfg.foi = 0:0.2:50;
>>
>> obs_freq = ft_freqanalysis(cfg, comp);
>>
>>
>>
>> %And you can plot the spectra:
>>
>>
>>
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>
>> nsubplots = 16;
>>
>> nbyn = sqrt(nsubplots);% sqrt(nsubplots) should not contain
>> decimals, type doc subplot
>>
>>
>>
>> Nfigs = ceil(size(comp.topo,1)/nsubplots);
>>
>> tot = Nfigs*nsubplots;
>>
>>
>>
>> rptvect = 1:size(comp.topo,1);
>>
>> rptvect = padarray(rptvect, [0 tot-size(comp.topo,1)], 0,'post');
>>
>> rptvect = reshape(rptvect,nsubplots,Nfigs)';
>>
>>
>>
>> for r=1:size(rptvect,1);
>>
>> figure;set(gcf,'units','normalized','outerposition',[0 0 1
>> 1]);%full screen
>>
>> k=0;
>>
>> for j=1:size(rptvect,2);
>>
>> if~(rptvect(r,j)==0);
>>
>> k=k+1;
>>
>> cfg=[];
>>
>> cfg.channel = rptvect(r,j);
>>
>> cfg.ylim =[0 500]
>>
>> cfg.xlim =[0 50]
>>
>> subplot(nbyn,nbyn,k);ft_singleplotER(cfg,obs_freq);
>>
>> end
>>
>> end
>>
>> end
>>
>>
>>
>> %For the IC topos you'll follow the same logic as above but with:
>>
>>
>>
>> figure
>>
>> cfg = [];
>>
>> cfg.component = [1:20]; % specify the component(s) that
>> should be plotted
>>
>> cfg.layout = 'GSN128.sfp';
>>
>> cfg.comment = 'no';
>>
>> ft_topoplotIC(cfg, comp)
>>
>>
>>
>> figure
>>
>> cfg = [];
>>
>> cfg.component = [21:40]; % specify the component(s) that
>> should be plotted
>>
>> cfg.layout = 'GSN128.sfp';
>>
>> cfg.comment = 'no';
>>
>> ft_topoplotIC(cfg, comp)
>>
>>
>>
>> figure
>>
>> cfg = [];
>>
>> cfg.component = [41:60]; % specify the component(s) that
>> should be plotted
>>
>> cfg.layout = 'GSN128.sfp';
>>
>> cfg.comment = 'no';
>>
>> ft_topoplotIC(cfg, comp)
>>
>>
>>
>> figure
>>
>> cfg = [];
>>
>> cfg.component = [61:80]; % specify the component(s) that
>> should be plotted
>>
>> cfg.layout = 'GSN128.sfp';
>>
>> cfg.comment = 'no';
>>
>> ft_topoplotIC(cfg, comp)
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> %% Seperate observation conditions
>>
>>
>>
>> name1= strcat(num2str(sb),'_90.xls');
>>
>> list1=xlsread (name1)
>>
>>
>>
>> name2= strcat(num2str(sb),'_180.xls');
>>
>> list2=xlsread (name2)
>>
>>
>> %
>>
>>
>>
>> cfg = []
>>
>> cfg.trials = [list1]
>>
>> obs90_data = ft_redefinetrial(cfg,obs_data_channelrepaired)
>>
>>
>>
>> cfg = []
>>
>> cfg.trials = [list2]
>>
>> obs180_data = ft_redefinetrial(cfg,obs_data_channelrepaired)
>>
>>
>>
>> %%PIPELINE FOR obs90
>>
>>
>>
>> %% Decompose original data according to the components found before
>>
>> load (strcat(sb,'comp_all'))
>>
>>
>>
>> cfg = [];
>>
>> cfg.numcomponent = 128;
>>
>> cfg.unmixing = comp.unmixing;
>>
>> cfg.topolabel = comp.topolabel;
>>
>>
>>
>> comp_1 = ft_componentanalysis(cfg, obs90_data);
>>
>>
>>
>>
>>
>> %% Reject component
>>
>> cfg = [];
>>
>> cfg.component = [];
>>
>> obs90_data_ica_cleaned = ft_rejectcomponent(cfg, comp_1, obs90_data);
>>
>>
>>
>>
>> save (strcat(sb,'obs90_ica_cleaned') , 'obs90_data_ica_cleaned')
>>
>>
>>
>>
>>
>>
>>
>> %% Artifacts - final detection
>>
>>
>>
>>
>>
>> cfg.method = 'summary';
>>
>> cfg.latency=[0 1];
>>
>> cfg.layout = 'GSN128.sfp'; % this allows for plotting
>>
>> obs90_data_clean3 = ft_rejectvisual(cfg, obs90_data_ica_cleaned);
>>
>>
>>
>> cfg = [];
>>
>> cfg.viewmode = 'vertical';
>>
>> cfg.latency=[0 1];
>>
>> cfg.continuous = 'no';
>>
>> cfg.plotlabels='yes'
>>
>> cfg = ft_databrowser(cfg,obs90_data_clean3);
>>
>> %cfg.artfctdef.reject = 'complete';
>>
>> obs90_data_clean2 = ft_rejectartifact (cfg,obs90_data_clean3);
>>
>>
>>
>>
>>
>> % Save clean data
>>
>>
>>
>> save (strcat(subject,'obs90_clean') , 'obs90_data_clean2')
>>
>>
>>
>>
>>
>> %% Rereferencing data
>>
>> cfg = [];
>>
>>
>>
>> cfg.channel = 'all';
>>
>> cfg.preproc.reref = 'yes';
>>
>> cfg.preproc.refchannel = 'all';
>>
>> obs90_data_ref= ft_preprocessing(cfg,obs90_data_clean2)
>>
>>
>>
>> save (strcat(subject,'obs90_ref') , 'obs90_data_ref')
>>
>> %% Snap out smaller pieces (the third second)
>>
>>
>>
>> cfg = []
>>
>> cfg.toilim = [0 1]
>>
>>
>>
>> obs90_data_small = ft_redefinetrial(cfg,obs90_data_ref)
>>
>>
>>
>> %% TIMELOCK ERP
>>
>> obs90_data_ERP = ft_timelockanalysis(cfg, obs90_data_small);
>>
>>
>>
>> save (strcat(subject,'obs90_ERP') , 'obs90_data_ERP')
>>
>>
>>
>> %% plot it
>>
>> cfg = [];
>>
>> cfg.layout = lay ;
>>
>> cfg.interactive = 'yes';
>>
>> ft_multiplotER(cfg, obs90_data_ERP)
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> %% PIPELINE FOR obs180
>>
>>
>>
>>
>>
>> %% Decompose original data according to the components found before
>>
>> load (strcat(sb,'comp_all'))
>>
>>
>>
>> cfg = [];
>>
>> cfg.numcomponent = 128
>>
>> cfg.unmixing = comp.unmixing;
>>
>> cfg.topolabel = comp.topolabel;
>>
>> comp_2 = ft_componentanalysis(cfg, obs180_data);
>>
>>
>>
>>
>>
>> %% Reject component
>>
>> cfg = [];
>>
>> cfg.component = [];
>>
>> obs180_data_ica_cleaned = ft_rejectcomponent(cfg, comp_2, obs180_data);
>>
>>
>>
>>
>> save (strcat(sb,'obs180_ica_cleaned') , 'obs180_data_ica_cleaned')
>>
>>
>>
>>
>>
>>
>>
>> %% Artifacts final 180
>>
>>
>>
>>
>>
>> cfg.method = 'summary';
>>
>> cfg.latency=[0 1];
>>
>> cfg.layout = 'GSN128.sfp'; % this allows for plotting
>>
>> obs180_data_clean3 = ft_rejectvisual(cfg, obs180_data_ica_cleaned);
>>
>>
>>
>> cfg = [];
>>
>> cfg.viewmode = 'vertical';
>>
>> cfg.latency=[0 1];
>>
>> cfg.continuous = 'no';
>>
>> cfg.plotlabels='yes'
>>
>> cfg = ft_databrowser(cfg,obs180_data_clean3);
>>
>> %cfg.artfctdef.reject = 'complete';
>>
>> obs180_data_clean2 = ft_rejectartifact (cfg,obs180_data_clean3);
>>
>>
>>
>>
>>
>> % Save clean data
>>
>>
>>
>> save (strcat(subject,'obs180_clean') , 'obs180_data_clean2')
>>
>>
>>
>>
>>
>> %% Rereferencing data
>>
>> cfg = [];
>>
>> cfg.channel = 'all';
>>
>> cfg.preproc.reref = 'yes';
>>
>> cfg.preproc.refchannel = 'all';
>>
>> obs180_data_ref= ft_preprocessing(cfg,obs180_data_clean2)
>>
>>
>>
>> save (strcat(subject,'obs180_ref') , 'obs180_data_ref')
>>
>> %% Snap out smaller pieces (the third second)
>>
>>
>>
>> cfg = []
>>
>> cfg.toilim = [0 1]
>>
>>
>>
>> obs180_data_small = ft_redefinetrial(cfg,obs180_data_ref)
>>
>>
>>
>> %% TIMELOCK ERP
>>
>> obs180_data_ERP = ft_timelockanalysis(cfg, obs180_data_small);
>>
>>
>>
>> save (strcat(subject,'obs180_ERP') , 'obs180_data_ERP')
>>
>>
>>
>> %% plot 180 ERP
>>
>>
>>
>> cfg = [];
>>
>> cfg.layout = lay ;
>>
>> cfg.interactive = 'yes';
>>
>> ft_multiplotER(cfg, obs180_data_ERP)
>>
>>
>>
>> %% plot both ERPs
>>
>>
>>
>> cfg = [];
>>
>> cfg.layout = lay ;
>>
>> cfg.interactive = 'yes';
>>
>> cfg.showlabels = 'yes';
>>
>> ft_multiplotER(cfg, obs90_data_ERP, obs180_data_ERP)
>>
>>
>>
>> %% plot difference wave
>>
>>
>>
>> difference = obs180_data_ERP; % copy one of
>> the structures
>>
>> difference.avg = obs180_data_ERP.avg - obs90_data_ERP.avg; %
>> compute the difference ERP
>>
>>
>> cfg = [];
>>
>> cfg.layout = lay;
>>
>> cfg.interactive = 'yes';
>>
>> ft_multiplotER(cfg, difference)
>>
>>
>> 2014-09-07 7:53 GMT+02:00 Joseph Dien <jdien07 at mac.com>:
>> Hi,
>> I?m one of the main Fieldtrip contributors working on supporting
>> EGI data. A couple things. First of all, exactly which net do
>> you use? If they are 129-channel, there is still the question of
>> whether they are the Hydrocel or the older geodesic nets.
>> Regardless, that shouldn't cause an error like this. Could you
>> send me the file you are trying to process and the script you are
>> using and I?ll try troubleshooting it.
>>
>> Joe
>>
>>
>> On Aug 26, 2014, at 12:53 AM, Ana Laura Diez Martini
>> <diezmartini at gmail.com> wrote:
>>
>>> Which nets do you use? I use EGI. I tried both the ones you
>>> mention and they didn't work. It was hard to find that exact one
>>> online but it was the only file that actually worked.
>>>
>>>
>>> On Mon, Aug 25, 2014 at 7:52 AM, KatrinH Heimann
>>> <katrinheimann at gmail.com> wrote:
>>> Dear Ana, dear all,
>>> the layout you used does not correspond to our nets. I tried the
>>> GSN-HydroCel-128.sfp and the GSN-HydroCel-129.sfp. Both don't
>>> work. Please can anybody help?
>>> Cheers
>>> Katrin
>>>
>>>
>>> 2014-08-24 5:40 GMT+02:00 Ana Laura Diez Martini <diezmartini at gmail.com>:
>>>
>>> Try this one I use
>>>
>>>
>>> On Sun, Aug 24, 2014 at 4:08 AM, KatrinH Heimann
>>> <katrinheimann at gmail.com> wrote:
>>> Dear all, my problems seem neverending. This time however i really
>>> need help.
>>> I implemented a pipeline for ERPs. All works now, trialdefinition,
>>> preprocessing, channelreplacement, ica, componentrejection, final
>>> artifactdetection, timelock of the single subject data. However,
>>> when I wanna compute the grandaverage of the single subjects I get
>>> the following error message:
>>>
>>> computing average of avg over 19 subjects
>>> Warning: discarding electrode information because it cannot be averaged
>>> > In ft_timelockgrandaverage at 249
>>> the call to "ft_timelockgrandaverage" took 0 seconds and required
>>> the additional allocation of an estimated 3 MB
>>> computing average of avg over 2 subjects
>>> Warning: discarding electrode information because it cannot be averaged
>>> > In ft_timelockgrandaverage at 249
>>> the call to "ft_timelockgrandaverage" took 0 seconds and required
>>> the additional allocation of an estimated 0 MB
>>> the call to "ft_prepare_layout" took 0 seconds and required the
>>> additional allocation of an estimated 0 MB
>>> the call to "ft_topoplotER" took 0 seconds and required the
>>> additional allocation of an estimated 0 MB
>>>
>>> Furthermore in the plot of the significant clusters, the
>>> channelnames are mixed up (do not correspond to my net)
>>>
>>>
>>> I guess that there is a problem with the layout I use.
>>> Here the code that I use
>>>
>>> %For generating the layout (also in the single subjects):
>>> cfg = [];
>>>
>>> cfg.channel = obs_data.label;
>>>
>>> cfg.layout = 'GSN-HydroCel-129.sfp';
>>>
>>> cfg.feedback = 'yes';
>>>
>>> lay = ft_prepare_layout(cfg);
>>>
>>>
>>> cfg_neighb = [];
>>>
>>> cfg_neighb.feedback = 'yes';
>>>
>>> cfg_neighb.method = 'triangulation';
>>>
>>> cfg_neighb.layout = lay;
>>>
>>> neighbours = ft_prepare_neighbours(cfg_neighb, obs_data);
>>>
>>>
>>> obs_data.elec = ft_read_sens('GSN-HydroCel-129.sfp');
>>>
>>>
>>>
>>> %For computing the grand average
>>>
>>> cfg = [];
>>>
>>> cfg.channel = 'all';
>>>
>>> cfg.latency = 'all';
>>>
>>> cfg.parameter = 'avg';
>>>
>>> cfg.keepindividual = 'no'
>>>
>>> GA_90 = ft_timelockgrandaverage(cfg,all90{:});
>>>
>>> GA_180 = ft_timelockgrandaverage(cfg,all180{:});
>>>
>>> % "{:}" means to use data from all elements of the variable
>>>
>>>
>>> For plotting the significant clusters
>>>
>>> cfg = [];
>>>
>>> cfg.style = 'blank';
>>>
>>> cfg.layout = lay;
>>>
>>> cfg.channellabels = 'yes';
>>>
>>> cfg.highlight = 'labels';
>>>
>>> cfg.highlightchannel = find(stat.mask);
>>>
>>> cfg.comment = 'no';
>>>
>>> figure; ft_topoplotER(cfg, GA_90)
>>>
>>> title('Nonparametric: significant with cluster multiple comparison
>>> correction')
>>>
>>>
>>>
>>> Do you have ANY idea to this? I am really completely helpless....
>>>
>>> thanks and best
>>>
>>> Katrin
>>>
>>>
>>> _______________________________________________
>>> 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
>>
>> --------------------------------------------------------------------------------
>>
>> Joseph Dien, PhD
>> Research Associate
>> Cognitive Neurology
>> The Johns Hopkins University School of Medicine
>>
>> Lab E-mail: jdien1 at jhmi.edu
>> Private E-mail: jdien07 at mac.com
>> Office Phone: 410-614-3115
>> Cell Phone: 202-297-8117
>> Fax: 410-955-0188
>> http://joedien.com
>>
>>
>> _______________________________________________
>> 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
>
> --------------------------------------------------------------------------------
>
> Joseph Dien, PhD
> Research Associate
> Cognitive Neurology
> The Johns Hopkins University School of Medicine
>
> Lab E-mail: jdien1 at jhmi.edu
> Private E-mail: jdien07 at mac.com
> Office Phone: 410-614-3115
> Cell Phone: 202-297-8117
> Fax: 410-955-0188
> http://joedien.com
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140908/81922ad2/attachment-0001.html>
>
> ------------------------------
>
> Message: 4
> Date: Tue, 9 Sep 2014 06:37:13 +0000
> From: "Caspar, Emilie" <e.caspar at ucl.ac.uk>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] ft_rejectvisual: removing trials marked as
> bad
> Message-ID: <3C365782-4B07-4EFE-A921-99489BDD5DA6 at live.ucl.ac.uk>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi Ashley,
>
> Maybe the mistake is you did not integrate in your script the
> command to save the rejection. Normally, with the following command,
> you will see in the Matlab Window that artifacts are correctly
> rejected after the "quit" button.
>
> clean_data = ft_rejectvisual(cfg, interpoldata);
> cfg.artfctdef.reject = 'complete';
> cfg.artfctdef.feedback = 'yes';
> cleandata = ft_rejectartifact(cfg,clean_data);
>
> Emilie
>
>
>
>
>
> Le 3 sept. 2014 ? 11:58, Ashley Greene
> <agreene24 at gmail.com<mailto:agreene24 at gmail.com>> a ?crit :
>
> Hello,
>
> I have used the rejectvisual function in attempt to remove bad
> trials, but after marking them and pressing the quit button,
> although the command window states that the selected trials have
> been removed, there is no obvious change in the data; all of the
> trials are still intact. Have I overlooked something?
>
> Thanks,
>
> Ashley
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl<mailto: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/20140909/4c2d0985/attachment-0001.html>
>
> ------------------------------
>
> Message: 5
> Date: Tue, 09 Sep 2014 14:16:20 +0200
> From: Patricia Wollstadt <Patricia.Wollstadt at gmx.de>
> To: fieldtrip at science.ru.nl
> Subject: Re: [FieldTrip] TRENTOOL pipeline help
> Message-ID: <540EEF94.9080601 at gmx.de>
> Content-Type: text/plain; charset="windows-1252"
>
> Hello Max,
>
> I added a few comments to the questions regarding individual parameters
> below. To address the general problem of TRENTOOL telling you, that
> there are not enough sample points in your data: From what I can see in
> your script, you probably don't have enough data points in each time
> series to robustly estimate TE. You analyze 800 ms of data sampled at
> 300 Hz, which gives you 240 samples per time series. Can you maybe avoid
> downsampling to 300 Hz and downsample to 600 Hz instead? Or could you
> analyze a longer time window of interest?
> Note that you also 'lose' data to embedding and the interaction delay:
> The first point that can be used for TE estimation is at max. embedding
> length + max. interaction delay in samples. For example: max. embedding
> length = dim * tau_factor * ACT = 10 * 0.4 * 5 = 20 samples plus the max
> interaction delay of 30 ms = 9 samples. In this example, you would be
> left with 240 - 29 samples for TE estimation per trial. There is also
> the possibility to estimate time resolved TE/TE for shorter time windows
> of interest (see section 4.4 in the manual); however, this method
> requires the use of a GPU for TE estimation.
>
> I would further recommend to use the new pipeline for group statistics
> described in the manual in section 4.5 (the function 'TEgroup_calculate'
> is deprecated). The new pipeline allows you to reconstruct the
> interaction delay and uses the following functions (see also comments in
> the script):
>
> TEgroup_prepare -> prepares all data sets (all subjects/all
> conditions) for group analysis (this means finding common embedding
> parameters such that estimates are not biased between groups)
> InteractionDelayReconstruction_calculate -> estimates TE for
> individual data sets and all assumed interaction delays u
> InteractionDelayReconstruction_analyze -> reconstructs the
> interaction delay by selecting the u that maximizes TE for each channel
> TEgroup_stats -> calculate group statistics using a permutation test
>
> I can send you an example script for group TE analysis using this
> pipeline to get you started. I hope this helps you to get the group
> analysis running. Just write again if you're having trouble setting up
> the pipeline or something is not clear about the parameters/my comments.
>
> Best,
> Patricia
>
>
>
>
> On 09/04/2014 08:30 PM, Max Cantor wrote:
>> Hi fieldtrippers,
>>
>> I know trentool is not produced by the Donders Institute, so I'm not
>> 100% sure if it is appropriate to ask questions about it here, but to
>> the best of my knowledge they do not have a mailing list and I saw a
>> few trentool questions in the archives, so I'm going to assume it's ok...
>>
>> In any case, below is my current pipeline (slightly modified for
>> comprehensibility):
>>
>> (notes in bold are comments/questions made in this email, not present
>> in the pipeline. Sorry in advance for the long post! Any help would be
>> greatly appreciated as I'm a bit over my head on this but I think I'm
>> close!)
>>
>> *****
>>
>> % Prepare group TE data
>>
>> cfgP = [];
>> cfgP.Path2TSTOOL = *TSTOOLPATH*
>> cfgP.TEcalctype = 'VW_ds';
>> cfgP.channel = {'ctfdip_LAC' 'ctfdip_RAC'};
>>
>> *I'm trying to find the transfer entropy between the left and right
>> auditory cortices in my experiment. The input is virtual sensor data
>> that was produced using SAM in fieldtrip on real MEG data. *
>>
>> % specify u to be scanned
>>
>> cfgP.predicttime_u = 30;
>> cfgP.toi = [-0.4 0.4];
>>
>> *For clarification, the predicttime_u is in seconds but the toi is in
>> milliseconds. If I understand correctly, the predicttime_u must fit
>> within the toi, but beyond that are there any benefits to it being
>> earlier or later?* PW: The predictiontime_u is in milliseconds and the
>> toi is in seconds. The prediction time is the assumed interaction
>> delay between your two sources and should fit within your toi. In
>> general it is preferable to use the method for interaction delay
>> reconstruction for TE estimation, because it allows you to reconstruct
>> the actual delay between your source and target times series. A
>> non-optimal u/interaction delay may cause an underestimation of TE, so
>> it is recommended to use the pipeline for interaction delay
>> reconstruction whenever estimating TE for unknown delays.
>> If you use the methods for interaction delay reconstruction
>> 'predicttime_u' is replaced by
>> cfgTEP.predicttimemin_u % minimum u to be scanned
>> cfgTEP.predicttimemax_u % maximum u to be scanned
>> cfgTEP.predicttimestepsize % time steps between u to be scanned
>> A large range for u values to be scanned increases computing time a
>> lot, so it is best to limit the u range to values that are
>> physiologically plausible.
>>
>> % ACT (Autocorrelation Time) estimation and constraints
>>
>> cfgP.maxlag = 150;
>> cfgP.actthrvalue = 7.5;
>> cfgP.minnrtrials = 5;
>>
>> *My understanding is maxlag should be 1/2 the sampling rate, so since
>> the data are downsampled to 300hz, it should be 150. I know that the
>> sample rate and filters are used to determine the actthrvalue, but I
>> don't actually know the calculation. 7.5 was a rough guess just to
>> test the pipeline. I'm also uncertain of what minnrtrials should be.*
>> PW: You can set the actthrvalue based on the filtering you did prior
>> to TE analysis. If you for example highpass filtered at 10 Hz, you
>> shouldn't find an ACT higher than 30 samples, because you filtered out
>> any components of the signal slower than 10 Hz/30 samples (given your
>> sampling frequency of 300 Hz). So in this scenario the actthrvalue
>> would be 30.
>> A good value for cfgP.minnrtrials is 12 (a minimum number of trials is
>> needed to realize the permutation test for estimated TE values).
>>
>> % Optimization
>>
>> cfgP.optimizemethod = 'ragwitz';
>> cfgP.ragdim = 4:8;
>> cfgP.ragtaurange = [0.2 0.4];
>> cfgP.ragtausteps = 15;
>> cfgP.repPred = 100;
>> *
>> *
>> *I am completely at a loss for this. I've done some reading into
>> transfer entropy, mutual information, etc., cited in trentool, but I'm
>> yet to understand how exactly this optimization works and what the
>> configuration should be, given my data and experimental intentions.*
>> PW: The Ragwitz criterion tries to find optimal embedding parameters
>> dim and tau for the data. To do that, the method iteratively takes all
>> possible combinations of dim and tau values that are provided in
>> cfgP.ragdim and cfgP.ragtaurange/.ragtausteps and tests how well these
>> combinations embed the data. To test an embedding, the method builds
>> the embedding vectors from the data; it then tests for each point how
>> well the next point in time can be predicted from the reference
>> point's nearest neighbours. So for each embedded point, the method
>> searches for the nearest neighbours and calculates the average of
>> those nearest neighbours. The difference between the
>> averaged/predicted point and the actual next point is the error of the
>> local predictor. The Ragwitz criterion will then return the parameter
>> combination for which this error over all points is minimal.
>> The parameters set the following: 'ragdim' are dimensions to be tested
>> by the method (I would reccomend to start with 2:10), 'ragtaurange'
>> together with 'ragtausteps' specifies the tau values to be tested
>> (TRENTOOL will build a vector from 0.2 to 0.4 in 15 steps). Note, that
>> the values here are factors that are later multiplied with the ACT to
>> obtain the actual tau. 'repPred' is the number of points that will be
>> used for the local prediction, i.e. the Ragwitz criterion will test
>> the local prediction and calculate the error for the first 100 points
>> in your time series. The two parameters 'flagNei' ans 'sizeNei' below
>> specify the type of neighbour search conducted by the Ragwitz
>> criterion: 'flagNei' tells the method to either conduct a kNN or range
>> search; 'sizeNei' specifies the number of neighbours or the radius to
>> be searched by a range search.
>>
>>
>> % Kernel-based TE estimation
>>
>> cfgP.flagNei = 'Mass';
>> cfgP.sizeNei = 4; % Default
>>
>> cfgP.ensemblemethod = 'no';
>> cfgP.outputpath = *OUTPUT PATH*;
>>
>> if ~exist(*Path for TEprepare data object*)
>> load VSdat;
>> TE_Wrd = {};
>> for i = 1:nConds
>> for j = 1:Nsub
>> TE_Wrd{i}{j} = TEprepare(cfgP, VSdat{i}{j});
>> end
>> end
>> clear VSdat;
>> save('TE_Wrd', 'TE_Wrd');
>> end
>> *
>> *
>> *The configuration and virtual sensor data, organized in a 3 x 15 cell
>> of structures (condition by subject) are the input. The TEprepare
>> substructure is added to each individual condition x subject .mat
>> files' data structure which are stored on disk independently.*
>>
>> % Use object_to_mat_conversion.m to replace individual condition x
>> subject virtual sensor data
>> % .mat files with their TE_Wrd equivalent
>> *
>> *
>> *I'm using a separate script to make some manipulations to the objects
>> from disk; this will all eventually be integrated into the main
>> pipeline*.*TRENTOOL seems to handle data output very differently from
>> fieldtrip and I've had trouble thinking through the most logical way
>> to handle the data so it's a bit haphazard right now.*
>>
>> load cond080sub01.mat
>>
>> cfgG = [];
>> cfgG.dim = cond080sub01.TEprepare.optdim;
>> cfgG.tau = cond080sub01.TEprepare.opttau;
>>
>> if isfield(cond080sub01, 'TEprepare')
>> TEgroup_prepare(cfgG, fileCell);
>> else
>> error('Need to run TEprepare before TEgroup_prepare');
>> end
>> *
>> *
>> *For clarification, fileCell is a cell with the name of each condition
>> x subject .mat file, which as I said before is collectively the same
>> as the 3 x 15 VSdat structure (condition x subject).*
>>
>> % Replace .mat files with '_for_TEgroup_calculate' version in
>> % object_to_mat_conversion.m
>>
>> % TE Group Calculate
>>
>> load cond080sub01.mat
>> if isfield(cond080sub01, 'TEgroupprepare')
>> for i = 1:length(fileCell)
>> TEgroup_calculate(fileCell{i});
>> end
>> else
>> error('Need to run TEgroup_prepare before TEgroup_calculate');
>> end
>> *
>> *
>> *At this step I get the following error:
>>
>> Error using transferentropy (line 337)
>> \nTRENTOOL ERROR: not enough data points left after embedding
>>
>> Error in TEgroup_calculate (line 133)
>> [TEresult] = transferentropy(cfg,data);*
>>
>> % TE Group Stats
>>
>> cfgGSTAT = [];
>> cfgGSTAT.design(1,1:2*Nsub) = [ones(1,Nsub) 2*ones(1,Nsub)];
>> cfgGSTAT.design(2,1:2*Nsub) = [1:Nsub 1:Nsub];
>>
>> cfgGSTAT.uvar = 1;
>> cfgGSTAT.ivar = 2;
>> cfgGSTAT.fileidout = 'test_groupstats';
>>
>> TEgroup_stats(cfgGSTAT, fileCell);
>>
>> *Given the error above, I am yet to get to this step, but it does not
>> seem fundamentally different from normal fieldtrip stats.*
>>
>> *****
>>
>> In case my notes were not clear or you skipped to the bottom, *my
>> primary concern is whether the error I'm getting in TEgroup_calculate
>> is a pipeline issue* (I noticed the example pipeline in trentool, the
>> manual, and published methods articles all seem to have slightly or
>> significantly different pipeline compositions), *or if the error is*
>> due to ACT, ragwitz optimization, or some other faulty
>> parameterization *on my part due to a lack of understanding of how
>> transfer entropy works on a more theoretical/mathematical level*. If
>> the latter is the case, is there any relatively straightforward way to
>> conceptualize this, or is this something where I'm just going to have
>> to keep reading and rereading until it eventually makes sense? I've
>> already done quite a bit of that and it hasn't pierced my thick skull
>> yet but I'm sure it will eventually!
>>
>> Thank you so much,
>>
>> Max Cantor
>>
>>
>> --
>> Max Cantor
>> Lab Manager
>> Computational Neurolinguistics Lab
>> University of Michigan
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
> --
> ------------------------------------------------------------
>
> Patricia Wollstadt, PhD Student
>
> MEG Unit, Brain Imaging Center
>
> Goethe University, Frankfurt, Germany
>
> Heinrich Hoffmann Strasse 10, Haus 93 B
>
> D - 60528 Frankfurt am Main
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140909/ce6b297f/attachment-0001.html>
>
> ------------------------------
>
> Message: 6
> Date: Tue, 9 Sep 2014 15:21:20 +0200
> From: Holger Krause <Holger.Krause at med.uni-duesseldorf.de>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl>
> Subject: [FieldTrip] Latest FT version on ftp-server is from three
> days ago
> Message-ID: <201409091521.22589.Holger.Krause at med.uni-duesseldorf.de>
> Content-Type: text/plain; charset="us-ascii"
>
> Dear developers,
>
> Could you please check the process for creation/publication of zip-files on
> the FTP server? The latest file I can find there is fieldtrip-20140906.zip.
>
> Thanks in advance,
>
> Holger
>
>
> ------------------------------
>
> Message: 7
> Date: Tue, 9 Sep 2014 09:19:55 -0400
> From: Max Cantor <mcantor at umich.edu>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] TRENTOOL pipeline help
> Message-ID:
> <CAFTjRaUXzwca7rR3sm8iPLLyUxqHO9kkm++=zAU4LUW=r7NRBw at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> This is immensely helpful, thank you. I was very confused about why some
> versions of the pipeline I saw were using group calculate and others were
> using interaction delay reconstruction and what that meant, and I think I
> have a more clear idea of what the different steps of the pipeline are
> doing. There are still a few things I'm a bit confused about though in
> terms of the pipeline. For instance, whether or not I need to do TEprepare
> before group prepare, and if I need to do graph analysis (which I'm not
> sure I fully understand but also haven't looked deeply into) before group
> stats.
>
> If you don't mind me taking you up on your offer, I think seeing your
> example script might help clarify some of these issues.
>
> Thank you!
>
> On Tue, Sep 9, 2014 at 8:16 AM, Patricia Wollstadt <
> Patricia.Wollstadt at gmx.de> wrote:
>
>> Hello Max,
>>
>> I added a few comments to the questions regarding individual parameters
>> below. To address the general problem of TRENTOOL telling you, that there
>> are not enough sample points in your data: From what I can see in your
>> script, you probably don't have enough data points in each time series to
>> robustly estimate TE. You analyze 800 ms of data sampled at 300 Hz, which
>> gives you 240 samples per time series. Can you maybe avoid downsampling to
>> 300 Hz and downsample to 600 Hz instead? Or could you analyze a longer time
>> window of interest?
>> Note that you also 'lose' data to embedding and the interaction delay: The
>> first point that can be used for TE estimation is at max. embedding length
>> + max. interaction delay in samples. For example: max. embedding length =
>> dim * tau_factor * ACT = 10 * 0.4 * 5 = 20 samples plus the max interaction
>> delay of 30 ms = 9 samples. In this example, you would be left with 240 -
>> 29 samples for TE estimation per trial. There is also the possibility to
>> estimate time resolved TE/TE for shorter time windows of interest (see
>> section 4.4 in the manual); however, this method requires the use of a GPU
>> for TE estimation.
>>
>> I would further recommend to use the new pipeline for group statistics
>> described in the manual in section 4.5 (the function 'TEgroup_calculate' is
>> deprecated). The new pipeline allows you to reconstruct the interaction
>> delay and uses the following functions (see also comments in the script):
>>
>> TEgroup_prepare -> prepares all data sets (all subjects/all conditions)
>> for group analysis (this means finding common embedding parameters such
>> that estimates are not biased between groups)
>> InteractionDelayReconstruction_calculate -> estimates TE for
>> individual data sets and all assumed interaction delays u
>> InteractionDelayReconstruction_analyze -> reconstructs the
>> interaction delay by selecting the u that maximizes TE for each channel
>> TEgroup_stats -> calculate group statistics using a permutation test
>>
>> I can send you an example script for group TE analysis using this pipeline
>> to get you started. I hope this helps you to get the group analysis
>> running. Just write again if you're having trouble setting up the pipeline
>> or something is not clear about the parameters/my comments.
>>
>> Best,
>> Patricia
>>
>>
>>
>>
>> On 09/04/2014 08:30 PM, Max Cantor wrote:
>>
>> Hi fieldtrippers,
>>
>> I know trentool is not produced by the Donders Institute, so I'm not 100%
>> sure if it is appropriate to ask questions about it here, but to the best
>> of my knowledge they do not have a mailing list and I saw a few trentool
>> questions in the archives, so I'm going to assume it's ok...
>>
>> In any case, below is my current pipeline (slightly modified for
>> comprehensibility):
>>
>> (notes in bold are comments/questions made in this email, not present in
>> the pipeline. Sorry in advance for the long post! Any help would be greatly
>> appreciated as I'm a bit over my head on this but I think I'm close!)
>>
>> *****
>>
>> % Prepare group TE data
>>
>> cfgP = [];
>> cfgP.Path2TSTOOL = *TSTOOLPATH*
>> cfgP.TEcalctype = 'VW_ds';
>> cfgP.channel = {'ctfdip_LAC' 'ctfdip_RAC'};
>>
>> *I'm trying to find the transfer entropy between the left and right
>> auditory cortices in my experiment. The input is virtual sensor data that
>> was produced using SAM in fieldtrip on real MEG data. *
>>
>> % specify u to be scanned
>>
>> cfgP.predicttime_u = 30;
>> cfgP.toi = [-0.4 0.4];
>>
>> *For clarification, the predicttime_u is in seconds but the toi is in
>> milliseconds. If I understand correctly, the predicttime_u must fit within
>> the toi, but beyond that are there any benefits to it being earlier or
>> later?* PW: The predictiontime_u is in milliseconds and the toi is in
>> seconds. The prediction time is the assumed interaction delay between your
>> two sources and should fit within your toi. In general it is preferable to
>> use the method for interaction delay reconstruction for TE estimation,
>> because it allows you to reconstruct the actual delay between your source
>> and target times series. A non-optimal u/interaction delay may cause an
>> underestimation of TE, so it is recommended to use the pipeline for
>> interaction delay reconstruction whenever estimating TE for unknown delays.
>> If you use the methods for interaction delay reconstruction
>> 'predicttime_u' is replaced by
>> cfgTEP.predicttimemin_u % minimum u to be scanned
>> cfgTEP.predicttimemax_u % maximum u to be scanned
>> cfgTEP.predicttimestepsize % time steps between u to be scanned
>> A large range for u values to be scanned increases computing time a lot,
>> so it is best to limit the u range to values that are physiologically
>> plausible.
>>
>>
>> % ACT (Autocorrelation Time) estimation and constraints
>>
>> cfgP.maxlag = 150;
>> cfgP.actthrvalue = 7.5;
>> cfgP.minnrtrials = 5;
>>
>> *My understanding is maxlag should be 1/2 the sampling rate, so since
>> the data are downsampled to 300hz, it should be 150. I know that the sample
>> rate and filters are used to determine the actthrvalue, but I don't
>> actually know the calculation. 7.5 was a rough guess just to test the
>> pipeline. I'm also uncertain of what minnrtrials should be.* PW: You can
>> set the actthrvalue based on the filtering you did prior to TE analysis. If
>> you for example highpass filtered at 10 Hz, you shouldn't find an ACT
>> higher than 30 samples, because you filtered out any components of the
>> signal slower than 10 Hz/30 samples (given your sampling frequency of 300
>> Hz). So in this scenario the actthrvalue would be 30.
>> A good value for cfgP.minnrtrials is 12 (a minimum number of trials is
>> needed to realize the permutation test for estimated TE values).
>>
>>
>> % Optimization
>>
>> cfgP.optimizemethod = 'ragwitz';
>> cfgP.ragdim = 4:8;
>> cfgP.ragtaurange = [0.2 0.4];
>> cfgP.ragtausteps = 15;
>> cfgP.repPred = 100;
>>
>> *I am completely at a loss for this. I've done some reading into
>> transfer entropy, mutual information, etc., cited in trentool, but I'm yet
>> to understand how exactly this optimization works and what the
>> configuration should be, given my data and experimental intentions.* PW:
>> The Ragwitz criterion tries to find optimal embedding parameters dim and
>> tau for the data. To do that, the method iteratively takes all possible
>> combinations of dim and tau values that are provided in cfgP.ragdim and
>> cfgP.ragtaurange/.ragtausteps and tests how well these combinations embed
>> the data. To test an embedding, the method builds the embedding vectors
>> from the data; it then tests for each point how well the next point in time
>> can be predicted from the reference point's nearest neighbours. So for each
>> embedded point, the method searches for the nearest neighbours and
>> calculates the average of those nearest neighbours. The difference between
>> the averaged/predicted point and the actual next point is the error of the
>> local predictor. The Ragwitz criterion will then return the parameter
>> combination for which this error over all points is minimal.
>> The parameters set the following: 'ragdim' are dimensions to be tested by
>> the method (I would reccomend to start with 2:10), 'ragtaurange' together
>> with 'ragtausteps' specifies the tau values to be tested (TRENTOOL will
>> build a vector from 0.2 to 0.4 in 15 steps). Note, that the values here are
>> factors that are later multiplied with the ACT to obtain the actual tau.
>> 'repPred' is the number of points that will be used for the local
>> prediction, i.e. the Ragwitz criterion will test the local prediction and
>> calculate the error for the first 100 points in your time series. The two
>> parameters 'flagNei' ans 'sizeNei' below specify the type of neighbour
>> search conducted by the Ragwitz criterion: 'flagNei' tells the method to
>> either conduct a kNN or range search; 'sizeNei' specifies the number of
>> neighbours or the radius to be searched by a range search.
>>
>>
>> % Kernel-based TE estimation
>>
>> cfgP.flagNei = 'Mass';
>> cfgP.sizeNei = 4; % Default
>>
>> cfgP.ensemblemethod = 'no';
>> cfgP.outputpath = *OUTPUT PATH*;
>>
>> if ~exist(*Path for TEprepare data object*)
>> load VSdat;
>> TE_Wrd = {};
>> for i = 1:nConds
>> for j = 1:Nsub
>> TE_Wrd{i}{j} = TEprepare(cfgP, VSdat{i}{j});
>> end
>> end
>> clear VSdat;
>> save('TE_Wrd', 'TE_Wrd');
>> end
>>
>> *The configuration and virtual sensor data, organized in a 3 x 15 cell
>> of structures (condition by subject) are the input. The TEprepare
>> substructure is added to each individual condition x subject .mat files'
>> data structure which are stored on disk independently.*
>>
>> % Use object_to_mat_conversion.m to replace individual condition x subject
>> virtual sensor data
>> % .mat files with their TE_Wrd equivalent
>>
>> *I'm using a separate script to make some manipulations to the objects
>> from disk; this will all eventually be integrated into the main pipeline*.*
>> TRENTOOL seems to handle data output very differently from fieldtrip and
>> I've had trouble thinking through the most logical way to handle the data
>> so it's a bit haphazard right now.*
>>
>> load cond080sub01.mat
>>
>> cfgG = [];
>> cfgG.dim = cond080sub01.TEprepare.optdim;
>> cfgG.tau = cond080sub01.TEprepare.opttau;
>>
>> if isfield(cond080sub01, 'TEprepare')
>> TEgroup_prepare(cfgG, fileCell);
>> else
>> error('Need to run TEprepare before TEgroup_prepare');
>> end
>>
>> *For clarification, fileCell is a cell with the name of each condition x
>> subject .mat file, which as I said before is collectively the same as the 3
>> x 15 VSdat structure (condition x subject).*
>>
>> % Replace .mat files with '_for_TEgroup_calculate' version in
>> % object_to_mat_conversion.m
>>
>> % TE Group Calculate
>>
>> load cond080sub01.mat
>> if isfield(cond080sub01, 'TEgroupprepare')
>> for i = 1:length(fileCell)
>> TEgroup_calculate(fileCell{i});
>> end
>> else
>> error('Need to run TEgroup_prepare before TEgroup_calculate');
>> end
>>
>>
>>
>>
>>
>>
>>
>> *At this step I get the following error: Error using transferentropy (line
>> 337) \nTRENTOOL ERROR: not enough data points left after embedding Error in
>> TEgroup_calculate (line 133) [TEresult] = transferentropy(cfg,data);*
>>
>> % TE Group Stats
>>
>> cfgGSTAT = [];
>> cfgGSTAT.design(1,1:2*Nsub) = [ones(1,Nsub) 2*ones(1,Nsub)];
>> cfgGSTAT.design(2,1:2*Nsub) = [1:Nsub 1:Nsub];
>>
>> cfgGSTAT.uvar = 1;
>> cfgGSTAT.ivar = 2;
>> cfgGSTAT.fileidout = 'test_groupstats';
>>
>> TEgroup_stats(cfgGSTAT, fileCell);
>>
>> *Given the error above, I am yet to get to this step, but it does not
>> seem fundamentally different from normal fieldtrip stats.*
>>
>> *****
>>
>> In case my notes were not clear or you skipped to the bottom, *my
>> primary concern is whether the error I'm getting in TEgroup_calculate is a
>> pipeline issue* (I noticed the example pipeline in trentool, the manual,
>> and published methods articles all seem to have slightly or significantly
>> different pipeline compositions), *or if the error is* due to ACT,
>> ragwitz optimization, or some other faulty parameterization *on my part
>> due to a lack of understanding of how transfer entropy works on a more
>> theoretical/mathematical level*. If the latter is the case, is there any
>> relatively straightforward way to conceptualize this, or is this something
>> where I'm just going to have to keep reading and rereading until it
>> eventually makes sense? I've already done quite a bit of that and it hasn't
>> pierced my thick skull yet but I'm sure it will eventually!
>>
>> Thank you so much,
>>
>> Max Cantor
>>
>>
>> --
>> Max Cantor
>> Lab Manager
>> Computational Neurolinguistics Lab
>> University of Michigan
>>
>>
>> _______________________________________________
>> fieldtrip mailing
>> listfieldtrip at donders.ru.nlhttp://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>>
>> --
>> ------------------------------------------------------------
>>
>> Patricia Wollstadt, PhD Student
>>
>> MEG Unit, Brain Imaging Center Goethe University, Frankfurt, Germany
>>
>> Heinrich Hoffmann Strasse 10, Haus 93 B D - 60528 Frankfurt am Main
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>
>
>
> --
> Max Cantor
> Lab Manager
> Computational Neurolinguistics Lab
> University of Michigan
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140909/29e18024/attachment.html>
>
> ------------------------------
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
> End of fieldtrip Digest, Vol 46, Issue 3
> ****************************************
>
Barbara Schorr, MSc
Clinical and Biological Psychology
University of Ulm
Albert-Einstein-Allee 47
89069 Ulm
More information about the fieldtrip
mailing list