<div dir="ltr">Dear Patrick,<div><br></div><div>Nice to see you are progressing. The TFR topoplots look nice (and the effect seems even stronger in the mtmfft version)!</div><div><br></div><div>I agree the source reconstruction looks pretty iffy. A single dot like that shouldn't be there - no source in Beamformer is so focal. It suggests something is off, which could be as simple as a single electrode doing something weird (given how focal and superficial the artefact is).</div><div><br></div><div>I would take another step back;</div><div>I would first look at the distribution of your absolute beta, i.e. without baseline correction. For both conditions.</div><div>I would then look at the distribution of your baseline beta, i.e. only your baseline. For both conditions.</div><div>You should satisfy yourself that the results make sense, i.e. nothing too drastic, focal, etc., and some density of beta power around the central sulcus (?).</div><div><br></div><div>Now I understand your contrast better, I have to ask why you do the baseline correction as you do. In this way you are using a separate BL for each condition, meaning that after BL-correction you are actually also comparing BL as much as you are comparing post-BL activity - after BL-correction any differences in BL become difference in your active period. </div><div>If you assume differences in BL you might want to compare those separately before you 'add' them to your active period. If you have a randomized design, you might not want to do any BL correction in your contrast at all. Also, if there are no differences in BL, then it would make no difference...</div><div>So, when you have a good sense of the absolute values and source distributions, you might want to try just comparing active period A vs B, relative (/) or absolute (-), and forget about the BL. Sometimes the BL is more noisy than the active period even.</div><div><br></div><div>Anyway, your script looks fine to me, but it's been a while. However, I suspect that one of your datasets (A, A_BL, B, or B_BL) has some artefact that is introduced in the contrast.</div><div><br></div><div>Cheers,</div><div>Stephen</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Op do 19 nov. 2020 om 13:27 schreef Patrick Wiegel <<a href="mailto:patrick.wiegel@sport.uni-freiburg.de" target="_blank">patrick.wiegel@sport.uni-freiburg.de</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div>
<div>
<div dir="auto">
<div dir="auto">
Dear fieldtrip community,
<div><br>
</div>
<div>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><br>
</div>
<div>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 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><br>
</div>
<div>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><br>
</div>
<div>After interpolating the source differences, I am using ft_volumenormalise. The result from this approach is attached in dif_sources. <br>
<br>
</div>
<div>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><br>
</div>
<div>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" target="_blank">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><br>
</div>
<div>All the Best from Germany, </div>
<div>Patrick</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>. </div>
</div>
</div>
</div>
<div>
<div dir="auto">
<div dir="auto">
<div></div>
</div>
</div>
</div>
<div>
<div dir="auto">
<div dir="auto">
<div></div>
</div>
</div>
</div>
<div>
<div dir="auto">
<div dir="auto">
<div></div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;min-height:12px">
 <br>
</p>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg              = [];</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg.method       = <span style="color:rgb(160,32,240)">'dics'</span>;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg.headmodel    = vol;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg.elec         = elec_aligned;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg.dics.projectnoise = <span style="color:rgb(160,32,240)">'yes'</span>;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg.dics.lambda       = <span style="color:rgb(160,32,240)">'5%'</span>;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg.dics.keepfilter   = <span style="color:rgb(160,32,240)">'yes'</span>;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg.dics.realfilter   = <span style="color:rgb(160,32,240)">'yes'</span>;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg.sourcemodel  = sourcemodel_beta;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
source_beta_1 = ft_sourceanalysis(cfg, data_beta_1);</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
source_beta_0 = ft_sourceanalysis(cfg, data_beta_0);</div>
<div 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 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 style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;min-height:12px">
 <br>
</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;min-height:12px">
 <br>
</p>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(34,139,34)">
%%</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg            = [];</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg.parameter = <span style="color:rgb(160,32,240)">'pow'</span>;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg.operation = <span style="color:rgb(160,32,240)">'10*log10(x1/x2)'</span>;</div>
<div 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 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 style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;min-height:12px">
 <br>
</p>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
sourceDiff_beta_dif = sourceDiff1_beta;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
sourceDiff_beta_dif.pow = sourceDiff1_beta.pow - sourceDiff0_beta.pow;</div>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;min-height:12px">
 <br>
</p>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(34,139,34)">
%%</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg            = [];</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg.downsample = 2;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg.parameter  = <span style="color:rgb(160,32,240)">'pow'</span>;</div>
<div 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 style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;min-height:12px">
 <br>
