External Email - Use Caution
Hello All,
I am experiencing something strange with my data analysis code that worked
few weeks ago but currently is failing on new data sets
Using the snippet below, i import a csv file containing eeg data and
events. Then i filtered the data, and epoch the data.
but when i call epoch.get_data(), instead of getting a 3D array of n-epochs
by n_channel by_ time, i am getting only n_channel by n_times.
I also see that all epochs are considered bad and dropped.
If this is the case, how can I avoid this?(dropping all epochs as bad.)
how can i go about resolving this?.
Looking forward to your reply
*Code Snippet*
*#libraries imported*
*import numpy as npimport mneimport osfrom mne.preprocessing import
compute_proj_ecg, compute_proj_eogfrom mne_features.feature_extraction
import FeatureExtractorimport pandas as pdfrom
mne_features.feature_extraction import extract_featuresfrom
mne_features.univariate import compute_pow_freq_bandsfrom
mne_features.utils import power_spectrum*
*# Read the raw data from their respective CSV file as a NumPy array*
*data = np.loadtxt('eegdata.csv', delimiter=',') #reading the raw eeg
signaevenfile=np.loadtxt('eegevent.csv', delimiter=',')#reading the eeg
event file with timestampsevenfile=np.array(evenfile, dtype='int')#ensuring
that the event file contains only int values and no float# Some information
about the channelschannames =
['Cz','Fz','C3','C4','F3','F4','P7','P8','stim'] ch_types =
['eeg','eeg','eeg','eeg','eeg','eeg','eeg','eeg','stim']# Sampling rate of
the Nautilus machinesfreq = 250 # Hz for eeg*
*# Create the info structure needed by MNEinfo =
mne.create_info(ch_names=channames, sfreq=sfreq, ch_types=ch_types)#specify
the events in the eeg dataevent_id =1# Finally, create the Raw objectraw =
mne.io.RawArray(data, info)*
*picks =mne.pick_types(raw.info <http://raw.info>, meg=False, eeg=True,
stim=True, eog=False,exclude='bads')#filtering the raw
signalraw=raw.filter(0.1, 120,
fir_design='firwin')raw=raw.notch_filter(np.arange(50, 125, 50),
picks=picks, filter_length='auto', phase='zero')# Read
epochsepochs = mne.Epochs(raw, evenfile, event_id=event_id, tmin=-2,
tmax=2, picks=picks)labels = epochs.events[:, -1]data = epochs.get_data()*
Best Regards
A. Ighoyota ben
Junior Researcher HCI (PhD in-view)
Tallinn University, Estonia
School of digital Technologies.
mobile:+372582 <+372%205832%206393>78794
skype: ighoyota-ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200121/599a7189/attachment.html