<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Jason,
<div class=""><br class="">
</div>
<div class="">Did you check whether the data variables tlckL, and tlckR make sense, as well as the leadfield?</div>
<div class=""><br class="">
</div>
<div class="">In particular for the leadfield, once there is any NaN in there - which may easily happen if something went wrong with the computation, e.g. through occasional dipoles being located outside the headmodel - those NaNs will spread through the whole
 matrix, and thus to the output, causing everything to be NaN.</div>
<div class=""><br class="">
</div>
<div class="">Another, more mundane, cause would be that ALL of your dipole positions are considered as ‘outside’ the volume conductor, which would explain that all ‘mom’s are empty, and all ‘pow’s are nan.</div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-mathijs</div>
<div class=""><br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 12 Jan 2021, at 23:40, Jason Leung <<a href="mailto:j59leung@gmail.com" class="">j59leung@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">Hi Fieldtrip community,<br class="">
<div class=""><br class="">
</div>
<div class="">I'm new to fieldtrip and am having difficulties trying to follow the
<a href="https://www.fieldtriptoolbox.org/tutorial/minimumnormestimate/" class="">
MNE tutorial</a> to do source analysis for EEG data. Similar to the tutorial, I did the following to compute my source using a precomputed leadfield:<br class="">
<br class="">
</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px" class="">
<div class=""><font color="#0000ff" class="">cfg               = [];</font></div>
<div class=""><font color="#0000ff" class=""><br class="">
</font></div>
<div class=""><font color="#0000ff" class="">cfg.sourcemodel   = sourcemodel_and_leadfield;</font></div>
<div class=""><font color="#0000ff" class="">cfg.headmodel     = headmodel;</font></div>
<div class=""><font color="#0000ff" class="">cfg.elec = elec_realigned;</font></div>
<div class=""><font color="#0000ff" class=""><br class="">
</font></div>
<div class=""><font color="#0000ff" class="">cfg.method        = 'mne';</font></div>
<div class=""><font color="#0000ff" class="">cfg.mne.prewhiten = 'yes';</font></div>
<div class=""><font color="#0000ff" class="">cfg.mne.lambda    = 3;</font></div>
<div class=""><font color="#0000ff" class="">cfg.mne.scalesourcecov = 'yes';</font></div>
<div class=""><font color="#0000ff" class=""><br class="">
</font></div>
<div class=""><font color="#0000ff" class="">sourceL = ft_sourceanalysis(cfg, tlckL);</font></div>
<div class=""><font color="#0000ff" class="">sourceR = ft_sourceanalysis(cfg, tlckR);</font></div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">Running the above give me the following output with no errors:</div>
<div class=""><br class="">
</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px" class="">
<div class=""><font color="#0000ff" class="">the input is timelock data with 64 channels and 2432 timebins</font></div>
<div class=""><font color="#0000ff" class="">the call to "ft_selectdata" took 0 seconds</font></div>
<div class=""><font color="#0000ff" class="">using precomputed leadfields</font></div>
<div class=""><font color="#0000ff" class="">the call to "ft_selectdata" took 0 seconds</font></div>
<div class=""><font color="#0000ff" class="">estimating current density distribution for repetition 1</font></div>
<div class=""><font color="#0000ff" class="">using precomputed leadfields</font></div>
<div class=""><font color="#0000ff" class="">computing the solution where the noise covariance is used for regularisation</font></div>
<div class=""><font color="#0000ff" class="">prewhitening the leadfields using the noise covariance</font></div>
<div class=""><font color="#0000ff" class="">scaling the source covariance</font></div>
<div class=""><font color="#0000ff" class="">The input data are real-valued, assuming sensor time-series: Computing the dipole moments</font></div>
<div class=""><font color="#0000ff" class="">the call to "ft_sourceanalysis" took 1 seconds</font></div>
<div class=""><font color="#0000ff" class="">the input is timelock data with 64 channels and 2432 timebins</font></div>
<div class=""><font color="#0000ff" class="">the call to "ft_selectdata" took 0 seconds</font></div>
<div class=""><font color="#0000ff" class="">using precomputed leadfields</font></div>
<div class=""><font color="#0000ff" class="">the call to "ft_selectdata" took 0 seconds</font></div>
<div class=""><font color="#0000ff" class="">estimating current density distribution for repetition 1</font></div>
<div class=""><font color="#0000ff" class="">using precomputed leadfields</font></div>
<div class=""><font color="#0000ff" class="">computing the solution where the noise covariance is used for regularisation</font></div>
<div class=""><font color="#0000ff" class="">prewhitening the leadfields using the noise covariance</font></div>
<div class=""><font color="#0000ff" class="">scaling the source covariance</font></div>
<div class=""><font color="#0000ff" class="">The input data are real-valued, assuming sensor time-series: Computing the dipole moments</font></div>
<div class=""><font color="#0000ff" class="">the call to "ft_sourceanalysis" took 1 seconds</font></div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">However, when I looked at the sourceL and sourceR variables, I can see that each cell in the sourceL.avg.mom and sourceL.avg.noisecov variables are empty, and sourceL.avg.pow is just full of NaNs.</div>
<div class=""><br class="">
</div>
<div class="">I would appreciate it if someone can give me some suggestions of what went wrong here. Thank you very much in advance!</div>
<div class=""><br class="">
</div>
<div class="">Jason<br class="">
<br class="">
</div>
<div class=""><br class="">
</div>
</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>
</body>
</html>