migrated code to public repository
This commit is contained in:
parent
a7df82d7a4
commit
f34dc653e5
233 changed files with 16279 additions and 186 deletions
350
code/Visualization/EffectNumberofClusters.py
Normal file
350
code/Visualization/EffectNumberofClusters.py
Normal file
|
@ -0,0 +1,350 @@
|
|||
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):
|
||||
|
||||
C12D2D = np.load("MeansC1D2D2.npy")
|
||||
C12D3D = np.load("MeansC1D2D3.npy")
|
||||
|
||||
C22D2D = np.load("MeansC2D2D2.npy")
|
||||
C22D3D = np.load("MeansC2D2D3.npy")
|
||||
|
||||
C32D2D = np.load("MeansC3D2D2.npy")
|
||||
C32D3D = np.load("MeansC3D2D3.npy")
|
||||
|
||||
C42D2D = np.load("MeansC4D2D2.npy")
|
||||
C42D3D = np.load("MeansC4D2D3.npy")
|
||||
|
||||
C52D2D = np.load("MeansC5D2D2.npy")
|
||||
C52D3D = np.load("MeansC5D2D3.npy")
|
||||
|
||||
|
||||
summeC12D2D = []
|
||||
summeC22D2D = []
|
||||
summeC32D2D = []
|
||||
summeC42D2D = []
|
||||
summeC52D2D = []
|
||||
|
||||
summeC12D3D = []
|
||||
summeC22D3D = []
|
||||
summeC32D3D = []
|
||||
summeC42D3D = []
|
||||
summeC52D3D = []
|
||||
|
||||
|
||||
i = 0
|
||||
while i < len(C12D2D):
|
||||
j = 0
|
||||
while j < len(C12D2D[0]):
|
||||
summeC12D2D.append(C12D2D[i][j])
|
||||
j += 1
|
||||
i += 1
|
||||
|
||||
i = 0
|
||||
while i < len(C22D2D):
|
||||
j = 0
|
||||
while j < len(C22D2D[0]):
|
||||
summeC22D2D.append(C22D2D[i][j])
|
||||
j += 1
|
||||
i += 1
|
||||
|
||||
i = 0
|
||||
while i < len(C32D2D):
|
||||
j = 0
|
||||
while j < len(C32D2D[0]):
|
||||
summeC32D2D.append(C32D2D[i][j])
|
||||
j += 1
|
||||
i += 1
|
||||
|
||||
i = 0
|
||||
while i < len(C42D2D):
|
||||
j = 0
|
||||
while j < len(C42D2D[0]):
|
||||
summeC42D2D.append(C42D2D[i][j])
|
||||
j += 1
|
||||
i += 1
|
||||
|
||||
i = 0
|
||||
while i < len(C52D2D):
|
||||
j = 0
|
||||
while j < len(C52D2D[0]):
|
||||
summeC52D2D.append(C52D2D[i][j])
|
||||
j += 1
|
||||
i += 1
|
||||
|
||||
i = 0
|
||||
while i < len(C12D3D):
|
||||
j = 0
|
||||
while j < len(C12D3D[0]):
|
||||
summeC12D3D.append(C12D3D[i][j])
|
||||
j += 1
|
||||
i += 1
|
||||
|
||||
i = 0
|
||||
while i < len(C22D3D):
|
||||
j = 0
|
||||
while j < len(C22D3D[0]):
|
||||
summeC22D3D.append(C22D3D[i][j])
|
||||
j += 1
|
||||
i += 1
|
||||
|
||||
i = 0
|
||||
while i < len(C32D3D):
|
||||
j = 0
|
||||
while j < len(C32D3D[0]):
|
||||
summeC32D3D.append(C32D3D[i][j])
|
||||
j += 1
|
||||
i += 1
|
||||
|
||||
i = 0
|
||||
while i < len(C42D3D):
|
||||
j = 0
|
||||
while j < len(C42D3D[0]):
|
||||
summeC42D3D.append(C42D3D[i][j])
|
||||
j += 1
|
||||
i += 1
|
||||
|
||||
i = 0
|
||||
while i < len(C52D3D):
|
||||
j = 0
|
||||
while j < len(C52D3D[0]):
|
||||
summeC52D3D.append(C52D3D[i][j])
|
||||
j += 1
|
||||
i += 1
|
||||
|
||||
|
||||
mean1 = np.mean(summeC12D2D)
|
||||
mean2 = np.mean(summeC22D2D)
|
||||
mean3 = np.mean(summeC32D2D)
|
||||
mean4 = np.mean(summeC42D2D)
|
||||
mean5 = np.mean(summeC52D2D)
|
||||
|
||||
mean6 = np.mean(summeC12D3D)
|
||||
mean7 = np.mean(summeC22D3D)
|
||||
mean8 = np.mean(summeC32D3D)
|
||||
mean9 = np.mean(summeC42D3D)
|
||||
mean10 = np.mean(summeC52D3D)
|
||||
|
||||
std1 = np.std(summeC12D2D)
|
||||
std2 = np.std(summeC22D2D)
|
||||
std3 = np.std(summeC32D2D)
|
||||
std4 = np.std(summeC42D2D)
|
||||
std5 = np.std(summeC52D2D)
|
||||
|
||||
std6 = np.std(summeC12D3D)
|
||||
std7 = np.std(summeC22D3D)
|
||||
std8 = np.std(summeC32D3D)
|
||||
std9 = np.std(summeC42D3D)
|
||||
std10 = np.std(summeC52D3D)
|
||||
|
||||
# i = 0
|
||||
# while i < len(C12D2D):
|
||||
# j = 0
|
||||
# while j < len(C12D2D[0]):
|
||||
# summeC12D2D.append(C12D2D[i][j])
|
||||
# j += 1
|
||||
# i += 1
|
||||
|
||||
|
||||
# print summeC12D2D
|
||||
|
||||
# i = 0
|
||||
# minimum2 = 100
|
||||
# while i < len(C22D2D):
|
||||
# print np.mean(C22D2D[i])
|
||||
# if np.mean(C22D2D[i]) < minimum2:
|
||||
# minimum2 = np.mean(C22D2D[i])
|
||||
# i += 1
|
||||
#
|
||||
# i = 0
|
||||
# minimum3 = 100
|
||||
# while i < len(C32D2D):
|
||||
# print np.mean(C32D2D[i])
|
||||
# if np.mean(C32D2D[i]) < minimum3:
|
||||
# minimum3 = np.mean(C32D2D[i])
|
||||
# i += 1
|
||||
#
|
||||
# i = 0
|
||||
# minimum4 = 100
|
||||
# while i < len(C42D2D):
|
||||
# print np.mean(C42D2D[i])
|
||||
# if np.mean(C42D2D[i]) < minimum4:
|
||||
# minimum4 = np.mean(C42D2D[i])
|
||||
# i += 1
|
||||
#
|
||||
# i = 0
|
||||
# minimum5 = 100
|
||||
# while i < len(C52D2D):
|
||||
# print np.mean(C52D2D[i])
|
||||
# if np.mean(C52D2D[i]) < minimum5:
|
||||
# minimum5 = np.mean(C52D2D[i])
|
||||
# i += 1
|
||||
#
|
||||
# i = 0
|
||||
# minimum6 = 100
|
||||
# while i < len(C12D3D):
|
||||
# print np.mean(C12D3D[i])
|
||||
# if np.mean(C12D3D[i]) < minimum6:
|
||||
# minimum6 = np.mean(C12D3D[i])
|
||||
# i += 1
|
||||
#
|
||||
# i = 0
|
||||
# minimum7 = 100
|
||||
# while i < len(C22D3D):
|
||||
# print np.mean(C22D3D[i])
|
||||
# if np.mean(C22D3D[i]) < minimum7:
|
||||
# minimum7 = np.mean(C22D3D[i])
|
||||
# i += 1
|
||||
#
|
||||
# i = 0
|
||||
# minimum8 = 100
|
||||
# while i < len(C32D3D):
|
||||
# print np.mean(C32D3D[i])
|
||||
# if np.mean(C32D3D[i]) < minimum8:
|
||||
# minimum8 = np.mean(C32D3D[i])
|
||||
# i += 1
|
||||
#
|
||||
# i = 0
|
||||
# minimum9 = 100
|
||||
# while i < len(C42D3D):
|
||||
# print np.mean(C42D3D[i])
|
||||
# if np.mean(C42D3D[i]) < minimum9:
|
||||
# minimum9 = np.mean(C42D3D[i])
|
||||
# i += 1
|
||||
|
||||
# i = 0
|
||||
# minimum10 = 100
|
||||
# while i < len(C52D3D):
|
||||
# print np.mean(C52D3D[i])
|
||||
# if np.mean(C52D3D[i]) < minimum10:
|
||||
# minimum10 = np.mean(C52D3D[i])
|
||||
# i += 1
|
||||
#
|
||||
mean2D2D = [mean1,mean2,mean3,mean4,mean5]
|
||||
mean2D3D = [mean6,mean7,mean8,mean9,mean10]
|
||||
|
||||
std2D2D = [std1,std2,std3,std4,std5]
|
||||
std2D3D = [std6,std7,std8,std9,std10]
|
||||
|
||||
# print minimum1
|
||||
|
||||
# i = 0
|
||||
# minimum2 = 100
|
||||
# while i < 5:
|
||||
# if np.mean(C12D2D[i]) < minimum:
|
||||
# minimum1 = np.mean(C12D2D[i])
|
||||
# i += 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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.4,1.4,2.4,3.4,4.4]
|
||||
x2 = [0.45,1.45,2.45,3.45,4.45]
|
||||
# x3 = [0.5,1.5,2.5,3.5,4.5]
|
||||
x4 = [0.55,1.55,2.55,3.55,4.55]
|
||||
# x5 = [0.6,1.6,2.6,3.6,4.6]
|
||||
|
||||
fig = plt.figure(figsize=(14.0, 10.0))
|
||||
|
||||
|
||||
|
||||
ax = fig.add_subplot(111)
|
||||
|
||||
# print mean2D2D
|
||||
# print mean2D3D
|
||||
|
||||
# ax.axhline(linewidth=2, y = np.mean(mean2D2D),color='r')
|
||||
# ax.axhline(linewidth=2, y = np.mean(mean2D3D),color='blue')
|
||||
|
||||
# ax.axhline(linewidth=2, y = minvaluevalue,color='black')
|
||||
|
||||
# ax.text(0.98, Participantmeanvalue+0.5, "Mean %.2f" % Participantmeanvalue,fontsize=12, fontweight='bold',color='r')
|
||||
# ax.text(0.98, maxvaluevalue+0.5, "Maximum %.2f" % maxvaluevalue,fontsize=12, fontweight='bold',color='black')
|
||||
# ax.text(0.98, minvaluevalue+0.5, "Minimum %.2f" % minvaluevalue,fontsize=12, fontweight='bold', color='black')
|
||||
|
||||
# rects1 = ax.bar(ind, Participantmean,width, color='r',edgecolor='black',)#, hatch='//')
|
||||
rects1 = ax.errorbar(x2, mean2D2D,yerr=[std2D2D,std2D2D],fmt='o',color='red',ecolor='red',lw=3, capsize=5, capthick=2)
|
||||
plt.plot(x2, mean2D2D, marker="o", linestyle='-',lw=3,color='red',label = r'2D-to-2D')
|
||||
|
||||
rects2 =ax.errorbar(x4, mean2D3D,yerr=[std2D3D,std2D3D],fmt='o',color='blue',ecolor='blue',lw=3, capsize=5, capthick=2)
|
||||
plt.plot(x4, mean2D3D, marker="o", linestyle='-',lw=3,color='blue', label = r'2D-to-3D')
|
||||
|
||||
legend(fontsize=20,loc='upper right')
|
||||
|
||||
# rects3 = ax.errorbar(x3, meanC3,yerr=[stdC3,stdC3],fmt='o',color='black',ecolor='black',lw=3, capsize=5, capthick=2)
|
||||
# plt.plot(x3, meanC3, marker="o", linestyle='-',lw=3,color='black')
|
||||
#
|
||||
# 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='orange',ecolor='orange',lw=3, capsize=5, capthick=2)
|
||||
# plt.plot(x5, meanC5, marker="o", linestyle='-',lw=3,color='orange')
|
||||
|
||||
|
||||
ax.set_ylabel(r'Angular Error',fontsize=22)
|
||||
ax.set_xlabel(r'Number of Calibration Depths',fontsize=22)
|
||||
ax.set_xticks(ind+0.25)
|
||||
ax.set_xticklabels( ('D1', 'D2', 'D3','D4', 'D5') ,fontsize=18)
|
||||
|
||||
TOPICs = [0.0,0.5,1.5,2.5,3.5,4.5,5.0]#,110]#,120]
|
||||
print TOPICs
|
||||
LABELs = ["",r'1',r'2', r'3', r'4', r'5', ""]#, ""]#, ""]
|
||||
|
||||
# fig.canvas.set_window_title('Distance Error Correlation')
|
||||
plt.xticks(TOPICs, LABELs,fontsize=18)
|
||||
|
||||
# legend([rects1,rects2], [r'\LARGE\textbf{2D2D}', r'\LARGE\textbf{2D3D}'], loc='lower right')
|
||||
|
||||
TOPICS = [0.5,1,1.5,2,2.5,3,3.5,4,4.5,5]#,110]#,120]
|
||||
print TOPICS
|
||||
LABELS = [r'0.5', r'1',r'1.5', r'2',r'2.5', r'3',r'3.5', r'4',r'4.5',r'5']#, ""]#, ""]
|
||||
|
||||
# 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()
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue