5
5
import numpy as np
6
6
import re
7
7
8
+
8
9
def read_sec2_resultat (file : str ):
9
10
res_sec2 = []
10
11
with open (file , "r" ) as f :
11
12
lines = f .readlines ()
12
13
for i in range (len (lines )):
13
- if ( lines [i ].startswith ("nb particules" ) ):
14
+ if lines [i ].startswith ("nb particules" ):
14
15
li = lines [i ].split (None )
15
16
nb_photon = int (li [3 ])
16
17
res_sec2 .append (nb_photon )
17
-
18
+
18
19
return res_sec2
19
20
21
+
20
22
def read_current_resultat (file : str ):
21
23
res_current_1000 = []
22
24
res_current_1400 = []
23
-
25
+
24
26
df = pd .read_csv (file )
25
27
for index , r in df .iterrows ():
26
28
if r ["elevation" ] == 1000 :
27
29
res_current_1000 .append (r ["n_photons" ])
28
30
else :
29
31
res_current_1400 .append (r ["n_photons" ])
30
-
32
+
31
33
return res_current_1000 , res_current_1400
32
34
35
+
33
36
def read_resultat_plant (file : str ):
34
37
id = []
35
38
photons = []
36
39
df = pd .read_csv (file )
37
40
for index , r in df .iterrows ():
38
41
id .append (r [id ])
39
42
photons .append (r [n_photons ])
40
-
43
+
41
44
return id , photons
42
45
46
+
43
47
if __name__ == "__main__" :
44
48
res_sec2 = read_sec2_resultat ("res_sec2/mesures.txt" )
45
- res_current_1000 , res_current_1400 = read_current_resultat ("res_final/captor_result-1000000000-655-665-nm.csv" )
49
+ res_current_1000 , res_current_1400 = read_current_resultat (
50
+ "res_final/captor_result-1000000000-655-665-nm.csv"
51
+ )
46
52
res_cur = res_current_1000 + res_current_1400
47
-
53
+
48
54
res_sec2 = read_sec2_resultat ("res_sec2/mesures.txt" )
49
- res_old_1000 , res_old_1400 = read_current_resultat ("res_final/captor_result-1000000000-655-665-nm_ancien.csv" )
55
+ res_old_1000 , res_old_1400 = read_current_resultat (
56
+ "res_final/captor_result-1000000000-655-665-nm_ancien.csv"
57
+ )
50
58
res_old = res_old_1000 + res_old_1400
51
-
52
- res_cor_diffuse_1000 , res_cor_diffuse_1400 = read_current_resultat ("res_final/captor_result-1000000000-655-665-nm_correctDiffuse.csv" )
59
+
60
+ res_cor_diffuse_1000 , res_cor_diffuse_1400 = read_current_resultat (
61
+ "res_final/captor_result-1000000000-655-665-nm_correctDiffuse.csv"
62
+ )
53
63
res_cor_diffuse = res_cor_diffuse_1000 + res_cor_diffuse_1400
54
-
55
- res_cor_tnear_1000 , res_cor_tnear_1400 = read_current_resultat ("res_final/captor_result-1000000000-655-665-nm_correctTnear.csv" )
64
+
65
+ res_cor_tnear_1000 , res_cor_tnear_1400 = read_current_resultat (
66
+ "res_final/captor_result-1000000000-655-665-nm_correctTnear.csv"
67
+ )
56
68
res_cor_tnear = res_cor_tnear_1000 + res_cor_tnear_1400
57
-
58
- res_cor_captor_dir_1000 , res_cor_captor_dir_1400 = read_current_resultat ("res_final/captor_result-1000000000-655-665-nm_BackfaceCaptor.csv" )
69
+
70
+ res_cor_captor_dir_1000 , res_cor_captor_dir_1400 = read_current_resultat (
71
+ "res_final/captor_result-1000000000-655-665-nm_BackfaceCaptor.csv"
72
+ )
59
73
res_cor_captor_dir = res_cor_captor_dir_1000 + res_cor_captor_dir_1400
60
-
61
- res_cor_captor_geo_1000 , res_cor_captor_geo_1400 = read_current_resultat ("res_final/captor_result-1000000000-655-665-nm.csv" )
74
+
75
+ res_cor_captor_geo_1000 , res_cor_captor_geo_1400 = read_current_resultat (
76
+ "res_final/captor_result-1000000000-655-665-nm.csv"
77
+ )
62
78
res_cor_captor_geo = res_cor_captor_geo_1000 + res_cor_captor_geo_1400
63
-
64
- res_cor_illum_1000 , res_cor_illum_1400 = read_current_resultat ("res_final/captor_result-1000000000-655-665-nm_correctIllumination.csv" )
79
+
80
+ res_cor_illum_1000 , res_cor_illum_1400 = read_current_resultat (
81
+ "res_final/captor_result-1000000000-655-665-nm_correctIllumination.csv"
82
+ )
65
83
res_cor_illum = res_cor_illum_1000 + res_cor_illum_1400
66
-
67
- res_lcg_1000 , res_lcg_1400 = read_current_resultat ("res_final/captor_result-1000000000-655-665-nm_RAND.csv" )
84
+
85
+ res_lcg_1000 , res_lcg_1400 = read_current_resultat (
86
+ "res_final/captor_result-1000000000-655-665-nm_RAND.csv"
87
+ )
68
88
res_lcg = res_lcg_1000 + res_lcg_1400
69
-
70
- res_xoroshiro_1000 , res_xoroshiro_1400 = read_current_resultat ("res_final/captor_result-1000000000-655-665-nm_xoroshiro.csv" )
89
+
90
+ res_xoroshiro_1000 , res_xoroshiro_1400 = read_current_resultat (
91
+ "res_final/captor_result-1000000000-655-665-nm_xoroshiro.csv"
92
+ )
71
93
res_xoroshiro = res_xoroshiro_1000 + res_xoroshiro_1400
72
-
73
- res_splitmix_1000 , res_splitmix_1400 = read_current_resultat ("res_final/captor_result-1000000000-655-665-nm_SplitMix.csv" )
94
+
95
+ res_splitmix_1000 , res_splitmix_1400 = read_current_resultat (
96
+ "res_final/captor_result-1000000000-655-665-nm_SplitMix.csv"
97
+ )
74
98
res_splitmix = res_splitmix_1000 + res_splitmix_1400
75
-
99
+
76
100
x = range (0 , len (res_sec2 ))
77
- plt .plot (x , res_sec2 , 'r' )
78
- plt .plot (x , res_cur , 'g' )
101
+ plt .plot (x , res_sec2 , "r" )
102
+ plt .plot (x , res_cur , "g" )
79
103
plt .legend (["Resultat SEC2" , "Current resultat" ])
80
104
plt .title ("Wavelength 655-665 nm" )
81
105
plt .ylabel ("Nb of photon" )
82
106
plt .xlabel ("Index of captor" )
83
107
plt .show ()
84
-
108
+
85
109
res_dif = [
86
- # Correct Bug
87
- #np.subtract(res_cor_diffuse, res_sec2),
88
- #np.subtract(res_cor_tnear, res_sec2),
89
- #np.subtract(res_cor_captor_dir, res_sec2),
90
- #np.subtract(res_cor_captor_geo, res_sec2)
91
- np .subtract (res_cor_captor_dir , res_sec2 ),
92
- np .subtract (res_cor_captor_geo , res_sec2 )
93
-
94
- #PRNG test
95
- #np.subtract(res_cur, res_sec2),
96
- #np.subtract(res_lcg, res_sec2),
97
- #np.subtract(res_splitmix, res_sec2),
98
- #np.subtract(res_xoroshiro, res_sec2)
110
+ # Correct Bug
111
+ # np.subtract(res_cor_diffuse, res_sec2),
112
+ # np.subtract(res_cor_tnear, res_sec2),
113
+ # np.subtract(res_cor_captor_dir, res_sec2),
114
+ # np.subtract(res_cor_captor_geo, res_sec2)
115
+ np .subtract (res_cor_captor_dir , res_sec2 ),
116
+ np .subtract (res_cor_captor_geo , res_sec2 ),
117
+ # PRNG test
118
+ # np.subtract(res_cur, res_sec2),
119
+ # np.subtract(res_lcg, res_sec2),
120
+ # np.subtract(res_splitmix, res_sec2),
121
+ # np.subtract(res_xoroshiro, res_sec2)
99
122
]
100
123
labels = [
101
- # Correct Bug
102
- #"Correct Diffuse & Speculaire",
103
- #"Correct Tnear",
104
- #"Correct Back-face Culling",
105
- #"Correct Captor Geo",
106
-
107
-
108
- "Ignorer les faces arrière" ,
109
- "Modifier la géométrie de capteur"
110
-
111
- # PRNG test
112
- #"PCG",
113
- #"LCG",
114
- #"SplitMix",
115
- #"Xoroshiro"
124
+ # Correct Bug
125
+ # "Correct Diffuse & Speculaire",
126
+ # "Correct Tnear",
127
+ # "Correct Back-face Culling",
128
+ # "Correct Captor Geo",
129
+ "Ignorer les faces arrière" ,
130
+ "Modifier la géométrie de capteur" ,
131
+ # PRNG test
132
+ # "PCG",
133
+ # "LCG",
134
+ # "SplitMix",
135
+ # "Xoroshiro"
116
136
]
117
-
118
- #plt.title("La différence entre le résultat de notre moteur et SEC2")
119
- #plt.ylabel("Nb of photon")
120
- #plt.boxplot(res_dif, patch_artist=False, labels=labels)
121
- #plt.show()
122
-
123
- #x = ["PCG", "LCG", "SplitMix", "Xoroshiro"]
124
- #y = [288.5, 292.2, 298.1, 291.8]
125
- #plt.bar(x, y)
126
- #plt.title("Performance according to PRNG")
127
- #plt.ylabel("Times (s)")
128
- #plt.xlabel("Pseudo random number generator")
129
- #plt.show()
130
-
131
- #x = [1,2,4,8]
132
- #y = [1298.5, 662.6, 346.4, 263.72]
133
- #y = [1442.3, 734.8, 380.4, 286.3]
134
- #plt.plot(x, y, '-s')
135
- #plt.title("Performances avec des différents nombre de threads")
136
- #plt.ylabel("Temps (s)")
137
- #plt.xlabel("Nombre de threads")
138
- #plt.show()
139
-
140
- #x = ["SEC2", "Notre moteur original", "Notre moteur courrant"]
141
- #y = [2113, 1264, 286]
142
- #plt.bar(x, y)
143
- #plt.title("Performance de chaque version de moteur")
144
- #plt.ylabel("Temps (s)")
145
- #plt.xlabel("Version de moteur")
146
- #plt.show()
147
-
148
- # xls = pd.ExcelFile(r"simuMesureExpes12_tout.xls") # use r before absolute file path
137
+
138
+ # plt.title("La différence entre le résultat de notre moteur et SEC2")
139
+ # plt.ylabel("Nb of photon")
140
+ # plt.boxplot(res_dif, patch_artist=False, labels=labels)
141
+ # plt.show()
142
+
143
+ # x = ["PCG", "LCG", "SplitMix", "Xoroshiro"]
144
+ # y = [288.5, 292.2, 298.1, 291.8]
145
+ # plt.bar(x, y)
146
+ # plt.title("Performance according to PRNG")
147
+ # plt.ylabel("Times (s)")
148
+ # plt.xlabel("Pseudo random number generator")
149
+ # plt.show()
150
+
151
+ # x = [1,2,4,8]
152
+ # y = [1298.5, 662.6, 346.4, 263.72]
153
+ # y = [1442.3, 734.8, 380.4, 286.3]
154
+ # plt.plot(x, y, '-s')
155
+ # plt.title("Performances avec des différents nombre de threads")
156
+ # plt.ylabel("Temps (s)")
157
+ # plt.xlabel("Nombre de threads")
158
+ # plt.show()
159
+
160
+ # x = ["SEC2", "Notre moteur original", "Notre moteur courrant"]
161
+ # y = [2113, 1264, 286]
162
+ # plt.bar(x, y)
163
+ # plt.title("Performance de chaque version de moteur")
164
+ # plt.ylabel("Temps (s)")
165
+ # plt.xlabel("Version de moteur")
166
+ # plt.show()
167
+
168
+ # xls = pd.ExcelFile(r"simuMesureExpes12_tout.xls") # use r before absolute file path
149
169
150
170
# res_simulation = xls.parse(0) #2 is the sheet number+1 thus if the file has only 1 sheet write 0 in paranthesis
151
171
@@ -164,7 +184,6 @@ def read_resultat_plant(file: str):
164
184
# res_725_735 = res_simulation['725_735_cptNormM2_sim']
165
185
# res_735_800 = res_simulation['735_800_cptNormM2_sim']
166
186
167
-
168
187
# res_exp_1_1000 = {
169
188
# '400_445': [],
170
189
# '655_665': [],
@@ -200,7 +219,6 @@ def read_resultat_plant(file: str):
200
219
# res_exp_1_1400['655_665'].append(res_655_665[i])
201
220
# res_exp_1_1400['735_800'].append(res_735_800[i])
202
221
203
-
204
222
# dir = "./res/"
205
223
# for file in os.listdir(dir):
206
224
# if file.startswith("captor_result"):
@@ -217,7 +235,6 @@ def read_resultat_plant(file: str):
217
235
# else:
218
236
# cur_res_exp_1_1400[band].append(r["n_photons"])
219
237
220
-
221
238
# x1_1000 = res_exp_1_1000['400_445']
222
239
# x2_1000 = res_exp_1_1000['655_665']
223
240
# x3_1000 = res_exp_1_1000['735_800']
0 commit comments