<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div class="" style="word-wrap:break-word; line-break:after-white-space">
<div dir="auto" class="" style="word-wrap:break-word; line-break:after-white-space">
<div dir="auto" class="" style="word-wrap:break-word; line-break:after-white-space">
Dear fieldtrip community,
<div class=""><br class="">
</div>
<div class="">first of all, thank you for your valuable responses @Tzvetan and Stephen. They were both very helpful and got me to dig deeper into the analysis. </div>
<div class=""><br class="">
</div>
<div class="">You were absolutely right in describing my approach for my Morlet wavelet TF analysis. The data were baseline corrected (in db). When contrasting the 2 conditions of interest, I receive the attached figure (dif_morlet). After your responses, I
 took the same approach for the mtmfft data with cfg.tapsmofrq = 8 (center frequency at 28 Hz) to reproduce the effect that I found between 20-35 Hz in the morlet wavelet analyses<span class="" style="font-family:Courier">.</span> I calculated frequency analysis
 (mtmfft) for both conditions (data_1, data_0) and their baseline periods (data_1_bas, data_0_bas) separately and then „baseline corrected“ the data from both conditions (also in db, see dif_mtmfft). The differences between conditions are now very similar between
 both approaches (morlet vs mtmfft).</div>
<div class=""><br class="">
</div>
<div class="">In the next step. I followed your advice and performed source analyses of frequency_data for all 4 conditions separately (pow_1, pow_0, pow_1_baseline, pow_0_baseline) as well as from all_data from ft_appenddata. For the source_analyses from all
 4 conditions, I am using the common filter from all_data as well as the source model (ft_prepare_leadfieldds) from all_data. After performing the ft_source_analysis function for all 4 conditions, I am trying to replicate what I have done with the power data
 ( in db). For this reason, I am using ft_math with source_1_dif = 10*log10 (source_1/source_1_baseline) and the same for source_0. After this, I am subtracting source_0_dif from source_1_dif as done during the frequency analysis yielding my final source data. </div>
<div class=""><br class="">
</div>
<div class="">After interpolating the source differences, I am using ft_volumenormalise. The result from this approach is attached in dif_sources. <br class="">
<br class="">
</div>
<div class="">I am a bit puzzled since I would not expect these source data based on my power mtmfft data. I made sure that the coordinate systems and units are the same across models (volume_conduction_model, electrodes, MRI) but I am wondering whether I am
 doing something wrong in performing the source_analysis or whether the source results are reasonable. </div>
