<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Hi Philipp,</div><div class="gmail_quote"><br></div><div class="gmail_quote">Thanks so much for your answer, it does indeed solve the problem!</div><div class="gmail_quote"><br></div><div class="gmail_quote">I thought the covariance matrix was no longer necessary after computation of the (common) filter, but, as you showed by pointing to the code, this is clearly not the case.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Now, I compared the results of </div><div class="gmail_quote">a) calculating power from the virtual sensors time-series (data multiplied by the filter, estimated using the 'common' covariance), and </div><div class="gmail_quote">b) power taken from the output of ft_sourceanalysis, using two different 'condition-specific' covariance matrices.</div><div class="gmail_quote">Results are pretty identical in my case, apart from minor differences in the power values. </div><div class="gmail_quote"><br></div><div class="gmail_quote">I wonder if anyone could help me figure out if there is a mathematical difference between these two approaches?</div><div class="gmail_quote"><br></div><div class="gmail_quote">Anyway, many thanks again for your help!</div><div class="gmail_quote"><br></div><div class="gmail_quote">Best wishes,</div><div class="gmail_quote"><br></div><div class="gmail_quote">Lorenzo</div><div class="gmail_quote"><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><blockquote type="cite"><div style="margin:0px"><span style="font-family:-webkit-system-font,'Helvetica Neue',Helvetica,sans-serif;color:rgb(0,0,0)"><b>From: </b></span><span style="font-family:-webkit-system-font,'Helvetica Neue',Helvetica,sans-serif">Philipp Ruhnau <<a href="mailto:mail@philipp-ruhnau.de" target="_blank">mail@philipp-ruhnau.de</a>><br></span></div><div style="margin:0px"><span style="font-family:-webkit-system-font,'Helvetica Neue',Helvetica,sans-serif;color:rgb(0,0,0)"><b>Subject: </b></span><span style="font-family:-webkit-system-font,'Helvetica Neue',Helvetica,sans-serif"><b>Re: [FieldTrip] Help understanding the lcmv beamformer output</b><br></span></div><div style="margin:0px"><span style="font-family:-webkit-system-font,'Helvetica Neue',Helvetica,sans-serif;color:rgb(0,0,0)"><b>Date: </b></span><span style="font-family:-webkit-system-font,'Helvetica Neue',Helvetica,sans-serif">13 January 2016 at 16:46:09 GMT+1<br></span></div><div style="margin:0px"><span style="font-family:-webkit-system-font,'Helvetica Neue',Helvetica,sans-serif;color:rgb(0,0,0)"><b>To: </b></span><span style="font-family:-webkit-system-font,'Helvetica Neue',Helvetica,sans-serif">FieldTrip discussion list <<a href="mailto:fieldtrip@science.ru.nl" target="_blank">fieldtrip@science.ru.nl</a>><br></span></div><br><div><div style="word-wrap:break-word">Dear Lorenzo and others,<div>I’ve just looked into this, can reproduce the issue (same result with two different conditions/activity-baseline) </div><div><br></div><div>The issue arises because power is calculated based on the filter and the covariance of the input data (following VanVeen or a slight change for precomputed filters), yet in the example below no covariance is precomputed for activity/baseline timelock structures (only for the common dataset) and in that case fieldtrip creates an identity matrix for both activity and baseline (around line 713 in ft_sourceanalysis). </div><div>there is actually a warning about this, yet just from this warning (No covariance matrix found - will assume identity covariance matrix (mininum-norm solution)) it might to hard to get that this explains the results:</div><div><br></div><div>in essence from what I understand, the input data is ignored in the formula (for those interested this is line 278 in beamformer_lcmv) to compute the time series power, because the covariance is an identity matrix, and only the filter determines what ends up in the .pow field. and as the filter is the same for activity and baseline, the difference between the .pow output is zero.</div><div><br></div><div>now, computing covariances for the to-be-beamed segments (add a cfg.covariance = ‘yes’ to the timelock step for baseline and activity in the example) produces different power values (just tested with a simple auditory ERF dataset). </div><div><br></div><div>I suppose this is desired behavior (the identity matrix covariance), otherwise I would suggest to produce an error. </div><div><br></div><div>how well the ERF/timeseries is reconstructed of course depends on the data (time window) you use to create the filters. still it seems to me using the .mom field or creating virtual sensors yields better (in a sense of more focused) results. I still wonder why virtual sensors/.mom averages and .pow results are quite different, maybe one of the more knowledgeable ft developers could comment on at some point, but this might exceed the limit of this list…</div><div><br></div><div>cheers</div><div>philipp </div><div><br><div><blockquote type="cite"><div>On 12 Jan 2016, at 15:46, Lorenzo Magazzini <<a href="mailto:lorenzomagazzini@gmail.com" target="_blank">lorenzomagazzini@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><div>Hi,<br></div><div><br></div><div>I hope someone can help me to understand the use of the lcmv beamformer, because either I am using it incorrectly, or I misunderstood the meaning of its output.</div><div><br></div><div>I am trying to get source-level power estimates of 'baseline' and 'active' time-windows. I first compute a common filter, and then apply it separately to the two conditions. I thought the power estimates would be stored, voxel-wise, in the '.avg.pow' field of the ft_sourceanalysis output. However, the values I get in the '.pow' field for the analysis of 'baseline' and 'active' windows are identical. Furthermore, the '.pow' values are identical to the '.noise' values when using <font face="monospace, monospace">cfg.projectnoise = 'yes';</font>.</div><div><br></div><div>I have checked if the sensor-level data that passed on to ft_sourceanalysis is different between baseline and active - it is.</div><div><br></div><div>Also, if I do the following...</div><div>1. reconstruct virtual sensors by applying the common filter separately to baseline and active, </div><div>2. average the single-trial (virtual sensor) power estimates, </div><div>3. replace the '.pow' value for each voxel, </div><div>...then the contrast between baseline and active is correct.</div><div><br></div><div>Can anyone please help me figure out what I'm doing wrong here? Below I copied part of the code.</div><div><br></div><div>Many thanks in advance!</div><div><br></div><div>Lorenzo</div><div><br></div><div><br></div><div><div><font face="monospace, monospace">%compute the leadfield</font></div><div><font face="monospace, monospace">cfg = [];</font></div><div><font face="monospace, monospace">cfg.channel = {'MEG'};</font></div><div><font face="monospace, monospace">cfg.grid = sourcemodel;</font></div><div><font face="monospace, monospace">cfg.vol = hdm;</font></div><div><font face="monospace, monospace">cfg.grad = grad;</font></div><div><font face="monospace, monospace">cfg.normalize = 'yes';</font></div><div><font face="monospace, monospace">leadfield = ft_prepare_leadfield(cfg);</font></div></div><div><br></div><div><font face="monospace, monospace">%compute covariance matrix</font></div><div><div><font face="monospace, monospace">cfg = [];</font></div><div><font face="monospace, monospace">cfg.channel = {'MEG'};</font></div><div><font face="monospace, monospace">cfg.removemean = 'no';</font></div><div><font face="monospace, monospace">cfg.covariance = 'yes';</font></div><div><font face="monospace, monospace">cfg.covariancewindow = [-1.5 1.5];</font></div><div><font face="monospace, monospace">tlck = ft_timelockanalysis(cfg, data);</font></div></div><div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace">%get the common spatial filter</font></div><div><font face="monospace, monospace">cfg = [];</font></div><div><font face="monospace, monospace">cfg.method = 'lcmv';</font></div><div><font face="monospace, monospace">cfg.grid = leadfield;</font></div><div><font face="monospace, monospace">cfg.vol = hdm;</font></div><div><font face="monospace, monospace">cfg.grad = grad;</font></div><div><font face="monospace, monospace">cfg.lcmv.fixedori = 'yes';</font></div><div><font face="monospace, monospace">cfg.lcmv.keepfilter = 'yes';</font></div><div><font face="monospace, monospace">cfg.lcmv.projectnoise = 'yes';</font></div><div><font face="monospace, monospace">cfg.lcmv.lambda = '5%';</font></div><div><font face="monospace, monospace">src = ft_sourceanalysis(cfg, tlck);</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">%store the filter</font></div><div><font face="monospace, monospace">wts = src.avg.filter;</font></div></div><div><br></div><div><div><font face="monospace, monospace">%separate baseline and active windows of bandpass-filtered data</font></div><div><font face="monospace, monospace">cfg = [];</font></div><div><font face="monospace, monospace">cfg.toilim = [-1.5 -0.3];</font></div><div><font face="monospace, monospace">data_bsln = ft_redefinetrial(cfg, data);</font></div><div><font face="monospace, monospace">cfg = [];</font></div><div><font face="monospace, monospace">cfg.toilim = [0.3 1.5];</font></div><div><font face="monospace, monospace">data_actv = ft_redefinetrial(cfg, data);</font></div></div><div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace">%timelock analysis of baseline and active</font></div><div><font face="monospace, monospace">cfg = [];</font></div><div><font face="monospace, monospace">cfg.channel = {'MEG'};</font></div><div><font face="monospace, monospace">cfg.keeptrials = 'yes';</font></div><div><font face="monospace, monospace">tlck_bsln = ft_timelockanalysis(cfg, data_bsln);</font></div><div><font face="monospace, monospace">tlck_actv = ft_timelockanalysis(cfg, data_actv);</font></div></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">%get source-power estimates of bsln and actv separately using the pre-computed common filter (wts)</font></div><div><div><font face="monospace, monospace">cfg = [];</font></div><div><font face="monospace, monospace">cfg.method = 'lcmv';</font></div><div><font face="monospace, monospace">cfg.vol = hdm;</font></div><div><font face="monospace, monospace">cfg.grid = leadfield; </font></div><div><font face="monospace, monospace">cfg.grid.filter = wts;</font></div><div><font face="monospace, monospace">% cfg.keepfilter = 'no';</font></div><div><font face="monospace, monospace">cfg.lcmv.fixedori = 'yes';</font></div><div><font face="monospace, monospace">cfg.projectnoise = 'yes';</font></div><div><font face="monospace, monospace">cfg.lambda = '5%';</font></div><div><font face="monospace, monospace">cfg.keeptrials = 'yes';</font></div></div><div><div><font face="monospace, monospace">src_bsln = ft_sourceanalysis(cfg, tlck_bsln);</font></div></div><div><font face="monospace, monospace">src_actv = ft_sourceanalysis(cfg, tlck_actv);</font><br></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><br></font></div></div>
_______________________________________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br><a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></div></blockquote></div><br></div></div></div></blockquote></div><br></div></div></blockquote></div></div></div>