I was following your documentation and I have noticed my main problem. My problem is with the channels and montage type. My dataset is in the standard-1020 montage but I am still getting following error:
{
"name": "ValueError",
"message": "DigMontage is only a subset of info. There are 23 channel positions not present in the DigMontage. The channels missing from the montage are:
['FP1-F7', 'F7-T7', 'T7-P7', 'P7-O1', 'FP1-F3', 'F3-C3', 'C3-P3', 'P3-O1', 'FP2-F4', 'F4-C4', 'C4-P4', 'P4-O2', 'FP2-F8', 'F8-T8', 'T8-P8-0', 'P8-O2', 'FZ-CZ', 'CZ-PZ', 'P7-T7', 'T7-FT9', 'FT9-FT10', 'FT10-T8', 'T8-P8-1'].
Consider using inst.rename_channels to match the montage nomenclature, or inst.set_channel_types if these are not EEG channels, or use the on_missing parameter if the channel positions are allowed to be unknown in your analyses.",
"stack": "---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
File d:\\BELGELER 2021-2022\\AybĂĽke\\tĂĽbitak\\software\\icca.py:15
13 info = mne.create_info(ch_names, 256, ch_types=[\"eeg\"]*23 )
14 raw = mne.io.RawArray(data, info)
---> 15 raw.set_montage(\"standard_1020\")
17 raw2 = raw.copy()
18 raw2.filter(l_freq=1, h_freq=None)
File <decorator-gen-22>:12, in set_montage(self, montage, match_case, match_alias, on_missing, verbose)
File ~\\AppData\\Roaming\\Python\\Python311\\site-packages\\mne\\_fiff\\meas_info.py:422, in MontageMixin.set_montage(self, montage, match_case, match_alias, on_missing, verbose)
419 from ..channels.montage import _set_montage
421 info = self if isinstance(self, Info) else self.info
--> 422 _set_montage(info, montage, match_case, match_alias, on_missing)
423 return self
File ~\\AppData\\Roaming\\Python\\Python311\\site-packages\\mne\\channels\\montage.py:1250, in _set_montage(***failed resolving arguments***)
1239 are_is = \"are\" if pl else \"is\"
1240 missing_coord_msg = (
1241 f\"DigMontage is only a subset of info. There {are_is} \"
1242 f\"{len(missing)} channel position{pl} not present in the \"
(...)
1248 f\"position{pl} {are_is} allowed to be unknown in your analyses.\"
1249 )
-> 1250 _on_missing(on_missing, missing_coord_msg)
1252 # set ch coordinates and names from digmontage or nan coords
1253 for ii in missing:
File ~\\AppData\\Roaming\\Python\\Python311\\site-packages\\mne\\utils\\check.py:1191, in _on_missing(on_missing, msg, name, error_klass)
1189 on_missing = \"warn\" if on_missing == \"warning\" else on_missing
1190 if on_missing == \"raise\":
-> 1191 raise error_klass(msg)
1192 elif on_missing == \"warn\":
1193 warn(msg)
ValueError: DigMontage is only a subset of info. There are 23 channel positions not present in the DigMontage. The channels missing from the montage are:
['FP1-F7', 'F7-T7', 'T7-P7', 'P7-O1', 'FP1-F3', 'F3-C3', 'C3-P3', 'P3-O1', 'FP2-F4', 'F4-C4', 'C4-P4', 'P4-O2', 'FP2-F8', 'F8-T8', 'T8-P8-0', 'P8-O2', 'FZ-CZ', 'CZ-PZ', 'P7-T7', 'T7-FT9', 'FT9-FT10', 'FT10-T8', 'T8-P8-1'].
Consider using inst.rename_channels to match the montage nomenclature, or inst.set_channel_types if these are not EEG channels, or use the on_missing parameter if the channel positions are allowed to be unknown in your analyses."
}
Here is my code so far:
# %%
import mne
import os
import matplotlib.pyplot as plt
data_path = "/datapath/software/dataset/chb01/chb01_03.edf"
eeg = mne.io.read_raw_edf (data_path, preload=True)
ch_names = eeg.ch_names
data = eeg.get_data()
info = mne.create_info(ch_names, 256, ch_types=["eeg"]*23 )
raw = mne.io.RawArray(data, info)
raw.set_montage("standard_1020")
raw2 = raw.copy()
raw2.filter(l_freq=1, h_freq=None)
ica = mne.preprocessing.ICA(
method = "picard",
fit_params = {"extended": True, "ortho": False},
random_state = 1
)
ica.fit(raw2)
ica.plot_components(inst=raw2, picks = range(23))