Setting up channel locations

External Email - Use Caution

Hi,

I am struggling to setting up channel locations...
I'd like to know if there is a way to set up automatically standardize
channel locations from the channel names since in my raw data file I only
have the names. I am looking for a way which does not impply to set up a
new montage (which I tried but it did not work as some channels resulted to
be overlapped and I think is not the proper way to do it) or load the
positions contained in a file.
The result of the method I am looking for, I guess would add the locations
to the 'dig' (digitization points) option in raw.info if I am right? This
is the part which gives me error for all the functions I use (error:
'digitization points not found')

Kind regards and thank you for the help,

Lidia.

External Email - Use Caution

Hi!

Have you tried

raw.set_montage("standard_1020")

You can get all montages by

mne.channels.get_builtin_montages()

Use the montage that contains all (or at least most) of your channel names. If you have exotic names, maybe you can map them to names contained in one of the standard montages.

Clemens

External Email - Use Caution

Thanks for your fast answer.

This I've already tried several times but I tried again in case, but still
is not working...

when I want to do:

- ica.plot_components() I get the following error: arrays used as indices
must be of interger or (boolean) type.

and when trying:

- ica.plot_properties(raw) I get that some electrodes have overlapping
positions even though the montage fits only 24 channels out of 53 channels
that are contained in raw.info['ch_names'] and I listed in ['bads'] 28 out
of the 53 that I do not want to use.

The ones displayed in the error as overlapped are EOGl, EOGr, EOGV, EMGChin
from which EMGChin is the only one contained in 'bads'.

The code I am using is the following one:

rawB0939=mne.io.read_raw_edf('B0939.edf',preload='data_preload')
rawB0939_copy=rawB0939.copy()

rawB0939.info['bads']=['AUX','ECG','Lage','Licht','Akku','Beweg.','EOGl:M1','EOGl:M2','EOGr:M1','C3:M2','C4:M1','Fz:M1','Oz:M1','EOGr:M2','F4:M1','O2:M1','F3:M2','O1:M2','Fz:M2','Oz:M2','Fp1:M1','Fp2:M1','T3:M1','T4:M1','P3:M1','P4:M1','F3:M1','STI
014']
rawB0939_copy.info['bads']=['AUX','ECG','Lage','Licht','Akku','Beweg.','EOGl:M1','EOGl:M2','EOGr:M1','C3:M2','C4:M1','Fz:M1','Oz:M1','EOGr:M2','F4:M1','O2:M1','F3:M2','O1:M2','Fz:M2','Oz:M2','Fp1:M1','Fp2:M1','T3:M1','T4:M1','P3:M1','P4:M1','F3:M1','STI
014']

rawB0939_copy.crop(tmin=4936,tmax=5300)
rawB0939_copy.plot()

# DOWNSAMPLING AND FILTERING CROPPED DATA #
rawB0939_copy.resample(100) # downsampling to 100 Hz ( performs LPF
followed by decimation)
rawB0939_copy.filter(l_freq=49.0,h_freq=3.0) # to perform ICA

# MONTAGE #
rawB0939_copy.set_montage('standard_1020') # 24 channels with positions
established

# ICA #
method='fastica'
ica=ICA(method=method)
print(ica)

ica.fit(rawB0939_copy)
print(ica)
ica_components=ica.get_components()

ica.plot_components(ica_components)
ica.plot_properties(rawB0939_copy)

Do you have some idea how to solve it? I am trying many things but I get
errors through all the ways.

Thanks a lot!

El mi?., 16 ene. 2019 a las 16:22, Brunner, Clemens (
clemens.brunner at uni-graz.at) (<clemens.brunner at uni-graz.at>) escribi?:

External Email - Use Caution

Ee

        External Email - Use Caution

Thanks for your fast answer.

This I've already tried several times but I tried again in case, but still
is not working...

when I want to do:

- ica.plot_components() I get the following error: arrays used as indices
must be of interger or (boolean) type.

and when trying:

- ica.plot_properties(raw) I get that some electrodes have overlapping
positions even though the montage fits only 24 channels out of 53 channels
that are contained in raw.info['ch_names'] and I listed in ['bads'] 28 out
of the 53 that I do not want to use.

The ones displayed in the error as overlapped are EOGl, EOGr, EOGV, EMGChin
from which EMGChin is the only one contained in 'bads'.

The code I am using is the following one:

rawB0939=mne.io.read_raw_edf('B0939.edf',preload='data_preload')
rawB0939_copy=rawB0939.copy()

rawB0939.info['bads']=['AUX','ECG','Lage','Licht','Akku','Beweg.','EOGl:M1','EOGl:M2','EOGr:M1','C3:M2','C4:M1','Fz:M1','Oz:M1','EOGr:M2','F4:M1','O2:M1','F3:M2','O1:M2','Fz:M2','Oz:M2','Fp1:M1','Fp2:M1','T3:M1','T4:M1','P3:M1','P4:M1','F3:M1','STI
014']
rawB0939_copy.info['bads']=['AUX','ECG','Lage','Licht','Akku','Beweg.','EOGl:M1','EOGl:M2','EOGr:M1','C3:M2','C4:M1','Fz:M1','Oz:M1','EOGr:M2','F4:M1','O2:M1','F3:M2','O1:M2','Fz:M2','Oz:M2','Fp1:M1','Fp2:M1','T3:M1','T4:M1','P3:M1','P4:M1','F3:M1','STI
014']

rawB0939_copy.crop(tmin=4936,tmax=5300)
rawB0939_copy.plot()

# DOWNSAMPLING AND FILTERING CROPPED DATA #
rawB0939_copy.resample(100) # downsampling to 100 Hz ( performs LPF
followed by decimation)
rawB0939_copy.filter(l_freq=49.0,h_freq=3.0) # to perform ICA

# MONTAGE #
rawB0939_copy.set_montage('standard_1020') # 24 channels with positions
established

# ICA #
method='fastica'
ica=ICA(method=method)
print(ica)

ica.fit(rawB0939_copy)
print(ica)
ica_components=ica.get_components()

ica.plot_components(ica_components)
ica.plot_properties(rawB0939_copy)

Do you have some idea how to solve it? I am trying many things but I get
errors through all the ways.

Thanks a lot!

El mi?., 16 ene. 2019 a las 16:22, Brunner, Clemens (
clemens.brunner at uni-graz.at) (<clemens.brunner at uni-graz.at>) escribi?:

External Email - Use Caution

did you mark all channels that don't have a position as non EEG
channels eg eog or misc?

see set_channel_types method.

HTH
Alex

External Email - Use Caution

Thank you!! Already working!! :slight_smile:

El jue., 17 ene. 2019 a las 15:21, Alexandre Gramfort (<
alexandre.gramfort at inria.fr>) escribi?: