Error of mne.beamformer.make_dics

If you have a question or issue with MNE-Python, please include the following info:

  • MNE-Python version: 0.22.0
  • operating system: Windows 10

Hi,
My code of using the mne.beamformer.make_dics function is
filters = make_dics(info=info, forward=fwd,
csd=csds_whole_sentence[condition].mean(fmin,fmax),
reg=0.05,
pick_ori=‘max-power’,
reduce_rank=True,
rank={‘eeg’: 46})

I got the following output and an error message:
Identifying common channels …
Computing inverse operator with 60 channels.
60 out of 60 channels remain after picking
Selected 60 channels
Creating the depth weighting matrix…
Whitening the forward solution.
Created an SSP operator (subspace dimension = 1)
Computing rank from covariance with rank={‘eeg’: 46}
Setting small EEG eigenvalues to zero (without PCA)
Creating the source covariance matrix
Adjusting source covariance matrix.
Computing rank from covariance with rank={‘eeg’: 46}
Computing rank from covariance with rank={‘eeg’: 46}
Computing rank from covariance with rank={‘eeg’: 46}
Computing rank from covariance with rank={‘eeg’: 46}
Computing rank from covariance with rank={‘eeg’: 46}
Computing DICS spatial filters…
computing DICS spatial filter at 6.0Hz (1/5)

ValueError Traceback (most recent call last)
in
1 # Compute the DICS spatial filters using the CSDs from SS for all frequency bands.
----> 2 filters = make_dics(info=info, forward=fwd,
3 csd=csds_whole_sentence[‘CS’].mean(fmin,fmax),
4 reg=0.05,
5 pick_ori=‘max-power’,reduce_rank=True,

in make_dics(info, forward, csd, reg, noise_csd, label, pick_ori, rank, weight_norm, reduce_rank, depth, real_filter, inversion, verbose)

~\anaconda3\envs\mne\lib\site-packages\mne\beamformer_dics.py in make_dics(failed resolving arguments)
221 # compute spatial filter
222 n_orient = 3 if is_free_ori else 1
→ 223 W, max_power_ori = _compute_beamformer(
224 G, Cm, reg, n_orient, weight_norm, pick_ori, reduce_rank,
225 rank=csd_int_rank[i], inversion=inversion, nn=nn,

~\anaconda3\envs\mne\lib\site-packages\mne\beamformer_compute_beamformer.py in _compute_beamformer(G, Cm, reg, n_orient, weight_norm, pick_ori, reduce_rank, rank, inversion, nn, orient_std, whitener)
187
188 # Whiten the data covariance
→ 189 Cm = whitener @ Cm @ whitener.T.conj()
190 # Restore to properly Hermitian as large whitening coefs can have bad
191 # rounding error

ValueError: matmul: Input operand 1 does not have enough dimensions (has 0, gufunc core with signature (n?,k),(k,m?)->(n?,m?) requires 1)

I don’t know how to debug this problem.

Thanks,
Yanyu Xiong

:point_right: :point_right: :point_right: Please edit or remove the above text before submitting your posting. :point_left: :point_left: :point_left:

Hello @Yanyu, the formatting of your code and output is a bit off :slight_smile: What you can do to fix this is, edit your post, select the code and output, and click on the “Preformatted text” button in the toolbar. This will make it much more readable. Best wishes!

I’m not a beamformer expert, but maybe the problem is that you’re passing this:

as the csd parameter to make_dics(). csd should be a cross-spectral density object, maybe you’re passing in something that’s not the right kind of object or has the wrong dimensions?

Yes, I agree with @drammock: from what you posted, the CSD object (and the mean operation) seems the most probable cause. Does it work if you pass a CSD directly?