Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
walkthrough [2018/05/01 09:51]
213.124.184.154
walkthrough [2018/08/13 10:34] (current)
149.203.254.243 [Power changes over time] Link added
Line 157: Line 157:
     cfg.artfctdef.visual.artifact:​ [2xnArtifacts double]     cfg.artfctdef.visual.artifact:​ [2xnArtifacts double]
 Note that ft_databrowser does not do anything with your data. To remove the trials that overlap with the segments we selected (and which are now in our cfg) and to save the remaining data in a new data structure we still need to use the function ft_rejectartifact:  ​ Note that ft_databrowser does not do anything with your data. To remove the trials that overlap with the segments we selected (and which are now in our cfg) and to save the remaining data in a new data structure we still need to use the function ft_rejectartifact:  ​
-    cfg.artfctdef.reject ​ = complete;+    cfg.artfctdef.reject ​ = 'complete';
     cleandata = ft_rejectartifact(cfg,​data);​     cleandata = ft_rejectartifact(cfg,​data);​
  
Line 168: Line 168:
 First we need to decompose the data into independent components. The only thing we have to be sure of is that we only use the actual EEG or MEG channels and don’t use reference sensors or EOG: First we need to decompose the data into independent components. The only thing we have to be sure of is that we only use the actual EEG or MEG channels and don’t use reference sensors or EOG:
     cfg = [];     cfg = [];
-    cfg.channel = EEG;+    cfg.channel = 'EEG';
     ic_data = ft_componentanalysis(cfg,​cleandata);​     ic_data = ft_componentanalysis(cfg,​cleandata);​
  
Line 177: Line 177:
 When ft_componentanalysis is done (it could take a while) we have to find those components we want to substract from our data. We’ll use ft_databrowser for this again, only looking at ten ‘channels’ (components) at a time: When ft_componentanalysis is done (it could take a while) we have to find those components we want to substract from our data. We’ll use ft_databrowser for this again, only looking at ten ‘channels’ (components) at a time:
     cfg = [];     cfg = [];
-    cfg.viewmode = component+    cfg.viewmode = 'component'
-    cfg.continuous = yes;+    cfg.continuous = 'yes';
     cfg.blocksize = 30;     cfg.blocksize = 30;
     cfg.channels = [1:10];     cfg.channels = [1:10];
Line 194: Line 194:
  
     cfg = [];     cfg = [];
-    cfg.viewmode = horizontal+    cfg.viewmode = 'horizontal'
-    cfg.continuous = no;+    cfg.continuous = 'no';
     ft_databrowser(cfg,​data_iccleaned);​     ft_databrowser(cfg,​data_iccleaned);​
  
-    cfg.artfctdef.remove = complete;+    cfg.artfctdef.remove = 'complete';
     data_manual = ft_rejectartifact(cfg,​data_iccleaned);​     data_manual = ft_rejectartifact(cfg,​data_iccleaned);​
  
Line 204: Line 204:
  
 Filtering your data will also get rid of some common artifacts, especially line noise - the 50 Hz ‘humming’ of the electric power supply and instruments connected to it. To clean up your data close around 50 Hz, and its harmonics at 100 and 150 Hz, you can use a band-stop filter. Add the following to your cfg before you run ft_preprocessing the first time (on page 9): Filtering your data will also get rid of some common artifacts, especially line noise - the 50 Hz ‘humming’ of the electric power supply and instruments connected to it. To clean up your data close around 50 Hz, and its harmonics at 100 and 150 Hz, you can use a band-stop filter. Add the following to your cfg before you run ft_preprocessing the first time (on page 9):
-    cfg.bsfilter = yes;+    cfg.bsfilter = 'yes';
     cfg.bsfreq = [49 51; 99 100; 149 151];     cfg.bsfreq = [49 51; 99 100; 149 151];
     …     …