<div class=""><br class="">
</div>
<div class="">Again, I uploaded the script and the data such that my analysis pipeline could be reproduced by everyone who is interested (<a href="https://github.com/PatrickWiegel/EEG-Beamformer-Source-localisation" class="">https://github.com/PatrickWiegel/EEG-Beamformer-Source-localisation</a>).
 Below, I am attaching the code for the source_analyses steps. Any comments on my results or approach are welcome.</div>
<div class=""><br class="">
</div>
<div class="">All the Best from Germany, </div>
<div class="">Patrick</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">. </div>
</div>
</div>
</div>
<div style="word-wrap:break-word; line-break:after-white-space">
<div dir="auto" style="word-wrap:break-word; line-break:after-white-space">
<div dir="auto" style="word-wrap:break-word; line-break:after-white-space">
<div></div>
</div>
</div>
</div>
<div style="word-wrap:break-word; line-break:after-white-space">
<div dir="auto" style="word-wrap:break-word; line-break:after-white-space">
<div dir="auto" style="word-wrap:break-word; line-break:after-white-space">
<div></div>
</div>
</div>
</div>
<div class="" style="word-wrap:break-word; line-break:after-white-space">
<div dir="auto" class="" style="word-wrap:break-word; line-break:after-white-space">
<div dir="auto" class="" style="word-wrap:break-word; line-break:after-white-space">
<div class=""></div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<p class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier; min-height:12px">
 <br class="x_webkit-block-placeholder">
</p>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg              = [];</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg.method       = <span class="" style="color:#a020f0">'dics'</span>;</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg.headmodel    = vol;</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg.elec         = elec_aligned;</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg.dics.projectnoise = <span class="" style="color:#a020f0">'yes'</span>;</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg.dics.lambda       = <span class="" style="color:#a020f0">'5%'</span>;</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg.dics.keepfilter   = <span class="" style="color:#a020f0">'yes'</span>;</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg.dics.realfilter   = <span class="" style="color:#a020f0">'yes'</span>;</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg.sourcemodel  = sourcemodel_beta;</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
source_beta_1 = ft_sourceanalysis(cfg, data_beta_1);</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
source_beta_0 = ft_sourceanalysis(cfg, data_beta_0);</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
source_beta_1_bas = ft_sourceanalysis(cfg, data_beta_1_bas);</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
source_beta_0_bas = ft_sourceanalysis(cfg, data_beta_0_bas);</div>
<p class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier; min-height:12px">
 <br class="x_webkit-block-placeholder">
</p>
<p class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier; min-height:12px">
 <br class="x_webkit-block-placeholder">
</p>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier; color:rgb(34,139,34)">
%%</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg            = [];</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg.parameter = <span class="" style="color:#a020f0">'pow'</span>;</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg.operation = <span class="" style="color:#a020f0">'10*log10(x1/x2)'</span>;</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
sourceDiff1_beta = ft_math(cfg, source_beta_1,source_beta_1_bas);</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
sourceDiff0_beta = ft_math(cfg, source_beta_0,source_beta_0_bas);</div>
<p class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier; min-height:12px">
 <br class="x_webkit-block-placeholder">
</p>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
sourceDiff_beta_dif = sourceDiff1_beta;</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
sourceDiff_beta_dif.pow = sourceDiff1_beta.pow - sourceDiff0_beta.pow;</div>
<p class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier; min-height:12px">
 <br class="x_webkit-block-placeholder">
</p>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier; color:rgb(34,139,34)">
%%</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg            = [];</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg.downsample = 2;</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg.parameter  = <span class="" style="color:#a020f0">'pow'</span>;</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
sourceDiffInt_beta_dif  = ft_sourceinterpolate(cfg, sourceDiff_beta_dif , mri_realigned);</div>
<p class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier; min-height:12px">
 <br class="x_webkit-block-placeholder">
</p>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier; color:rgb(34,139,34)">
%%</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
maxval_beta = max(sourceDiffInt_beta_dif.pow);</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier; color:rgb(34,139,34)">
%%</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg = [];</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg.nonlinear     = <span class="" style="color:#a020f0">'no'</span>;</div>
<p class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier; min-height:12px">
 <br class="x_webkit-block-placeholder">
</p>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
sourceDiffIntNorm_beta_dif = ft_volumenormalise(cfg, sourceDiffInt_beta_dif);</div>
<p class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier; min-height:12px">
 <br class="x_webkit-block-placeholder">
</p>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier; color:rgb(34,139,34)">
%%</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg = [];</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg.method        = <span class="" style="color:#a020f0">'ortho'</span>;</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg.interactive   = <span class="" style="color:#a020f0">'yes'</span>;</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg.funparameter  = <span class="" style="color:#a020f0">'pow'</span>;</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg.maskparameter = cfg.funparameter;</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg.funcolorlim   = [0.0 maxval_beta];</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg.opacitylim    = [0.0 maxval_beta];</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
cfg.opacitymap    = <span class="" style="color:#a020f0">'rampup'</span>;</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier">
ft_sourceplot(cfg, sourceDiffIntNorm_beta_dif);</div>
<div class="" style="margin:0px; font-size:10px; line-height:normal; font-family:Courier; color:rgb(34,139,34)">
%%</div>
<div class="" style="margin:0px; line-height:normal; font-family:Courier; min-height:14px">
<br class="">
</div>
</div>
<div class=""><br class="">
<div class="">
<div class="" style="color:rgb(0,0,0); letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; word-wrap:break-word; line-break:after-white-space">
<b class="">Patrick Wiegel</b><br class="">
<font color="#680823" class="">Department of Sport and Sport Science</font>
<div class=""><br class="">
University of Freiburg <br class="">
Sandfangweg 4<br class="">
79117 Freiburg i. Br . <br class="">
<br class="">
<div class="">phone: +49 (0)761/ 203-4550<br class="">
<a href="mailto:patrick.wiegel@sport.uni-freiburg.de" class="">email: patrick.wiegel@sport.uni-freiburg.de</a><br class="">
web: www.sport.uni-freiburg.de</div>
</div>
</div>
</div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">Am 13.11.2020 um 12:48 schrieb Stephen Whitmarsh <<a href="mailto:stephen.whitmarsh@gmail.com" class="">stephen.whitmarsh@gmail.com</a>>:</div>
<br class="x_Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">Hi Patrick, (and Tzvetan - who responded in the meantime),
<div class=""><br class="">
<div class="">
<div class="">I agree that you should start with a good correspondence between your initial results (wavelets), and the power difference you are trying to localize (with mtmfft).</div>
<div class=""><br class="">
</div>
<div class="">Wavelets and fft methods can result in very similar - practically identical - results, but that depends on a number of parameters, especially concerning frequency-smoothing; Wavelets are typically defined in terms of nr. of cycles, while fft methods
 are defined in terms of time-windows. Wavelets defined in nr. of cycles will have a decreasing time-windows with increasing frequency, while with mtmfft time windows will remain the same. Because of this, frequency smoothing will increase with frequency with
 wavelets, and stay the same with a constant time window. Of course, you can make the fft time window frequency-dependent, as is described in the frequency-analyses tutorial, to make them more comparable. Secondly, the fft method allows you to specify frequency
 smoothing when you use Sleppian multitapers (cfg.taper = 'dpss'). To be clear, you should be able to recognize these differences in frequency smoothing/resolution when looking at the different TFR plots. Currently they look too different, probably because
 of something else (baseline?) than a wavelet-fft difference.</div>
<div class=""><br class="">
</div>
<div class="">I would advise making a 'full' TFR with mtmfft similar as your wavelet results so that you can properly compare them. This allows you to also set the best parameters for smoothing/timeperiods. In fact, you can use the multitaper approach to more
 accurately extract the power in a certain frequency band. Only then compare the topo's, and only then do the beamformer, so you will pick up any unexpected results.</div>
<div class=""><br class="">
</div>
<div class="">Because of different contrasts/baseline correction, I cannot compare the topo's / beamformer results.</div>
<div class=""><br class="">
</div>
<div class="">Bon courage,</div>
<div class="">Stephen</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
</div>
</div>
</div>
<br class="">
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">Op vr 13 nov. 2020 om 11:30 schreef Patrick Wiegel <<a href="mailto:patrick.wiegel@sport.uni-freiburg.de" class="">patrick.wiegel@sport.uni-freiburg.de</a>>:<br class="">
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div class="">
<div class="" style="">Dear Field-trip community,
<div class=""><br class="">
</div>
<div class="">I am working on EEG data from a motor learning task. in the first part of my analysis, I performed a time-frequency analysis (Morlet wavelet method) and cluster-based permutation test. I compared two different conditions (correct & incorrect movements)
 within subjects and found a significant difference in the beta band (20-35 Hz) when subjects were provided with feedback. I attached the topographical plot from one subject that illustrates the difference between the conditions at the selected time point and
 frequency (dif_morlet). As you can see, beta power was higher in one condition in lateral frontal electrodes.</div>
<div class=""><br class="">
</div>
<div class="">Now, I would like to better spatially locate the effect for this single subject. For this purpose, I followed the Beamformer tutorial on the website. In the first step, I selected the raw data of interest (at the time where the effect was seen)
 and performed frequency analyses for the 20-35 Hz range (mtmfft, contrast between conditions shown in dif_mtmfft). There is an apparent difference between dif_morlet and dif_mtmfft and I am wondering why this is the case? One apparent reason is that the time-frequency
 data were baseline corrected and the frequency data from mtmfft not.</div>
<div class=""><br class="">
</div>
<div class="">Using the power and CSD data from mtmfft, I performed the source analysis with a standard MRI and head model. The source was located in the left hemisphere (source plot), which is in stark contrast to the time-frequency data (dif_morlet). I am
 aware that the source analysis is based on a lot of assumptions (conductivity etc.) that influence the calculations but it is very difficult to make sense of such discrepancy. </div>
<div class="">Maybe it is necessary to also baseline correct the mtmfft data before inputting them to the source analysis? Or doing the contrasting source localization betwee a single condition and the corresponding baseline data before contrasting the 2 conditions? </div>
<div class=""><br class="">
</div>
<div class="">I am providing all necessary files and scripts (TF_analysis & BEAMFORMER) if anyone is interested to reproduce the results that I am showing and reporting for this single subject (<a href="https://github.com/PatrickWiegel/EEG-Beamformer-Source-localisation" target="_blank" class="">https://github.com/PatrickWiegel/EEG-Beamformer-Source-localisation</a>). </div>
<div class=""><br class="">
</div>
<div class="">I would appreciate any help and discussion on that.</div>
<div class=""><br class="">
</div>
<div class="">All the best,</div>
<div class="">Patrick</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""></div>
</div>
<div class="" style="">
<div class=""></div>
</div>
<div class="" style="">
<div class=""></div>
</div>
<div class="" style="">
<div class=""></div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
<div class="">
<div class="" style="letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px">
<b class="">Patrick Wiegel</b><br class="">
<font color="#680823" class="">Department of Sport and Sport Science</font>
<div class=""><br class="">
University of Freiburg <br class="">
Sandfangweg 4<br class="">
79117 Freiburg i. Br . <br class="">
<br class="">
<div class="">phone: +49 (0)761/ 203-4550<br class="">
<a href="mailto:patrick.wiegel@sport.uni-freiburg.de" target="_blank" class="">email: patrick.wiegel@sport.uni-freiburg.de</a><br class="">
web: <a href="http://www.sport.uni-freiburg.de/" target="_blank" class="">www.sport.uni-freiburg.de</a></div>
</div>
</div>
</div>
<br class="">
</div>
</div>
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
<a href="https://doi.org/10.1371/journal.pcbi.1002202" rel="noreferrer" target="_blank" class="">https://doi.org/10.1371/journal.pcbi.1002202</a><br class="">
</blockquote>
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
https://doi.org/10.1371/journal.pcbi.1002202<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</div>
</body>
</html>