In [1]:
from eegml import *
print_config()
try: # Import config params
from dev_settings import *
except ImportError:
print "Please create a dev_settings.py using dev_settings.py.example as an example"
machine subject start_time end_time stim block poolmodality text difficult
['a', 'a', '2010-12-14 17:05:40.883', '2010-12-14 17:05:43.852', 'A tree is a plant. ', 'A tree is a plant. A tree is the biggest plant that grows. Most kinds of trees grow from seeds the way most small plants do. There are many kinds of trees. Here are a few of them. How many do you know? This tree grows in the country. It might grow in your yard, too. Do you know what kind it is? This is an apple tree. ', '1', '2', '1', '1']
In [2]:
format_task_xls()
In [3]:
compress_time_labels("./preprocess/task_xls_labels.csv")
In [4]:
from os import listdir
from os.path import isfile, join
import re
onlyfiles = [ f for f in listdir(DATA_URL) if isfile(join(DATA_URL,f)) ]
pat = re.compile("[0-9]*\.[0-9]*\.combined\.csv")
temp_dat = [f.split('.')[0:2] for f in onlyfiles if pat.match(f)]
sub_dict = {i[1]: i[0] for i in temp_dat}
In [5]:
for i in sub_dict:
label_data(DATA_URL + "/"+sub_dict[i] + "." +i+".combined.csv",
SAVE_URL + "/task_xls_labels.csv",
SAVE_URL + "/"+sub_dict[i] + "." +i+".labelled.csv",
i, sub_dict[i])
In [7]:
create_raw_incremental(DATA_URL + "/20101214163931.a.rawwave.csv", "preprocess/raw_incremental.csv")
label_data_raw_signal("preprocess/raw_incremental.csv",
"preprocess/task_xls_labels.csv",
"preprocess/raw_incremental_label.csv")
Plot raw data
In [11]:
with open("preprocess/raw_incremental_label.csv", 'rb') as fi:
fr = csv.reader(fi, delimiter='\t')
next(fr)
a = list(fr)
fig, ax = plt.subplots()
x_ax = [int(i[0].split('.')[0]) for i in a]
diffi = [int(i[2]) for i in a]
#print x_ax
#ax.plot(x_ax,sig_q, label='Quality')
#ax.plot(x_ax,atten, label='Attention')
#ax.plot(x_ax,medit, label='Meditation')
ax.plot(x_ax,diffi, label='Difficulty')
ax.grid(True)
fig.tight_layout()
plt.legend(loc='upper left')
plt.show()