How can I include channel location info with Zeto dry EEG electrode edf file

Hello, currently I am using ‘plot_topo_customized.py’ in MNE example. I would like to load data from Zeto’s dry EEG electrode and plot PSD in topo map. I loaded edf file successfully and connected with MNE successfully, but I met an error message ‘No digitization points found.’ I think something wrong with the information of channel location. How can I include channel information in the code as follows?


import numpy as np
import matplotlib.pyplot as plt

import mne
from mne.viz import iter_topography
from mne import io
from mne.time_frequency import psd_welch
from mne.datasets import sample

print(__doc__)

raw = io.read_raw_edf('zhi7481.edf')
#raw.filter(1, 20, fir_design='firwin')

picks = mne.pick_types(raw.info, eeg=True, exclude=[])
tmin, tmax = 0, 4  # use the first 120s of data
fmin, fmax = 2, 20  # look at frequencies between 2 and 20Hz
n_fft = 2048  # the FFT size (n_fft). Ideally a power of 2
psds, freqs = psd_welch(raw, picks=picks, tmin=tmin, tmax=tmax,
                        fmin=fmin, fmax=fmax)
psds = 20 * np.log10(psds)  # scale to dB


def my_callback(ax, ch_idx):
    """
    This block of code is executed once you click on one of the channel axes
    in the plot. To work with the viz internals, this function should only take
    two parameters, the axis and the channel or data index.
    """
    ax.plot(freqs, psds[ch_idx], color='red')
    ax.set_xlabel('Frequency (Hz)')
    ax.set_ylabel('Power (dB)')


for ax, idx in iter_topography(raw.info,
                               fig_facecolor='white',
                               axis_facecolor='white',
                               axis_spinecolor='white',
                               on_pick=my_callback):
    ax.plot(psds[idx], color='red')

plt.gcf().suptitle('Power spectral densities')

Hi Kyu, I have allowed myself to edit your post to enable syntax highlighting for readability.
Could it be that you first have to set a montage? It is highly likely that the electrode layout is not stored inside your EDF file. Perhaps this tutorial can help you: Working with sensor locations — MNE 0.23.0 documentation

Best wishes,
Denis

Hi Denis, Thanks a lot for your support. I think the EDF file of Zeto does not include channel location information. What is the easiest way? Zeto dry EEG headset has 19 channels. Should I get the montage file from Zeto?

Is their any method to include channel location information to raw.info in your code? I really want to solve this issue and want to enjoy using MNE with dry EEG headset.

Best,
Kyu

Yes, you need to get the electrode layout from somewhere.
Once that is available, you can create a montage from it. By setting the montage as shown in the tutorial, channel locations are stored in the info. If you then save the file, they will end up in the file. But typically this is something you do systematically when first reading the data. Hope this helps.

Denis

Denis, I really appreciate your help. Zeto dry EEG headset has 19 channels as follows,

ch 1 - Fp1
ch 2 - Fp2
ch 3 - F7
ch 4 - F3
ch 5 - Fz
ch 6 - F4
ch 7 - F8
ch 8 - T3
ch 9 - C3
ch 10 - Cz
ch 11 - C4
ch 12 - T4
ch 13 - T5
ch 14 - P3
ch 15 - Pz
ch 16 - P4
ch 17 - T6
ch 18 - O1
ch 19 - O2

Base on this channel information, how can I change the code above?

I realized that there is channel location information in raw.info.chs.loc. For MNE’s example files, I can find 6 numbers ,for example, [0.1, 0.2, 0.3, 0.4,0.5, 0.6], but when I check zeto’s edf file, this information is all 0’s. When can I get this six digit information for 19 ch above? If I can find this 6 digit number, I think i can include this number to raw.info.chs.loc. Is this correct? For raw.infor.chs.loc, can I give 3 digit number like x, y, z information?

My question is how to give channel location information to raw.info. In my python script, I want to give the information to raw.info. Can I give x,y,z of each channel to raw.info?

I have x,y,z information for 19 channels. If I put the x,y,z on raw.info.chs.loc, then can I plot PSD for 19 channels? I need your help.