RuntimeError: No digitization points found.

Hi guys,

I’m newbie to mne library. I encountered the above error while trying to find bad channels in my EEG file, how can I solve it?

My code:

import os
import mne
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

raw = mne.io.read_raw_edf("/.edf", preload=True)
ten_twenty_montage = mne.channels.make_standard_montage('standard_1020')

print(ten_twenty_montage)
raw.filter(1,15)
ica = mne.preprocessing.ICA(n_components=15, random_state=42)
ica.fit(raw.copy().filter(4,15))
ica.plot_components(outlines="skirt")   # <------ I got error from this code.

what is the error message?

do you have channel locations in your raw data?

Alex

Making the montage is one step, but you should also add it to your raw data!
Once you have the variable containing the montage, in this case, ten_twenty_montage, use raw.set_montage(ten_twenty_montage) to apply it to your raw data.

The error you get is due to ica.plot_components trying to plot topographic maps, which requires the channel locations (montage), which are absent from your raw data.

How do I add the channel locations to my raw data ? with the EEGLAB app.? Thanx @mscheltienne :blush:

the title is about the error I’m getting and i guess ı don’t have channel locs. :smiling_face_with_tear: Thanx @agramfort

As I wrote, you can add them in MNE. In the code snippet you provide, you are creating the montage (contains the channel locations) with mne.channels.make_standard_montage('standard_1020'). You just need to add them to your raw data with:

raw.set_montage(ten_twenty_montage)

1 Like

I got this error: ValueError: DigMontage is only a subset of info. There are 19 channel positions not present in the DigMontage. The required channels are:

[‘EEG Fp1-Ref’, ‘EEG Fp2-Ref’, ‘EEG F3-Ref’, ‘EEG F4-Ref’, ‘EEG C3-Ref’, ‘EEG C4-Ref’, ‘EEG P3-Ref’, ‘EEG P4-Ref’, ‘EEG O1-Ref’, ‘EEG O2-Ref’, ‘EEG F7-Ref’, ‘EEG F8-Ref’, ‘EEG T3-Ref’, ‘EEG T4-Ref’, ‘EEG T5-Ref’, ‘EEG T6-Ref’, ‘EEG Fz-Ref’, ‘EEG A1-Ref’, ‘EEG A2-Ref’].

Consider using 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.

and i found that @agramfort answered this questions in another topic he said " default montage requires your channels to be called ‘Fp1’ and not 'EEG
Fp1-LE’
Now i try to how to fix this issue :face_holding_back_tears:
One problem is solved, another problem begins. programmers’ sad truth

1 Like

You can find the labels expected by the standard montage in those files:

I guess this could be better documented. Alternatively, you can create a montage with your channels names using DigMontage.

Thanks to you I finally made it. many thanks :smiling_face: Mathieu
Now it s time to understand signal process part :laughing: get excited already

Ipek

1 Like

Hi, I have the exactly same issue now, my channel name is also like yours, did you find any solution?

Hello @Min, and welcome to the forum!

What you will want to do is, for each channel name, remove the EEG prefix and the -Ref suffix.

For that, you can use the rename_channels() method.

You should write a small function that converts the existing channel name into the new one. This function can then be used by rename_channels.

Example:

def map_channel_name(old_name):
    """Clean a channel name."""
    new_name = old_name.replace('EEG ', '').replace('-Ref', '')
    return new_name


raw.rename_channels(mapping=map_channel_name)
raw.set_montage('easycap-M1')

This code is untested but should give you an idea how to do it!

Best wishes,
Richard

Hello Richard,
Many thanks!!!
I just try the method you mentioned, there is no error now, this really helpful!!!

just past my code here in case other people may need

eeg_raw = mne.io.read_raw_edf('Mm_Tt_2022-12-28_13-08-03_Segment_0.edf')
print(eeg_raw)
print('\n')
print(eeg_raw.info)

# check channel names
ch_names = eeg_raw.ch_names
print(ch_names)
print(len(ch_names))
print('\n')

eeg_raw.load_data()

# apply the method, my original channel name is 'EEG Fp1-CPz'
def map_channel_name(old_name):

    """Clean a channel name."""

    new_name = old_name.replace('EEG ', '').replace('-CPz', '')

    return new_name

eeg_raw.rename_channels(mapping=map_channel_name)
eeg_raw.set_montage('standard_1020')

ch_names = eeg_raw.ch_names
print(ch_names)

# see raw data wave
# eeg_raw.plot()

# power line artifacts are easiest to see on plots of the spectrum
# eeg_raw.plot_psd(fmax=250)

# info = mne.create_info(31, sfreq=128)
# print(info)

# To filter the noise and remove the artifacts process the data with a bandpass filter between 1 Hz and 75 Hz
eeg_band_pass = eeg_raw.copy().filter(l_freq=1, h_freq=75)
# eeg_band_pass.plot()

# downsample the raw data
eeg_downsampled = eeg_band_pass.copy().resample(128)
# eeg_downsampled.plot()

# get the data matrix
data_matrix = eeg_downsampled.get_data()
print(data_matrix.shape)

eog_epochs = create_eog_epochs(eeg_downsampled, ch_name=ch_names, baseline=(-0.5, -0.2))    #baseline=None
eog_epochs.plot_image(combine='mean')
eog_epochs.average().plot_joint()       #### here is what I got the error
1 Like

I’m glad it’s working now! And thanks for sharing your solution, this will sure be helpful to others!

I reformatted the code as a code block so it’s easier to read. The way to do this is to select the code and then click on the “Preformatted text” button in the toolbar here.

In any case, thanks again!

Best wishes,
Richard