You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I also believe that an error should be generated at time of instantiation of CSP, not when CSP.fit ist being called.
Have a look at rank in the MWE below 👇
# %%# Importsimportmneimportnumpyasnp# load datasample_path=mne.datasets.sample.data_path() /"MEG"/"sample"raw=mne.io.read_raw(sample_path/"sample_audvis_raw.fif")
events=mne.read_events(sample_path/"sample_audvis_raw-eve.fif")
# epochs of EEGraw=raw.pick("eeg")
epochs=mne.Epochs(raw, events[np.isin(events[:, -1], [1, 2, 3, 4])])
epochs# %%# WorksCSP=mne.decoding.CSP(n_components=4, rank=dict(eeg=len(epochs.ch_names)))
CSP.fit(epochs.get_data(), epochs.events[:, -1])
# %%# WorksCSP=mne.decoding.CSP(n_components=4, rank=None)
CSP.fit(epochs.get_data(), epochs.events[:, -1])
# %%# Fails but should work according to API docs# TypeError: rank must be an instance of dict or None, got <class 'str'> instead.CSP=mne.decoding.CSP(n_components=4, rank="info")
CSP.fit(epochs.get_data(), epochs.events[:, -1])
# %%# Fails but should work according to API docs# TypeError: rank must be an instance of dict or None, got <class 'str'> instead.CSP=mne.decoding.CSP(n_components=4, rank="full")
CSP.fit(epochs.get_data(), epochs.events[:, -1])
# %%# Fails but with uninformative message# TypeError: rank must be an instance of dict or None, got <class 'str'> instead.CSP=mne.decoding.CSP(n_components=4, rank="foo")
CSP.fit(epochs.get_data(), epochs.events[:, -1])
First reported in https://mne.discourse.group/t/the-api-reference-of-csp-needs-updata/9018?u=sappelhoff
Link to CSP API docs: https://mne.tools/dev/generated/mne.decoding.CSP.html
I also believe that an error should be generated at time of instantiation of
CSP
, not whenCSP.fit
ist being called.Have a look at
rank
in the MWE below 👇mne sys_info
👇cc @tsolesc @Prarthita11
The text was updated successfully, but these errors were encountered: