mne-tools / mne-tools/mne-python

typerror in make_dics when using the csd as input

Open
#8,678 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

BUG
Dominant language
Python
Stars
3.5k
Forks
1.6k
Avg merge
1d 6h
Merged PRs (30d)
100

Description

Describe the bug

typerror in make_dics when using the csd as input. The function make_dics give an error when the csd is given as input despite being computed with the mne csd_multitaper function

Steps to reproduce
csd_pooled=csd_multitaper(poolEpochs , fmin=21, fmax=22, bandwidth=10, n_jobs=1)
filters1 = make_dics(info=info, forward=fwd, csd=csd_pooled, reg=reg,reduce_rank=True,
                      pick_ori=None, real_filter=True,normalize_fwd=False,inversion='matrix', weight_norm=None) 
Expected results

filters weights

Actual results
File "/data/home1/epinzuti/anaconda3/lib/python3.7/site-packages/mne/beamformer/_dics.py", line 174, in make_dics
    info, fwd, csd = equalize_channels([info, forward, csd])

  File "<decorator-gen-31>", line 24, in equalize_channels

  File "/data/home1/epinzuti/anaconda3/lib/python3.7/site-packages/mne/channels/channels.py", line 148, in equalize_channels
    allowed_types_str)

  File "/data/home1/epinzuti/anaconda3/lib/python3.7/site-packages/mne/utils/check.py", line 389, in _validate_type
    % (item_name, type_name, type(item),))

TypeError: Instances to be modified must be an instance of Raw, Epochs, Evoked, TFR, Forward, Covariance, CrossSpectralDensity or Info, got <class 'mne.time_frequency.csd.CrossSpectralDensity'> instead

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproducer using csd_multitaper and make_dics, then inspect mne/beamformer/_dics.py where make_dics calls equalize_channels. Confirm why the CrossSpectralDensity instance is rejected and verify that the call completes and returns filter weights without the TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.