Hey all!
I want to save my epochs on a disk, which worked fine.
However, when I try to reload the epochs I get the following error: ‘No EEG channel found. Cannot reject based on EEG.’
This is my code:
#define epoch
epochs = mne.Epochs(raw_filtered_notch_two, events_final, tmin=-0.1, tmax=1,
reject=reject_criteria_rough, decim = decim, baseline = None, preload=True, event_id = event_dict) #event_id = event_dict)
#apply ICA
ica = mne.preprocessing.ICA(n_components=0.99, max_iter='auto', method = 'infomax', random_state=97).fit(epochs)
ica.apply(epochs, exclude = eog_indices)
#Baseline correct epoch
inteval = (-0.1, 0)
epochs_bc = epochs.apply_baseline(inteval)
#convert Current Density
epochs_bc_csd = mne.preprocessing.compute_current_source_density(epochs_bc)
#save all epochs
epochs_bc_csd.save('epoch_' + participant_id + '_' + condition + '-epo.fif', overwrite= True)
When I try to load the epochs, I use:
epochs_from_file = mne.read_epochs('epoch_' + participant_id + '_' + condition + '-epo.fif', preload = True)
The error I get:
Reading /home/c12169374/EEG DATA/jpdoy/epoch/object/epoch_jpdoy_object-epo.fif.gz ...
Found the data of interest:
t = -99.61 ... 1000.00 ms
0 CTF compensation matrices available
0 bad epochs dropped
Not setting metadata
181 matching events found
No baseline correction applied
Traceback (most recent call last):
File "/home/c12169374/EEG script/Preprocessing_script", line 317, in <module>
epochs_from_file = mne.read_epochs('epoch_' + participant_id + '_' + condition + '-epo.fif.gz', preload = True)
File "<decorator-gen-259>", line 12, in read_epochs
File "/home/c12169374/anaconda3/lib/python3.9/site-packages/mne/epochs.py", line 3187, in read_epochs
return EpochsFIF(fname, proj, preload, verbose)
File "<decorator-gen-260>", line 12, in __init__
File "/home/c12169374/anaconda3/lib/python3.9/site-packages/mne/epochs.py", line 3305, in __init__
super(EpochsFIF, self).__init__(
File "<decorator-gen-242>", line 12, in __init__
File "/home/c12169374/anaconda3/lib/python3.9/site-packages/mne/epochs.py", line 569, in __init__
self._reject_setup(reject, flat)
File "/home/c12169374/anaconda3/lib/python3.9/site-packages/mne/epochs.py", line 773, in _reject_setup
raise ValueError("No %s channel found. Cannot reject based on "
ValueError: No EEG channel found. Cannot reject based on EEG.
Any advice?