I am trying to isolate the p300 using the mne library in python, from csv files recorded with a muse headset I managed to plot the raw data, at an unusually big scaling. But when I want mne.Epochs, my raw data does not pop up in the plot, only the vertical bars from my events.
Here's the code and a preview of the data:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import mne
file = 'muselab_recording1.csv'
data = pd.read_csv(file,
usecols=[*range(1, 6)])
data['annotation'] = data['annotation'].replace(1, 2)
data['annotation'] = data['annotation'].replace(0, 1)
data['annotation'] = data['annotation'].fillna(0)
transposed_data = data.transpose()
ch_names = ['eeg_1', 'eeg_2', 'eeg_3','eeg_4','annotation']
sfreq = 256
info = mne.create_info(ch_names = ch_names, sfreq = sfreq, ch_types=['eeg','eeg','eeg','eeg','stim'])
raw = mne.io.RawArray(transposed_data, info)
event_dict = {'stimulus': 2}
events1 = mne.find_events(raw,'annotation', output= 'onset',initial_event=True)
raw.plot(events = events1, scalings = dict(eeg=10e1))
plt.show()
preview of the csv file (https://i.stack.imgur.com/PVKbc.png)
epochs plot (https://i.stack.imgur.com/KyKwn.png)
output (https://i.stack.imgur.com/cN2RM.png)
I tried seeing if it's a scale problem: when I use raw.plot with the events argument, the vertical bars do not pop up. This is the plot of the raw data, I know it's not the clearest dataset, but I am just trying to see if I can get the average out.raw data with events