[FieldTrip] Source Reconstruction - Leadfield has NaNs

Emilie Caspar ecaspar at ulb.ac.be
Thu Dec 9 11:15:47 CET 2021


Dear Fieldtripper, 

I am currently trying to compute a source reconstruction on my EEG data (Biosemi, 64 electrodes).

I use the following code:

load Subject01_sourcemodel_15684;
headmodel = ft_read_headmodel('headmodel/standard_bem.mat');
electr_pos=ft_read_sens('Biosemi-Cap64.sfp’);

load('GA_GroupPerpetrators_Parents_Neutral_DOUL.mat')

cfg = [];
cfg.method = 'interactive';
cfg.elec = electr_pos;
cfg.headshape = headmodel.bnd(1); %1 = skin
elec = ft_electroderealign(cfg, electr_pos);

cfg         = [];
cfg.elec = elec;   % sensor information
cfg.channel = elec.label;%;  % the used channels
cfg.sourcemodel    = sourcemodel;   % source points
cfg.headmodel = headmodel;   % volume conduction model
cfg.singleshell.batchsize = 5000; % speeds up the computation
leadfield   = ft_prepare_leadfield(cfg);
%%
cfg               = [];
cfg.method        = 'mne';
cfg.elec = elec;
cfg.grid          = leadfield;
cfg.headmodel     = headmodel;
cfg.mne.prewhiten = 'yes';
cfg.mne.lambda    = 3;
cfg.mne.scalesourcecov = 'yes';
 
source_GA_GroupPerpetrators_Parents_Neutral_DOUL = ft_sourceanalysis(cfg, GA_GroupPerpetrators_Parents_Neutral_DOUL);

However, I got the following error when computing the ft_sourceanalysis:

Error using svd
Input to SVD must not contain NaN or Inf.

Error in beamformer_lcmv>pinv (line 415)
  [U,S,V] = svd(A,0);

Error in beamformer_lcmv (line 297)
    filt = pinv(lf' * invCy * lf) * lf' * invCy;              % van Veen eqn.
    23, use PINV/SVD to cover rank deficient leadfield

Error in ft_sourceanalysis (line 950)
      dip(i) = beamformer_lcmv(grid, sens, headmodel, squeeze_avg, squeeze_Cy,
      optarg{:});

I checked in all the datafiles I use, and the only NaN I found are in the leadfield.leadfield but all the previous steps appear to be correct and contain the correct electrode locations, data, covariance matrix etc.

I am thus not sure how to solve the problem and why my leadfield.leadfield has NaN (or even if the problem comes from there).

Thank you in advance for your help!

Emilie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20211209/79c6daf2/attachment.htm>


More information about the fieldtrip mailing list