Have converted the .csv to .fif but the event column is not getting processed.
Have created a channel āSTIM 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 column of the csv file and process the eeg signals and predict which event based on the 14 channels?
Thanks,
Now when I run: events = mne.find_events(raw)
Trigger channel has a non-zero initial value of 1 (consider using initial_event=True to detect this event)
Removing orphaned offset at the beginning of the file.
286 events found
Event IDs: [1 2]
Itās only finding 2 events when there are 4 events totally.
Why is this happening? Not finding all events and also number of events are less.
I also have to say Iām surprised the values in that channel fluctuate so much from row to row. What does each row in your input data actually represent?
No, because 0 means ānothingā in a stim channel.
Iām failing to see the connection here.
I was asking because normally, triggers (event codes) need to persist over several samples, whereas in your example, they seem to change with every row. The only explanation I have is that rows donāt represent samples here. But if they donāt, then using a RawArray for your data doesnāt make any sense.
Yes it does persist over several samples, I change it so that you can see different class in the screenshot. The next event occurs after a long time only.
The entire dataset actually contains Timestamp, 14-channels, Classification/Label/event, PPG, BPM, IBI etc. for each patients in separate .csv file.
What I want to do is to predict the Class/label based on the EEG signal and figure if there are any feature or frequency band that particular affects the classification?
And figure how the EEG signal looks when a person is listening, writing etcā¦
Am I going in a the wrong approach for this.
What the right approach then?
Was trying to extract the features from EEG Signal. For that wanted to import the data and epoch it.
tmin, tmax = -0.2, 0.5
event_id = dict(listening=1, writing=3)
# Setup for reading the raw data
raw = mne.io.RawArray(data, info)
raw.filter(.5, None, fir_design='firwin')
events = mne.read_events(data)
picks = mne.pick_types(raw.info, eeg=True)
# Read epochs
epochs = mne.Epochs(raw, events, event_id, tmin, tmax, picks=picks, proj=True,
baseline=None, preload=True)
labels = epochs.events[:, -1]
# get MEG and EEG data
data = epochs.get_data()
Had the data in csv format like before. Here for the read_events since I donāt have separate event/label file, I gave the data path itself which I converted from csv and transposed to numpy.ndarray.
Now when I run the code I get
TypeError: fname must be an instance of path-like, got <class ānumpy.ndarrayā> instead.
Donāt have a path to the event/label. I know I need to give fname of the events.
How to handle this error if I donāt have event_fname? How to resolve this?