import os, sys import seaborn from pylab import rcParams import cv2 import numpy as np from numpy import linalg as LA from time import time from itertools import combinations import matplotlib.pyplot as plt from matplotlib.pyplot import * import matplotlib.patches as mpatches # activate latex text rendering #rc('text', usetex=True) def main(argv): # path = str(argv[0]) path ="/home/mmbrian/3D_Gaze_Tracking/work/results/2D2D/" Data1 = np.load(path + "p5_2d2d_all.npy") Data2 = np.load(path + "p7_2d2d_all.npy") Data3 = np.load(path + "p10_2d2d_all.npy") Data4 = np.load(path + "p11_2d2d_all.npy") Data5 = np.load(path + "p12_2d2d_all.npy") Data6 = np.load(path + "p13_2d2d_all.npy") Data7 = np.load(path + "p14_2d2d_all.npy") Data8 = np.load(path + "p15_2d2d_all.npy") Data9 = np.load(path + "p16_2d2d_all.npy") Data10 = np.load(path + "p20_2d2d_all.npy") Data11 = np.load(path + "p21_2d2d_all.npy") Data12 = np.load(path + "p24_2d2d_all.npy") Data13 = np.load(path + "p25_2d2d_all.npy") Data14 = np.load(path + "p26_2d2d_all.npy") Data = [Data1,Data2,Data3,Data4,Data5,Data6,Data7,Data8,Data9,Data10,Data11,Data12,Data13,Data14] Participantmean = [] for i in xrange(5): Participantmean.append(float(0)) yerrup = [] for i in xrange(5): yerrup.append(float(0)) yerrdown = [] for i in xrange(5): yerrdown.append(float(0)) maxvalue = [] for i in xrange(5): maxvalue.append(float(0)) minvalue = [] for i in xrange(5): minvalue.append(float(0)) Activitymax = [] for i in xrange(5): Activitymax.append([]) for j in xrange(15): Activitymax[i].append(float(0)) Activitymin = [] for i in xrange(5): Activitymin.append([]) for j in xrange(15): Activitymin[i].append(float(0)) AngularerrorC1 = [] for i in xrange(5): AngularerrorC1.append([]) for j in xrange(14): AngularerrorC1[i].append(float(0)) AngularerrorC2 = [] for i in xrange(5): AngularerrorC2.append([]) for j in xrange(14): AngularerrorC2[i].append(float(0)) AngularerrorC3 = [] for i in xrange(5): AngularerrorC3.append([]) for j in xrange(14): AngularerrorC3[i].append(float(0)) AngularerrorC4 = [] for i in xrange(5): AngularerrorC4.append([]) for j in xrange(14): AngularerrorC4[i].append(float(0)) AngularerrorC5 = [] for i in xrange(5): AngularerrorC5.append([]) for j in xrange(14): AngularerrorC5[i].append(float(0)) # C1 distance = 1.0 i = 0 while i < 14: j = 0 while j < 25: if Data[i][j][1] == 1.0 and Data[i][j][0] == distance: AngularerrorC1[0][i] = Data[i][j][7] break else: j += 1 j = 0 while j < 25: print "i: ", i," j: ", j if Data[i][j][1] == 1.25 and Data[i][j][0] == distance: print Data[i][j][7] AngularerrorC1[1][i] = Data[i][j][7] break else: j += 1 j = 0 while j < 25: if Data[i][j][1] == 1.5 and Data[i][j][0] == distance: AngularerrorC1[2][i] = Data[i][j][7] j = 25 else: j += 1 j = 0 while j < 25: if Data[i][j][1] == 1.75 and Data[i][j][0] == distance: AngularerrorC1[3][i] = Data[i][j][7] j = 25 else: j += 1 j = 0 while j < 25: if Data[i][j][1] == 2.0 and Data[i][j][0] == distance: AngularerrorC1[4][i] = Data[i][j][7] j = 25 else: j += 1 i += 1 print "AngularerrorC1: ", AngularerrorC1[0] print "AngularerrorC1: ", AngularerrorC1[1] print "AngularerrorC1: ", AngularerrorC1[2] print "AngularerrorC1: ", AngularerrorC1[3] print "AngularerrorC1: ", AngularerrorC1[4] meanC1D1 = np.mean(AngularerrorC1[0]) meanC1D2 = np.mean(AngularerrorC1[1]) meanC1D3 = np.mean(AngularerrorC1[2]) meanC1D4 = np.mean(AngularerrorC1[3]) meanC1D5 = np.mean(AngularerrorC1[4]) stdC1D1 = np.std(AngularerrorC1[0]) stdC1D2 = np.std(AngularerrorC1[1]) stdC1D3 = np.std(AngularerrorC1[2]) stdC1D4 = np.std(AngularerrorC1[3]) stdC1D5 = np.std(AngularerrorC1[4]) meanC1 = [meanC1D1,meanC1D2,meanC1D3,meanC1D4,meanC1D5] stdC1 = [stdC1D1,stdC1D2,stdC1D3,stdC1D4,stdC1D5] # C2 distance = 1.25 i = 0 while i < 14: j = 0 while j < 25: if Data[i][j][1] == 1.0 and Data[i][j][0] == distance: AngularerrorC2[0][i] = Data[i][j][7] break else: j += 1 j = 0 while j < 25: print "i: ", i," j: ", j if Data[i][j][1] == 1.25 and Data[i][j][0] == distance: print Data[i][j][7] AngularerrorC2[1][i] = Data[i][j][7] break else: j += 1 j = 0 while j < 25: if Data[i][j][1] == 1.5 and Data[i][j][0] == distance: AngularerrorC2[2][i] = Data[i][j][7] j = 25 else: j += 1 j = 0 while j < 25: if Data[i][j][1] == 1.75 and Data[i][j][0] == distance: AngularerrorC2[3][i] = Data[i][j][7] j = 25 else: j += 1 j = 0 while j < 25: if Data[i][j][1] == 2.0 and Data[i][j][0] == distance: AngularerrorC2[4][i] = Data[i][j][7] j = 25 else: j += 1 i += 1 print "AngularerrorC2: ", AngularerrorC2[0] print "AngularerrorC2: ", AngularerrorC2[1] print "AngularerrorC2: ", AngularerrorC2[2] print "AngularerrorC2: ", AngularerrorC2[3] print "AngularerrorC2: ", AngularerrorC2[4] meanC2D1 = np.mean(AngularerrorC2[0]) meanC2D2 = np.mean(AngularerrorC2[1]) meanC2D3 = np.mean(AngularerrorC2[2]) meanC2D4 = np.mean(AngularerrorC2[3]) meanC2D5 = np.mean(AngularerrorC2[4]) stdC2D1 = np.std(AngularerrorC2[0]) stdC2D2 = np.std(AngularerrorC2[1]) stdC2D3 = np.std(AngularerrorC2[2]) stdC2D4 = np.std(AngularerrorC2[3]) stdC2D5 = np.std(AngularerrorC2[4]) meanC2 = [meanC2D1,meanC2D2,meanC2D3,meanC2D4,meanC2D5] stdC2 = [stdC2D1,stdC2D2,stdC2D3,stdC2D4,stdC2D5] # C3 distance = 1.5 i = 0 while i < 14: j = 0 while j < 25: if Data[i][j][1] == 1.0 and Data[i][j][0] == distance: AngularerrorC3[0][i] = Data[i][j][7] break else: j += 1 j = 0 while j < 25: print "i: ", i," j: ", j if Data[i][j][1] == 1.25 and Data[i][j][0] == distance: print Data[i][j][7] AngularerrorC3[1][i] = Data[i][j][7] break else: j += 1 j = 0 while j < 25: if Data[i][j][1] == 1.5 and Data[i][j][0] == distance: AngularerrorC3[2][i] = Data[i][j][7] j = 25 else: j += 1 j = 0 while j < 25: if Data[i][j][1] == 1.75 and Data[i][j][0] == distance: AngularerrorC3[3][i] = Data[i][j][7] j = 25 else: j += 1 j = 0 while j < 25: if Data[i][j][1] == 2.0 and Data[i][j][0] == distance: AngularerrorC3[4][i] = Data[i][j][7] j = 25 else: j += 1 i += 1 print "AngularerrorC3: ", AngularerrorC3[0] print "AngularerrorC3: ", AngularerrorC3[1] print "AngularerrorC3: ", AngularerrorC3[2] print "AngularerrorC3: ", AngularerrorC3[3] print "AngularerrorC3: ", AngularerrorC3[4] meanC3D1 = np.mean(AngularerrorC3[0]) meanC3D2 = np.mean(AngularerrorC3[1]) meanC3D3 = np.mean(AngularerrorC3[2]) meanC3D4 = np.mean(AngularerrorC3[3]) meanC3D5 = np.mean(AngularerrorC3[4]) stdC3D1 = np.std(AngularerrorC3[0]) stdC3D2 = np.std(AngularerrorC3[1]) stdC3D3 = np.std(AngularerrorC3[2]) stdC3D4 = np.std(AngularerrorC3[3]) stdC3D5 = np.std(AngularerrorC3[4]) meanC3 = [meanC3D1,meanC3D2,meanC3D3,meanC3D4,meanC3D5] stdC3 = [stdC3D1,stdC3D2,stdC3D3,stdC3D4,stdC3D5] # C4 distance = 1.75 i = 0 while i < 14: j = 0 while j < 25: if Data[i][j][1] == 1.0 and Data[i][j][0] == distance: AngularerrorC4[0][i] = Data[i][j][7] break else: j += 1 j = 0 while j < 25: print "i: ", i," j: ", j if Data[i][j][1] == 1.25 and Data[i][j][0] == distance: print Data[i][j][7] AngularerrorC4[1][i] = Data[i][j][7] break else: j += 1 j = 0 while j < 25: if Data[i][j][1] == 1.5 and Data[i][j][0] == distance: AngularerrorC4[2][i] = Data[i][j][7] j = 25 else: j += 1 j = 0 while j < 25: if Data[i][j][1] == 1.75 and Data[i][j][0] == distance: AngularerrorC4[3][i] = Data[i][j][7] j = 25 else: j += 1 j = 0 while j < 25: if Data[i][j][1] == 2.0 and Data[i][j][0] == distance: AngularerrorC4[4][i] = Data[i][j][7] j = 25 else: j += 1 i += 1 print "AngularerrorC4: ", AngularerrorC4[0] print "AngularerrorC4: ", AngularerrorC4[1] print "AngularerrorC4: ", AngularerrorC4[2] print "AngularerrorC4: ", AngularerrorC4[3] print "AngularerrorC4: ", AngularerrorC4[4] meanC4D1 = np.mean(AngularerrorC4[0]) meanC4D2 = np.mean(AngularerrorC4[1]) meanC4D3 = np.mean(AngularerrorC4[2]) meanC4D4 = np.mean(AngularerrorC4[3]) meanC4D5 = np.mean(AngularerrorC4[4]) stdC4D1 = np.std(AngularerrorC4[0]) stdC4D2 = np.std(AngularerrorC4[1]) stdC4D3 = np.std(AngularerrorC4[2]) stdC4D4 = np.std(AngularerrorC4[3]) stdC4D5 = np.std(AngularerrorC4[4]) meanC4 = [meanC4D1,meanC4D2,meanC4D3,meanC4D4,meanC4D5] stdC4 = [stdC4D1,stdC4D2,stdC4D3,stdC4D4,stdC4D5] # C5 distance = 2.0 i = 0 while i < 14: j = 0 while j < 25: if Data[i][j][1] == 1.0 and Data[i][j][0] == distance: AngularerrorC5[0][i] = Data[i][j][7] break else: j += 1 j = 0 while j < 25: print "i: ", i," j: ", j if Data[i][j][1] == 1.25 and Data[i][j][0] == distance: print Data[i][j][7] AngularerrorC5[1][i] = Data[i][j][7] break else: j += 1 j = 0 while j < 25: if Data[i][j][1] == 1.5 and Data[i][j][0] == distance: AngularerrorC5[2][i] = Data[i][j][7] j = 25 else: j += 1 j = 0 while j < 25: if Data[i][j][1] == 1.75 and Data[i][j][0] == distance: AngularerrorC5[3][i] = Data[i][j][7] j = 25 else: j += 1 j = 0 while j < 25: if Data[i][j][1] == 2.0 and Data[i][j][0] == distance: AngularerrorC5[4][i] = Data[i][j][7] j = 25 else: j += 1 i += 1 print "AngularerrorC5: ", AngularerrorC5[0] print "AngularerrorC5: ", AngularerrorC5[1] print "AngularerrorC5: ", AngularerrorC5[2] print "AngularerrorC5: ", AngularerrorC5[3] print "AngularerrorC5: ", AngularerrorC5[4] meanC5D1 = np.mean(AngularerrorC5[0]) meanC5D2 = np.mean(AngularerrorC5[1]) meanC5D3 = np.mean(AngularerrorC5[2]) meanC5D4 = np.mean(AngularerrorC5[3]) meanC5D5 = np.mean(AngularerrorC5[4]) stdC5D1 = np.std(AngularerrorC5[0]) stdC5D2 = np.std(AngularerrorC5[1]) stdC5D3 = np.std(AngularerrorC5[2]) stdC5D4 = np.std(AngularerrorC5[3]) stdC5D5 = np.std(AngularerrorC5[4]) meanC5 = [meanC5D1,meanC5D2,meanC5D3,meanC5D4,meanC5D5] stdC5 = [stdC5D1,stdC5D2,stdC5D3,stdC5D4,stdC5D5] ####################################################################################### path ="/home/mmbrian/3D_Gaze_Tracking/work/results/2D3D/" Datatwo1 = np.load(path + "p5_2d3d_all.npy") Datatwo2 = np.load(path + "p7_2d3d_all.npy") Datatwo3 = np.load(path + "p10_2d3d_all.npy") Datatwo4 = np.load(path + "p11_2d3d_all.npy") Datatwo5 = np.load(path + "p12_2d3d_all.npy") Datatwo6 = np.load(path + "p13_2d3d_all.npy") Datatwo7 = np.load(path + "p14_2d3d_all.npy") Datatwo8 = np.load(path + "p15_2d3d_all.npy") Datatwo9 = np.load(path + "p16_2d3d_all.npy") Datatwo10 = np.load(path + "p20_2d3d_all.npy") Datatwo11 = np.load(path + "p21_2d3d_all.npy") Datatwo12 = np.load(path + "p24_2d3d_all.npy") Datatwo13 = np.load(path + "p25_2d3d_all.npy") Datatwo14 = np.load(path + "p26_2d3d_all.npy") Datatwo = [Datatwo1,Datatwo2,Datatwo3,Datatwo4,Datatwo5,Datatwo6,Datatwo7,Datatwo8,Datatwo9,Datatwo10,Datatwo11,Datatwo12,Datatwo13,Datatwo14] Participantmean = [] for i in xrange(5): Participantmean.append(float(0)) yerrup = [] for i in xrange(5): yerrup.append(float(0)) yerrdown = [] for i in xrange(5): yerrdown.append(float(0)) maxvalue = [] for i in xrange(5): maxvalue.append(float(0)) minvalue = [] for i in xrange(5): minvalue.append(float(0)) Activitymax = [] for i in xrange(5): Activitymax.append([]) for j in xrange(15): Activitymax[i].append(float(0)) Activitymin = [] for i in xrange(5): Activitymin.append([]) for j in xrange(15): Activitymin[i].append(float(0)) AngularerrortwoC1 = [] for i in xrange(5): AngularerrortwoC1.append([]) for j in xrange(14): AngularerrortwoC1[i].append(float(0)) AngularerrortwoC2 = [] for i in xrange(5): AngularerrortwoC2.append([]) for j in xrange(14): AngularerrortwoC2[i].append(float(0)) AngularerrortwoC3 = [] for i in xrange(5): AngularerrortwoC3.append([]) for j in xrange(14): AngularerrortwoC3[i].append(float(0)) AngularerrortwoC4 = [] for i in xrange(5): AngularerrortwoC4.append([]) for j in xrange(14): AngularerrortwoC4[i].append(float(0)) AngularerrortwoC5 = [] for i in xrange(5): AngularerrortwoC5.append([]) for j in xrange(14): AngularerrortwoC5[i].append(float(0)) # C1 distance = 1.0 i = 0 while i < 14: j = 0 while j < 25: if Datatwo[i][j][1] == 1.0 and Datatwo[i][j][0] == distance: AngularerrortwoC1[0][i] = Datatwo[i][j][2] break else: j += 1 j = 0 while j < 25: print "i: ", i," j: ", j if Datatwo[i][j][1] == 1.25 and Datatwo[i][j][0] == distance: print Datatwo[i][j][7] AngularerrortwoC1[1][i] = Datatwo[i][j][2] break else: j += 1 j = 0 while j < 25: if Datatwo[i][j][1] == 1.5 and Datatwo[i][j][0] == distance: AngularerrortwoC1[2][i] = Datatwo[i][j][2] j = 25 else: j += 1 j = 0 while j < 25: if Datatwo[i][j][1] == 1.75 and Datatwo[i][j][0] == distance: AngularerrortwoC1[3][i] = Datatwo[i][j][2] j = 25 else: j += 1 j = 0 while j < 25: if Datatwo[i][j][1] == 2.0 and Datatwo[i][j][0] == distance: AngularerrortwoC1[4][i] = Datatwo[i][j][2] j = 25 else: j += 1 i += 1 print "AngularerrortwoC1: ", AngularerrortwoC1[0] print "AngularerrortwoC1: ", AngularerrortwoC1[1] print "AngularerrortwoC1: ", AngularerrortwoC1[2] print "AngularerrortwoC1: ", AngularerrortwoC1[3] print "AngularerrortwoC1: ", AngularerrortwoC1[4] meantwoC1D1 = np.mean(AngularerrortwoC1[0]) meantwoC1D2 = np.mean(AngularerrortwoC1[1]) meantwoC1D3 = np.mean(AngularerrortwoC1[2]) meantwoC1D4 = np.mean(AngularerrortwoC1[3]) meantwoC1D5 = np.mean(AngularerrortwoC1[4]) stdtwoC1D1 = np.std(AngularerrortwoC1[0]) stdtwoC1D2 = np.std(AngularerrortwoC1[1]) stdtwoC1D3 = np.std(AngularerrortwoC1[2]) stdtwoC1D4 = np.std(AngularerrortwoC1[3]) stdtwoC1D5 = np.std(AngularerrortwoC1[4]) meantwoC1 = [meantwoC1D1,meantwoC1D2,meantwoC1D3,meantwoC1D4,meantwoC1D5] stdtwoC1 = [stdtwoC1D1,stdtwoC1D2,stdtwoC1D3,stdtwoC1D4,stdtwoC1D5] # C2 distance = 1.25 i = 0 while i < 14: j = 0 while j < 25: if Datatwo[i][j][1] == 1.0 and Datatwo[i][j][0] == distance: AngularerrortwoC2[0][i] = Datatwo[i][j][2] break else: j += 1 j = 0 while j < 25: print "i: ", i," j: ", j if Datatwo[i][j][1] == 1.25 and Datatwo[i][j][0] == distance: print Datatwo[i][j][7] AngularerrortwoC2[1][i] = Datatwo[i][j][2] break else: j += 1 j = 0 while j < 25: if Datatwo[i][j][1] == 1.5 and Datatwo[i][j][0] == distance: AngularerrortwoC2[2][i] = Datatwo[i][j][2] j = 25 else: j += 1 j = 0 while j < 25: if Datatwo[i][j][1] == 1.75 and Datatwo[i][j][0] == distance: AngularerrortwoC2[3][i] = Datatwo[i][j][2] j = 25 else: j += 1 j = 0 while j < 25: if Datatwo[i][j][1] == 2.0 and Datatwo[i][j][0] == distance: AngularerrortwoC2[4][i] = Datatwo[i][j][2] j = 25 else: j += 1 i += 1 print "AngularerrortwoC2: ", AngularerrortwoC2[0] print "AngularerrortwoC2: ", AngularerrortwoC2[1] print "AngularerrortwoC2: ", AngularerrortwoC2[2] print "AngularerrortwoC2: ", AngularerrortwoC2[3] print "AngularerrortwoC2: ", AngularerrortwoC2[4] meantwoC2D1 = np.mean(AngularerrortwoC2[0]) meantwoC2D2 = np.mean(AngularerrortwoC2[1]) meantwoC2D3 = np.mean(AngularerrortwoC2[2]) meantwoC2D4 = np.mean(AngularerrortwoC2[3]) meantwoC2D5 = np.mean(AngularerrortwoC2[4]) stdtwoC2D1 = np.std(AngularerrortwoC2[0]) stdtwoC2D2 = np.std(AngularerrortwoC2[1]) stdtwoC2D3 = np.std(AngularerrortwoC2[2]) stdtwoC2D4 = np.std(AngularerrortwoC2[3]) stdtwoC2D5 = np.std(AngularerrortwoC2[4]) meantwoC2 = [meantwoC2D1,meantwoC2D2,meantwoC2D3,meantwoC2D4,meantwoC2D5] stdtwoC2 = [stdtwoC2D1,stdtwoC2D2,stdtwoC2D3,stdtwoC2D4,stdtwoC2D5] # C3 distance = 1.5 i = 0 while i < 14: j = 0 while j < 25: if Datatwo[i][j][1] == 1.0 and Datatwo[i][j][0] == distance: AngularerrortwoC3[0][i] = Datatwo[i][j][2] break else: j += 1 j = 0 while j < 25: print "i: ", i," j: ", j if Datatwo[i][j][1] == 1.25 and Datatwo[i][j][0] == distance: print Datatwo[i][j][7] AngularerrortwoC3[1][i] = Datatwo[i][j][2] break else: j += 1 j = 0 while j < 25: if Datatwo[i][j][1] == 1.5 and Datatwo[i][j][0] == distance: AngularerrortwoC3[2][i] = Datatwo[i][j][2] j = 25 else: j += 1 j = 0 while j < 25: if Datatwo[i][j][1] == 1.75 and Datatwo[i][j][0] == distance: AngularerrortwoC3[3][i] = Datatwo[i][j][2] j = 25 else: j += 1 j = 0 while j < 25: if Datatwo[i][j][1] == 2.0 and Datatwo[i][j][0] == distance: AngularerrortwoC3[4][i] = Datatwo[i][j][2] j = 25 else: j += 1 i += 1 print "AngularerrortwoC3: ", AngularerrortwoC3[0] print "AngularerrortwoC3: ", AngularerrortwoC3[1] print "AngularerrortwoC3: ", AngularerrortwoC3[2] print "AngularerrortwoC3: ", AngularerrortwoC3[3] print "AngularerrortwoC3: ", AngularerrortwoC3[4] meantwoC3D1 = np.mean(AngularerrortwoC3[0]) meantwoC3D2 = np.mean(AngularerrortwoC3[1]) meantwoC3D3 = np.mean(AngularerrortwoC3[2]) meantwoC3D4 = np.mean(AngularerrortwoC3[3]) meantwoC3D5 = np.mean(AngularerrortwoC3[4]) stdtwoC3D1 = np.std(AngularerrortwoC3[0]) stdtwoC3D2 = np.std(AngularerrortwoC3[1]) stdtwoC3D3 = np.std(AngularerrortwoC3[2]) stdtwoC3D4 = np.std(AngularerrortwoC3[3]) stdtwoC3D5 = np.std(AngularerrortwoC3[4]) meantwoC3 = [meantwoC3D1,meantwoC3D2,meantwoC3D3,meantwoC3D4,meantwoC3D5] stdtwoC3 = [stdtwoC3D1,stdtwoC3D2,stdtwoC3D3,stdtwoC3D4,stdtwoC3D5] # C4 distance = 1.75 i = 0 while i < 14: j = 0 while j < 25: if Datatwo[i][j][1] == 1.0 and Datatwo[i][j][0] == distance: AngularerrortwoC4[0][i] = Datatwo[i][j][2] break else: j += 1 j = 0 while j < 25: print "i: ", i," j: ", j if Datatwo[i][j][1] == 1.25 and Datatwo[i][j][0] == distance: print Datatwo[i][j][7] AngularerrortwoC4[1][i] = Datatwo[i][j][2] break else: j += 1 j = 0 while j < 25: if Datatwo[i][j][1] == 1.5 and Datatwo[i][j][0] == distance: AngularerrortwoC4[2][i] = Datatwo[i][j][2] j = 25 else: j += 1 j = 0 while j < 25: if Datatwo[i][j][1] == 1.75 and Datatwo[i][j][0] == distance: AngularerrortwoC4[3][i] = Datatwo[i][j][2] j = 25 else: j += 1 j = 0 while j < 25: if Datatwo[i][j][1] == 2.0 and Datatwo[i][j][0] == distance: AngularerrortwoC4[4][i] = Datatwo[i][j][2] j = 25 else: j += 1 i += 1 print "AngularerrortwoC4: ", AngularerrortwoC4[0] print "AngularerrortwoC4: ", AngularerrortwoC4[1] print "AngularerrortwoC4: ", AngularerrortwoC4[2] print "AngularerrortwoC4: ", AngularerrortwoC4[3] print "AngularerrortwoC4: ", AngularerrortwoC4[4] meantwoC4D1 = np.mean(AngularerrortwoC4[0]) meantwoC4D2 = np.mean(AngularerrortwoC4[1]) meantwoC4D3 = np.mean(AngularerrortwoC4[2]) meantwoC4D4 = np.mean(AngularerrortwoC4[3]) meantwoC4D5 = np.mean(AngularerrortwoC4[4]) stdtwoC4D1 = np.std(AngularerrortwoC4[0]) stdtwoC4D2 = np.std(AngularerrortwoC4[1]) stdtwoC4D3 = np.std(AngularerrortwoC4[2]) stdtwoC4D4 = np.std(AngularerrortwoC4[3]) stdtwoC4D5 = np.std(AngularerrortwoC4[4]) meantwoC4 = [meantwoC4D1,meantwoC4D2,meantwoC4D3,meantwoC4D4,meantwoC4D5] stdtwoC4 = [stdtwoC4D1,stdtwoC4D2,stdtwoC4D3,stdtwoC4D4,stdtwoC4D5] # C5 distance = 2.0 i = 0 while i < 14: j = 0 while j < 25: if Datatwo[i][j][1] == 1.0 and Datatwo[i][j][0] == distance: AngularerrortwoC5[0][i] = Datatwo[i][j][2] break else: j += 1 j = 0 while j < 25: print "i: ", i," j: ", j if Datatwo[i][j][1] == 1.25 and Datatwo[i][j][0] == distance: print Datatwo[i][j][7] AngularerrortwoC5[1][i] = Datatwo[i][j][2] break else: j += 1 j = 0 while j < 25: if Datatwo[i][j][1] == 1.5 and Datatwo[i][j][0] == distance: AngularerrortwoC5[2][i] = Datatwo[i][j][2] j = 25 else: j += 1 j = 0 while j < 25: if Datatwo[i][j][1] == 1.75 and Datatwo[i][j][0] == distance: AngularerrortwoC5[3][i] = Datatwo[i][j][2] j = 25 else: j += 1 j = 0 while j < 25: if Datatwo[i][j][1] == 2.0 and Datatwo[i][j][0] == distance: AngularerrortwoC5[4][i] = Datatwo[i][j][2] j = 25 else: j += 1 i += 1 print "AngularerrortwoC5: ", AngularerrortwoC5[0] print "AngularerrortwoC5: ", AngularerrortwoC5[1] print "AngularerrortwoC5: ", AngularerrortwoC5[2] print "AngularerrortwoC5: ", AngularerrortwoC5[3] print "AngularerrortwoC5: ", AngularerrortwoC5[4] meantwoC5D1 = np.mean(AngularerrortwoC5[0]) meantwoC5D2 = np.mean(AngularerrortwoC5[1]) meantwoC5D3 = np.mean(AngularerrortwoC5[2]) meantwoC5D4 = np.mean(AngularerrortwoC5[3]) meantwoC5D5 = np.mean(AngularerrortwoC5[4]) stdtwoC5D1 = np.std(AngularerrortwoC5[0]) stdtwoC5D2 = np.std(AngularerrortwoC5[1]) stdtwoC5D3 = np.std(AngularerrortwoC5[2]) stdtwoC5D4 = np.std(AngularerrortwoC5[3]) stdtwoC5D5 = np.std(AngularerrortwoC5[4]) meantwoC5 = [meantwoC5D1,meantwoC5D2,meantwoC5D3,meantwoC5D4,meantwoC5D5] stdtwoC5 = [stdtwoC5D1,stdtwoC5D2,stdtwoC5D3,stdtwoC5D4,stdtwoC5D5] ###################################################################################### N = 5 ind = np.asarray([0.25,1.25,2.25,3.25,4.25]) width = 0.5 # the width of the bars x1 = [0.375,1.375,2.375,3.375,4.375] x2 = [0.425,1.425,2.425,3.425,4.425] x3 = [0.475,1.475,2.475,3.475,4.475] x4 = [0.525,1.525,2.525,3.525,4.525] x5 = [0.575,1.575,2.575,3.575,4.575] x6 = [0.625,1.625,2.625,3.625,4.625] fig = plt.figure(figsize=(14.0, 10.0)) ax = fig.add_subplot(111) # rects1 = ax.bar(ind, Participantmean,width, color='r',edgecolor='black',)#, hatch='//') rects1 = ax.errorbar(x1, meanC1,yerr=[stdC1,stdC1],fmt='o',color='blue',ecolor='blue',lw=3, capsize=5, capthick=2) plt.plot(x1, meanC1, marker="o", linestyle='-',lw=3,color='blue',label = r'2D-to-2D Calibration Depth 1') # rects2 =ax.errorbar(x2, meanC2,yerr=[stdC2,stdC2],fmt='o',color='red',ecolor='red',lw=3, capsize=5, capthick=2) # plt.plot(x2, meanC2, marker="o", linestyle='-',lw=3,color='red') rects3 = ax.errorbar(x3, meanC3,yerr=[stdC3,stdC3],fmt='o',color='orange',ecolor='orange',lw=3, capsize=5, capthick=2) plt.plot(x3, meanC3, marker="o", linestyle='-',lw=3,color='orange',label = r'2D-to-2D Calibration Depth 3') # # rects4 =ax.errorbar(x4, meanC4,yerr=[stdC4,stdC4],fmt='o',color='green',ecolor='green',lw=3, capsize=5, capthick=2) # plt.plot(x4, meanC4, marker="o", linestyle='-',lw=3,color='green') rects5 =ax.errorbar(x5, meanC5,yerr=[stdC5,stdC5],fmt='o',color='red',ecolor='red',lw=3, capsize=5, capthick=2) plt.plot(x5, meanC5, marker="o", linestyle='-',lw=3,color='red',label = r'2D-to-2D Calibration Depth 5') # rects1 = ax.bar(ind, Participantmean,width, color='r',edgecolor='black',)#, hatch='//') rects2 = ax.errorbar(x2, meantwoC1,yerr=[stdtwoC1,stdtwoC1],fmt='o',color='blue',ecolor='blue',lw=3, capsize=5, capthick=2) plt.plot(x2, meantwoC1, marker="o", linestyle='--',lw=3,color='blue',label = r'2D-to-3D Calibration Depth 1') # rects2 =ax.errorbar(x2, meanC2,yerr=[stdC2,stdC2],fmt='o',color='red',ecolor='red',lw=3, capsize=5, capthick=2) # plt.plot(x2, meanC2, marker="o", linestyle='-',lw=3,color='red') rects4 = ax.errorbar(x4, meantwoC3,yerr=[stdtwoC3,stdtwoC3],fmt='o',color='orange',ecolor='orange',lw=3, capsize=5, capthick=2) plt.plot(x4, meantwoC3, marker="o", linestyle='--',lw=3,color='orange',label = r'2D-to-3D Calibration Depth 3') # # rects4 =ax.errorbar(x4, meanC4,yerr=[stdC4,stdC4],fmt='o',color='green',ecolor='green',lw=3, capsize=5, capthick=2) # plt.plot(x4, meanC4, marker="o", linestyle='-',lw=3,color='green') rects6 =ax.errorbar(x6, meantwoC5,yerr=[stdtwoC5,stdtwoC5],fmt='o',color='red',ecolor='red',lw=3, capsize=5, capthick=2) plt.plot(x6, meantwoC5, marker="o", linestyle='--',lw=3,color='red',label = r'2D-to-3D Calibration Depth 5') ax.set_ylabel('Angular Error',fontsize=22) ax.set_xlabel('Depth',fontsize=22) ax.set_xticks(ind+0.25) ax.set_xticklabels( ('D1', 'D2', 'D3','D4', 'D5') ,fontsize=16) TOPICs = [0.0,0.5,1.5,2.5,3.5,4.5,5.0]#,110]#,120] print TOPICs LABELs = ["",r'D1 - 1m',r'D2 - 1.25m', r'D3 - 1.5m', r'D4 - 1.75m', r'D5 - 2.0m', ""]#, ""]#, ""] # fig.canvas.set_window_title('Distance Error Correlation') plt.xticks(TOPICs, LABELs,fontsize=18) # legend([rects1,rects2,rects3,rects4,rects5], [r'\LARGE\textbf{Calibration Distance 1}', r'\LARGE\textbf{Calibration Distance 2}',r'\LARGE\textbf{Calibration Distance 3}', r'\LARGE\textbf{Calibration Distance 4}',r'\LARGE\textbf{Calibration Distance 5}'], loc='lower right') legend(fontsize=20,loc='best') TOPICS = [-4.0,-2.0, 0.0,2.0,4.0,6.0,8.0,10.0,12,14,16,18,20,22,24]#,110]#,120] print TOPICS LABELS = [r'', r'',r'0',r'2', r'4', r'6', r'8', r'10', r'12', r'14', r'16', r'18', r'20', r'22', r'24']#, ""]#, ""] # fig.canvas.set_window_title('Accuracy - Activity Statistics') plt.yticks(TOPICS, LABELS,fontsize=18) def autolabel(rects): # attach some text labels for rect in rects: height = rect.get_height() ax.text(0.26+rect.get_x()+rect.get_width()/2., height +0.35, "%.2f"%float(height), ha='center', va='bottom',fontweight='bold',fontsize=13.5) # autolabel(rects1) left = 0.1 # the left side of the subplots of the figure right = 0.975 # the right side of the subplots of the figure bottom = 0.075 # the bottom of the subplots of the figure top = 0.925 # the top of the subplots of the figure wspace = 0.2 # the amount of width reserved for blank space between subplots hspace = 0.4 # the amount of height reserved for white space between subplots plt.subplots_adjust(left=left, bottom=bottom, right=right, top=top, wspace=wspace, hspace=hspace) plt.show() means = [meanC1, meanC2, meanC3, meanC4, meanC5] print meanC1 print meanC2 print meanC3 print meanC4 print meanC5 fixationinfos_list_path = "MeansC1D2D2.npy" fixationinfos_list_csv_path = "MeansC1D2D2.csv" np.save(fixationinfos_list_path,np.asarray(means)) np.savetxt(fixationinfos_list_csv_path,np.asarray(means), delimiter=",", fmt="%f") ## fixationinfos_list_path = "Activitymin_"+str(activity)+".npy" ## fixationinfos_list_csv_path = "Activitymin_"+str(activity)+".csv" ## np.save(fixationinfos_list_path,np.asarray(Activitymin)) ## np.savetxt(fixationinfos_list_csv_path,np.asarray(Activitymin), delimiter=",", fmt="%s") if __name__ == "__main__": main(sys.argv[1:])