-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnormalised_hist.py
More file actions
114 lines (98 loc) · 3.67 KB
/
normalised_hist.py
File metadata and controls
114 lines (98 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
fontsize =12
from matplotlib import ft2font
#vertices histogram after
df = pd.read_csv('csv/Princeton_remeshed_normalized_basic_mesh_info.csv')
vertices = df['n_vertices']
plt.clf()
plt.hist(vertices, color='plum', bins = 80)
plt.xlabel('number_of_vertices')
plt.ylabel('frequency')
plt.title("Distribution of number of vertices after normalization")
plt.xlim(xmin = 0, xmax = 20000)
plt.savefig("resample_plots/normalized_vertices")
plt.show()
#faces histogram after
df = pd.read_csv('csv/Princeton_remeshed_normalized_basic_mesh_info.csv')
faces = df['n_faces']
plt.hist(faces, color='plum')
plt.xlabel('number_of_faces')
plt.ylabel('frequency')
plt.title("Distribution of number of faces after normalization")
plt.xlim(xmin = 0, xmax = 20000)
plt.savefig("resample_plots/normalized_faces")
plt.show()
#centroid after translation histogram
#axis is very small here because of centralised data (mention in report)
df = pd.read_csv('csv/Princeton_remeshed_normalized_basic_mesh_info.csv')
centroid_origin = df['d_centroid_origin']
plt.hist(centroid_origin, range=[0,1.1], bins = 100, color='plum')#range =[0.000000003, 0.00000001], bins = 15, color='plum')
plt.xlabel('distance centroid to origin')
plt.ylabel('frequency')
plt.title("Translation distribution after normalization")
#plt.xlim(xmin = 0.00000000003, xmax = 0.)
#print(centroid_origin)
plt.savefig("resample_plots/translation_after")
plt.show()
#alignment after distribution
csv_name ="./csv/Princeton_remeshed_normalized_alignment.csv"
csv_file_name = csv_name.split("/")[-1]
#print('File Name:', csv_name.split("\\")[-1])
print(csv_name)
df = pd.read_csv(csv_name)
#plt_histogram(df,csv_file_name)
df_raw =df
#data_dict = df_raw.to_dict()
plt_name = csv_file_name.split('.')[:1]
plt_name = str(plt_name[0])
#
fontsize =12
df_raw.hist(column=['alignment_x'], bins=100, color='plum', range = [0,1])
plt.suptitle(plt_name, fontsize=fontsize)
plt.ylabel("frequency")
plt.xlabel("$|e_1 \cdot x|$")
plt.savefig("resample_plots/alignment_x_after")
df_raw.hist(column=['alignment_y'], bins=100, color='plum', range = [0,1] )
plt.suptitle(plt_name, fontsize=fontsize)
plt.ylabel("frequency")
plt.xlabel("$|e_2 \cdot y|$")
plt.savefig("resample_plots/alignment_y_after")
df_raw.hist(column=['alignment_z'], bins=100, color='plum', range = [0,1])
plt.suptitle(plt_name, fontsize=fontsize)
plt.ylabel("frequency")
plt.xlabel("$|e_3 \cdot z|$")
plt.savefig("resample_plots/alignment_z_after")
plt.show()
#scaling distribution after normalization
csv_name ="./csv/Princeton_remeshed_normalized_basic_mesh_info.csv"
plt_name = "scale after normalization"
df = pd.read_csv(csv_name)
print(len(df["scale"]))
plt.hist(df["scale"], color='plum', bins=np.arange(0, 3, 0.05))
plt.xlim([0, 3])
#plt.ylim([0, 220])
plt.suptitle(plt_name, fontsize=fontsize)
plt.ylabel("frequency")
plt.xlabel("length of diagonal box of the axis aligned bounding box")
plt.savefig("resample_plots/scaling_after")
plt.show()
#flipping distribution after normalization
csv_name ="./csv/Princeton_remeshed_normalized_flipping.csv"
plt_name = "Flipping distribution after normalization"
plt.figure(2)
df = pd.read_csv(csv_name)
cx = df['flip_x'].value_counts()[1]
cy = df['flip_y'].value_counts()[1]
cz = df['flip_z'].value_counts()[1]
print(cx,cy,cz)
data = {'flip_x': cx, 'flip_y': cy, 'flip_z': cz}
df = pd.Series(data)
plt.bar(range(len(df)), df.values, align='center', color='plum', width = 0.3)
plt.xticks(range(len(df)), df.index.values, size='small')
plt.suptitle(plt_name, fontsize=fontsize)
plt.ylabel("frequency")
plt.xlabel("number of meshes with correct orientation in each dimension")
plt.savefig("resample_plots/flipping_after")
plt.show()