Closed Serendipityzzz closed 1 week ago
Hello! 👋 Thanks for opening your first issue here! ❤️ We will try to get back to you soon. 🚴🏽♂️
Artificial ECG requires MEG channels. We should update this error message to be clearer that this is the case
Thx! I've solved the problem. And I wonder that after we calculate the ecg/eog projection with compute_proj_ecg/eog, what should we do to clean the raw data with these peojections. Maybe I should use raw.apply_proj() to rroject raw data onto a hyperplane orthogonal to noise?
which gose like “”“ projs_eog, events_eog = mne.preprocessing.compute_proj_eog(raw,ch_name="EOG",reject=None) raw.add_proj(projs_eog) raw.apply_proj() ”“”
Is it right?
This is venturing into usage territory rather than code bug fix territory, please open a mne.discourse.group forum post for usage questions!
Description of the problem
Hi there,
I tried to run the tutorial Repairing artifacts with SSP with my own data.
I have problems with using function create_ecg_epochs, compute_proj_ecg. I tried both EEG and MEG data, and the bug goes like: "Produces a ValueError: Unable to generate artificial ECG channel"
I want to run ssp before ica, since ica is not enough for me to repair ecg/eog artifacts, but I fail to compute the projections with SSP. Any tips or hints will be appreciated - Thx!
Wentao
Steps to reproduce
Link to data
No response
Expected results
Created an SSP operator (subspace dimension = 3) 3 projection items activated Using data from preloaded Raw for 58 events and 61 original time points ... 0 bad epochs dropped Adding projection: planar--0.200-0.400-PCA-01 Adding projection: axial--0.200-0.400-PCA-01 Adding projection: eeg--0.200-0.400-PCA-01
Actual results
Traceback (most recent call last): File "F:\PKU2\Research2\Yunzhe_Liu\Code\eeg2label\preprocess\meg\session.py", line 71, in
data = preprocess_session(path_meg, path_output)
File "F:\PKU2\Research2\Yunzhe_Liu\Code\eeg2label\preprocess\meg\session.py", line 56, in preprocess_session
ecg_evoked = mne.preprocessing.create_ecg_epochs(data).average()
File "", line 12, in create_ecg_epochs
File "E:\Anaconda3\envs\tensorflow\lib\site-packages\mne\preprocessing\ecg.py", line 346, in create_ecgepochs
events, , _, ecg = find_ecg_events(
File "", line 12, in find_ecg_events
File "E:\Anaconda3\envs\tensorflow\lib\site-packages\mne\preprocessing\ecg.py", line 194, in find_ecgevents
ecg, = _make_ecg(raw, start=None, stop=None)
File "", line 12, in _make_ecg
File "E:\Anaconda3\envs\tensorflow\lib\site-packages\mne\preprocessing\ecg.py", line 383, in _make_ecg
raise ValueError('Unable to generate artificial ECG channel')
ValueError: Unable to generate artificial ECG channel
Additional information
Platform: Windows-10-10.0.19044-SP0 Python: 3.9.13 (main, Oct 13 2022, 21:23:06) [MSC v.1916 64 bit (AMD64)] Executable: E:\Anaconda3\envs\tensorflow\python.exe CPU: AMD64 Family 23 Model 96 Stepping 1, AuthenticAMD: 12 cores Memory: 15.4 GB
mne: 1.3.0 numpy: 1.24.1 {MKL 2022.1-Product with 6 threads} scipy: 1.10.0 matplotlib: 3.6.3 {backend=QtAgg}
sklearn: 1.2.0 numba: Not found nibabel: 5.0.0 nilearn: 0.10.0 dipy: 1.6.0 openmeeg: Not found cupy: Not found pandas: 1.5.2 pyvista: 0.37.0 {OpenGL could not be initialized} pyvistaqt: 0.9.0 ipyvtklink: 0.2.3 vtk: Not found qtpy: 2.3.0 {PyQt5=5.15.2} ipympl: Not found pyqtgraph: 0.13.1 pooch: v1.6.0
mne_bids: Not found mne_nirs: Not found mne_features: Not found mne_qt_browser: 0.4.0 mne_connectivity: Not found mne_icalabel: 0.4