gazesim/code/recording/util/check_pupil_positions.py

18 lines
590 B
Python

from __future__ import division
import numpy as np
import os, sys
if __name__ == '__main__':
try:
path = sys.argv[1]
time_stamps = np.load(os.path.join(path, 'world_timestamps.npy'))
pts = np.load(os.path.join(path, 'pupil_positions.npy'))
valid = filter(lambda e: e[1] > 0, pts) # filter all with zero confidence
csum = sum(e[1] for e in pts)
print 'Ratio: %s' % round(len(valid)*100/len(pts), 2) + '%'
if len(valid):
print 'Average Confidence:', csum/len(valid)
print 'Frames: %s' % len(time_stamps)
except Exception, err:
print 'Something went wrong.'
print err