This repository has been archived on 2021-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
scientificComputing/projects/project_eyetracker/data/export_data.py

30 lines
916 B
Python

import numpy as np
import scipy.io as sp
from IPython import embed
with open('corsi_VP19_eyedata.log') as f:
lines = f.readlines()
eye_found = np.zeros((len(lines)-7,1))
gaze_x = np.zeros(eye_found.shape)
gaze_y = np.zeros(eye_found.shape)
frame_time = np.zeros(eye_found.shape)
marker_time = np.zeros(eye_found.shape)
marker_count = np.zeros(eye_found.shape)
for i in range(7,len(lines)):
line = lines[i].strip().split()
eye_found[i-7] = line[1]
gaze_x[i-7] = line[2]
gaze_y[i-7] = line[3]
frame_time[i-7] = line[10]
marker_time[i-7] = line[11]
marker_count[i-7] = line[9]
to_be_stored = {'eye_found': eye_found, 'gaze_x':gaze_x, 'gaze_y':gaze_y,
'frame_time':frame_time, 'marker_time':marker_time,
'marker_count':marker_count}
sp.savemat('eye_tracking.mat', to_be_stored)