def export_data(self):
self.running = False
self.pupil_thread.join(5)
self.lsl_thread.join(5)
print('Joined threads, now outputting pupil data.')
i = 0
while os.path.exists("data/pupil/data-%s.csv" % i):
i += 1
# csv writer with stim_type, msg, and timestamp, then data
with open('data/pupil/data-%s.csv' % i, 'w+') as f:
writer = csv.writer(f)
writer.writerow(('Signal Type', 'Msg', 'Time', 'Channel 1', 'Channel 2', 'Channel 3', 'Channel 4', 'Channel 5', 'Channel 6', 'Channel 7', 'Channel 8' ))
for sample in self.samples:
signal_type, timestamp, datas = sample
out = (signal_type, 'msg', timestamp)
for data in datas:
out = out + (data,)
writer.writerow(out)
评论列表
文章目录