Beispiel #1
0
    def getDataFromFile(self, input_file):
        # read the eeg file to the list
        data = read(
            input_file, delimiter=',', header=1,
            to_float=True, transpose=True
            )

        # choose the channel (in this example its 1st channel - 0)
        data = data[0]
        return data
Beispiel #2
0
# seconds analysed
sec_beg = 15
sec_end = 20
sec_rng = sec_end-sec_beg

# lower and higher range values
rng = [sec_beg*int(fs), sec_end*int(fs)]

############################################
#                                          #
#          GET DATA FROM FILE              #
#                                          #
############################################
# read the eeg file to the list
data = read(
    eeg_file, delimiter=',', header=1, to_float=True, transpose=True
    )

# choose the channel (in this example its 1st channel - 0)
data = data[0]

data_rng = data[rng[0]:rng[1]]

# required for futher plotting appropriate x axis (samples)
x_time = [i/fs for i in range(len(data))]
x_time_rng = x_time[rng[0]:rng[1]]

############################################
#                                          #
#               FILTERING                  #
#                                          #
Beispiel #3
0
highcut = 50.0

# bandstop values
lowstop = 49.0
highstop = 51.0

# file with eeg data location
eeg_file = args.data_file

############################################
#                                          #
#          GET DATA FROM FILE              #
#                                          #
############################################
# read the eeg file to the list
data = read(eeg_file, delimiter=',', header=1, to_float=True, transpose=True)

# choose the channel (in this example its 1st channel - 0)
data = data[0]

############################################
#                                          #
#               FILTERING                  #
#                                          #
############################################
# filter data using butt bandstop 49-51 Hz filter (50Hz)
flted_50_stop = flt.butter_bandstop_filter(data,
                                           lowstop,
                                           highstop,
                                           fs,
                                           order=2)
Beispiel #4
0
#                                          #
#          GET DATA FROM FILE              #
#                                          #
############################################
# read the eeg file to the list

# SNIFFER for detecting dialect
#with open(eeg_file, newline='') as csvfile:
#    dialect = csv.Sniffer().sniff(csvfile.read(1024))
#    csvfile.seek(0)
#    reader = csv.reader(csvfile, dialect)

data = read(eeg_file,
            delimiter=',',
            header=7,
            to_float=False,
            transpose=False,
            comas=False,
            mode='rt')

#data = read(
#    eeg_file, delimiter=',', header=0, to_float=False, transpose=False,
#    comas=False, mode='rt'
#    )

# data extraction/ cleanup
data = zip(*data)
data = list(data)
# choose the channel
data = np.asanyarray(data[:12])
data = data.astype(np.float)