runtime warning when combining csd_morlet() and make_dics()

Hello everyone,

I’m looking to do source localization on MEG data with a DICS beamformer. I’m computing a noise and data cross-spectral density matrix using csd_morlet(). When I use these as input to create the spatial filters with make_dics(), I get a runtime warning saying that “data covariance does not appear to be positive semidefinite, results will likely be incorrect”. I don’t get this warning at all when I use csd_multitaper() or csd_fourier() and only for a handful of participants. Has anyone encountered this warning before? How could I go about debugging?

I’ve tried a bunch of different settings, but this is my most recent code:

noise_csd = mne.time_frequency.csd_morlet(epochs = epochs,
                                                  frequencies = np.arange(13, 31, 1),
                                                  tmin = -0.2 + delay,
                                                  tmax = 0 + delay,
                                                  picks = None, 
                                                  n_cycles = 2,
                                                  use_fft = True,
                                                  decim = 1,
                                                  projs = None,
                                                  n_jobs = 8)
noise_csd = noise_csd.mean()

data_csd = mne.time_frequency.csd_morlet(epochs = epochs,
                                                  frequencies = frequencies,
                                                  tmin = 0 + delay,
                                                  tmax = 1 + delay,
                                                  picks = None, 
                                                  n_cycles = 2,
                                                  use_fft = True,
                                                  decim = 1,
                                                  projs = None,
                                                  n_jobs = -1)
data_csd = data_csd.mean()

filters = mne.beamformer.make_dics(info =, 
                                       forward = fwd, 
                                       csd = data_csd, 
                                       reg = 0.05, 
                                       noise_csd = noise_csd,  
                                       pick_ori = 'max-power', 
                                       rank = 'info', 
                                       weight_norm = 'unit-noise-gain', 
                                       reduce_rank = True, 
                                       depth = None, 
                                       real_filter = True, 
                                       inversion = 'matrix', 
                                       verbose = None)

MNE version: 1.3.0
MNE connectivity: 0.6.0
operating system: macOS Monterey 12.5.1


Maybe @britta-wstnr you have an idea?
The warning is issued here: mne-python/mne/beamformer/ at 3c101cdd88b1e83017190ae490654ed290785b94 · mne-tools/mne-python · GitHub


Hi @coderb,

the warning is most likely issued because either the data or (more likely in your case) the noise cross spectrum are ill-conditioned.

A few ideas:

  1. Have you tried running this without a noise CSD matrix? Do you need a noise CSD with your data? If you do not absolutely need it, I would leave it out.
  2. Have you plotted the CSD matrices? Do they look very different between the methods and between participants that run and do not run?
  3. How much data goes into the calculation of the CSD matrices and does that fit your frequencies of interest?

Hope this helps,