Line 212: Line 212:
 This brings us to a slightly different use of ft_preprocessing where we supply it data instead of letting it read from disk. For instance, continuing with the data from the previous page, we could do the following: This brings us to a slightly different use of ft_preprocessing where we supply it data instead of letting it read from disk. For instance, continuing with the data from the previous page, we could do the following:
     cfg = [];     cfg = [];
-    cfg.lpfilter = yes;+    cfg.lpfilter = 'yes';
     cfg.lpfreq = [35];     cfg.lpfreq = [35];
     data_lp = ft_preprocessing(cfg,​data_manual);​     data_lp = ft_preprocessing(cfg,​data_manual);​
Line 232: Line 232:
 ===== Power per trial ===== ===== Power per trial =====
  
-In the simplest case you are interested in the power of certain frequencies (frequencies of interest: cfg.foi) ​ of the whole trial. This is done by using mtmfft’ as the method:+In the simplest case you are interested in the power of certain frequencies (frequencies of interest: cfg.foi) ​ of the whole trial. This is done by using 'mtmfft' ​as the method:
  
     cfg = [];     cfg = [];
-    cfg.method = mtmfft+    cfg.method = 'mtmfft'
-    cfg.output = pow+    cfg.output = 'pow'
-    cfg.foi = [1:​30]; ​+    cfg.foi = [1:30]; 
 +    cfg.taper = '​dpss';​ 
 +    cfg.tapsmofrq = [2];
  
 Note that in cfg.foi we are now specifying a list of frequencies with steps of 1 Hz. It is also possible to specify a range (cfg.foilim = [1 30];) which will output an average power over these frequencies,​ or to take different size “steps” (cfg.foi = [1:2:30];). Note that in cfg.foi we are now specifying a list of frequencies with steps of 1 Hz. It is also possible to specify a range (cfg.foilim = [1 30];) which will output an average power over these frequencies,​ or to take different size “steps” (cfg.foi = [1:2:30];).
Line 275: Line 277:
 To summarize let’s look at the different parameters that have to be set for doing a frequency analysis with a sliding, frequency dependant, time window, using a Hanning taper and then call ''​ft_freqanalysis''​ on one data set: To summarize let’s look at the different parameters that have to be set for doing a frequency analysis with a sliding, frequency dependant, time window, using a Hanning taper and then call ''​ft_freqanalysis''​ on one data set:
     cfg.trials ​        = trialsA;     cfg.trials ​        = trialsA;
-    cfg.output ​        ​= ​pow+    cfg.output ​        ​= ​'pow'
-    cfg.method ​        ​= ​mtmconvol+    cfg.method ​        ​= ​'mtmconvol'
-    cfg.taper ​         = hanning;+    cfg.taper ​         = 'hanning';
     cfg.foi ​           = 1:30;     cfg.foi ​           = 1:30;
     cfg.t_ftimwin ​     = 4 ./ cfg.foi;     cfg.t_ftimwin ​     = 4 ./ cfg.foi;
Line 298: Line 300:
     cfg.trials = trialsA;     cfg.trials = trialsA;
 However, if you want to save trials separately you can specify the following option: However, if you want to save trials separately you can specify the following option:
-    cfg.keeptrials = yes;                         %default = no+    cfg.keeptrials = 'yes';                         %default = 'no'
  
 === ft_freqanalysis output === === ft_freqanalysis output ===
  
-We might go further into the output of ft_freqanalysis in a future release of this document but for now it suffices to say it gives a datastructure as output similar as the input structure but now with the field ''​.powspctrm''​ instead of ''​.trial''​ or ''​.avg.trial''​. +We might go further into the output of ft_freqanalysis in a future release of this document but for now it suffices to say it gives a datastructure as output similar as the input structure but now with the field ''​.powspctrm''​ instead of ''​.trial''​ or ''​.avg.trial''​. For further information see [[tutorial:​timefrequencyanalysis]] and [[tutorial::​plotting]]. 
  
 ====== Statistics ====== ​ ====== Statistics ====== ​