Plotting Error - EEG Unit

Hello,

This is a sample of my dataset.

sampling frequency - 128 Hz

  • operating system: Windows 10

When plotted getting an distorted image like the below one. How to rectify it and get a proper signal.
raw.plot()

In the csv folder of the dataset I have events also. Have created a channel for the events also. But getting error.
ValueError: No stim channels found. Consider specifying them manually using the ‘stim_channel’ parameter.

events = mne.find_events(raw)

How to process the events col. of the csv file and process the eeg signals and predict which event based on the 14 channels?

Thanks

Hello,

the data values seem to be in µV, but MNE requires SI units, i.e., Volts. Multiply the values by 1e-6 and things should already look much better.

As for the other question, can you please open a separate topic?

Best wishes,
Richard

Hello Richard,

dataframe = pd.read_csv('eeg.csv') 
eeg_data = dataframe.transpose().to_numpy()
n_channels = len(dataframe.columns)    
sampling_freq = 128  
info = mne.create_info(n_channels, sfreq=sampling_freq)

info = mne.create_info(ch_names, ch_types=ch_types, sfreq=sampling_freq)
info.set_montage('standard_1020')

raw = mne.io.RawArray(eeg_data, info)
raw.save('eeg.fif',overwrite=True)

raw.plot()

I’m converting it from .csv to .fif and plotting, so then how do I convert the data unit from µV to V.

Thanks

Just multiply the dataframe by 1e-6 before creating the RawArray, that should do the trick.

Best wishes
Richard

Hello @Star, great to see it’s working!

Can you please post your other question into a new topic? Thank you!

Richard

Thanks, Have posted it separately.

Sorry but now the event column in the data frame also gets multiplied with 1e-6. That why I asked the Event’s based classification question (Event's based Classification) with this also.
Could you help me with this @richard .

Thanks

You can exclude the last column from the multiplication by doing something like:

dataframe.loc[
    :,  # all rows
    dataframe.columns[:-1]  # omit last column (events)
] *= 1e-6

Best wishes,
Richard