</p>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(34,139,34)">
%%</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
maxval_beta = max(sourceDiffInt_beta_dif.pow);</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(34,139,34)">
%%</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg = [];</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg.nonlinear     = <span style="color:rgb(160,32,240)">'no'</span>;</div>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;min-height:12px">
 <br>
</p>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
sourceDiffIntNorm_beta_dif = ft_volumenormalise(cfg, sourceDiffInt_beta_dif);</div>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;min-height:12px">
 <br>
</p>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(34,139,34)">
%%</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg = [];</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg.method        = <span style="color:rgb(160,32,240)">'ortho'</span>;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg.interactive   = <span style="color:rgb(160,32,240)">'yes'</span>;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg.funparameter  = <span style="color:rgb(160,32,240)">'pow'</span>;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg.maskparameter = cfg.funparameter;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg.funcolorlim   = [0.0 maxval_beta];</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg.opacitylim    = [0.0 maxval_beta];</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
cfg.opacitymap    = <span style="color:rgb(160,32,240)">'rampup'</span>;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
ft_sourceplot(cfg, sourceDiffIntNorm_beta_dif);</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(34,139,34)">
%%</div>
<div style="margin:0px;line-height:normal;font-family:Courier;min-height:14px">
<br>
</div>
</div>
<div><br>
<div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<b>Patrick Wiegel</b><br>
<font color="#680823">Department of Sport and Sport Science</font>
<div><br>
University of Freiburg <br>
Sandfangweg 4<br>
79117 Freiburg i. Br . <br>
<br>
<div>phone: +49 (0)761/ 203-4550<br>
<a href="mailto:patrick.wiegel@sport.uni-freiburg.de" target="_blank">email: patrick.wiegel@sport.uni-freiburg.de</a><br>
web: <a href="http://www.sport.uni-freiburg.de" target="_blank">www.sport.uni-freiburg.de</a></div>
</div>
</div>
</div>
<div><br>
<blockquote type="cite">
<div>Am 13.11.2020 um 12:48 schrieb Stephen Whitmarsh <<a href="mailto:stephen.whitmarsh@gmail.com" target="_blank">stephen.whitmarsh@gmail.com</a>>:</div>
<br>
<div>
<div dir="ltr">Hi Patrick, (and Tzvetan - who responded in the meantime),
<div><br>
<div>
<div>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><br>
</div>
<div>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><br>
</div>
<div>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><br>
</div>
<div>Because of different contrasts/baseline correction, I cannot compare the topo's / beamformer results.</div>
<div><br>
</div>
<div>Bon courage,</div>
<div>Stephen</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
</div>
</div>
<br>
<div>
<div dir="ltr">Op vr 13 nov. 2020 om 11:30 schreef Patrick Wiegel <<a href="mailto:patrick.wiegel@sport.uni-freiburg.de" target="_blank">patrick.wiegel@sport.uni-freiburg.de</a>>:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div>Dear Field-trip community,
<div><br>
</div>
<div>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><br>
</div>
<div>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><br>
</div>
<div>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>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><br>
</div>
<div>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">https://github.com/PatrickWiegel/EEG-Beamformer-Source-localisation</a>). </div>
<div><br>
</div>
<div>I would appreciate any help and discussion on that.</div>
<div><br>
</div>
<div>All the best,</div>
<div>Patrick</div>
<div><br>
</div>
<div><br>
</div>
<div></div>
</div>
<div>
<div></div>
</div>
<div>
<div></div>
</div>
<div>
<div></div>
<div><br>
</div>
<div><br>
</div>
<div><br>
<div>
<div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<b>Patrick Wiegel</b><br>
<font color="#680823">Department of Sport and Sport Science</font>
<div><br>
University of Freiburg <br>
Sandfangweg 4<br>
79117 Freiburg i. Br . <br>
<br>
<div>phone: +49 (0)761/ 203-4550<br>
<a href="mailto:patrick.wiegel@sport.uni-freiburg.de" target="_blank">email: patrick.wiegel@sport.uni-freiburg.de</a><br>
web: <a href="http://www.sport.uni-freiburg.de/" target="_blank">www.sport.uni-freiburg.de</a></div>
</div>
</div>
</div>
<br>
</div>
</div>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202" rel="noreferrer" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</blockquote>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>

_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202" rel="noreferrer" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</blockquote></div></div>