Ploting EEG data

Hi
I am trying to use mne to plot eeg data from .csv file
and this is my code :

import numpy as np
import pandas as pd
import mne

path = 'C:/Users/name/Desktop/Unicorn config/UnicornHybridBlack-master/UnicornHybridBlack-master/Python Collect/Gentask/Engine/'
data = pd.read_csv(path + 'sara_sig2.csv',
                   skiprows=0, usecols=[*range(0, 8)])
ch_names = ['FZ', 'C3', 'CZ', 'C4', 'PZ', 'O1', 'OZ', 'O2']

sfreq = 250
info = mne.create_info(ch_names = ch_names, sfreq = sfreq)
raw = mne.io.RawArray(data.transpose() , info)
raw.plot()

and this is a picture of data in excel file

and when i run the code i got this

can any one help me to solve the problem please .

Thank you

hi,

try dividing your values by 1e6 as MNE expects signals in V not uV.

Alex

thank you sir for your reply, it works, but unfortunately I cant see the fluctuation of the signals

Can you show the updated code? Also, please format code appropriately to make it easier for us to read it (I did that for you in your initial post).

This is my code

import numpy as np
import pandas as pd
import mne

path = 'C:/Users/Name/Desktop/Unicorn config/UnicornHybridBlack-master/UnicornHybridBlack-master/Python Collect/Gentask/Engine/'
data = pd.read_csv(path + 'sara_sig2.csv',
                   skiprows=0, usecols=[*range(0, 8)])*1e-6
ch_names = ['FZ', 'C3', 'CZ', 'C4', 'PZ', 'O1', 'OZ', 'O2']

sfreq = 250
info = mne.create_info(ch_names = ch_names, sfreq = sfreq)
raw = mne.io.RawArray(data.transpose() , info)
raw.plot()

Looks OK! Could you share the CSV file so that I can take a look?

Here is the file, in one drive

https://alumniuaeuac-my.sharepoint.com/:x:/g/personal/201800949_uaeu_ac_ae/EbIydqnmx9BLi37OsSJ8AmYBTPpiwAQWI43AFX3-_TBREw?e=j3hVfn

The data contained in the .xlsx file doesn’t look like EEG – try plotting it directly after loading with Pandas:

data["FZ"].plot()

Besides, you should set the data type of all channels to 'eeg' when you create your info object. But that’s not the problem here.

1 Like

Thank you sir for your reply.
I recorded this data using unicorn hybrid black but I don’t know why it doesn’t look like EEG data.

Is the original data stored in a CSV file or did you convert from a different data format? I don’t know this EEG device, so unfortunately you will have to check if something went wrong during recording or data export.

The recorded data immediately be saved to CSV file.
Inshallah, I will search for someone who had same as my problem.
Thank you sir.

Hi Sara,

Did you check that electrodes are properly connected and the impedance is ok? The data does not even look random, so my guess would be that electrodes are not connected properly.

Best,

I checked the electrodes and they are connected properly and when i run the device from the unicorn recorder it saves them in csv file and the values appear ok ( appear as EEG data), but when i use this library that i got from github ( UnicornHybridBlack/README.md at master · mattpontifex/UnicornHybridBlack · GitHub) with the provided code, i got saved data in csv file but not EEG data ( as the attached picture above)
i dont know why :smiling_face_with_tear:

Old thread but going to reply incase anyone else has this issue. You have to zoom out when in the graph in order to see all the data. As you can see in the picture above, the scale is extremely small. using fn- you can zoom out. (clicking the “help” button should also show you a list of commands for zooming, adjusting scales, etc.)