Skip to content
Snippets Groups Projects
Commit 3d1c99ee authored by MARMORET Axel's avatar MARMORET Axel
Browse files

REmoving old files

parent a2d4f102
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 291 deletions
import pandas as pd
from IPython.display import display
import numpy as np
import itertools
def display_experimental_results(data, conditions, metrics, emphasis = None):
assert data.shape[-1] == len(metrics), f"Wrong number of metrics: {data.shape[-1]} != {len(metrics)}"
if type(conditions) == list:
conditions = np.array(conditions, dtype=object)
if len(conditions.shape) == 1 and type(conditions[0]) not in [list, tuple, np.ndarray]:
indexes = conditions
elif len(conditions.shape) > 1 or (len(conditions.shape) == 1 and type(conditions) in [list, tuple, np.ndarray]):
indexes = np.array(list(itertools.product(*conditions))) # cartesian_product
else:
raise NotImplementedError(f"Wrong format of conditions: {conditions}")
dataframe = pd.DataFrame(data, columns = metrics, index = indexes)
if emphasis is not None:
display(dataframe.style.bar(subset=emphasis, color='#5fba7d'))
else:
display(dataframe)
def find_best_condition(data, conditions):
if type(conditions) == list:
conditions = np.array(conditions, dtype=object)
if len(conditions.shape) == 1 and type(conditions[0]) not in [list, tuple, np.ndarray]:
best_arg = np.argmax(data)
best_val = conditions[best_arg]
return best_val
elif len(conditions.shape) > 1 or (len(conditions.shape) == 1 and type(conditions) in [list, tuple, np.ndarray]):
best_arg_flatten = np.argmax(data)
best_arg_tuple = np.unravel_index(best_arg_flatten, data.shape)
best_vals = []
for idx, best_arg in enumerate(best_arg_tuple):
best_vals.append(conditions[idx][best_arg])
return np.array(best_vals)
This diff is collapsed.
0.0000000 0.0724025 #
0.0724025 10.7549584 12
10.7549584 23.2316045 [16-2
23.2316045 24.9532922 [2]
24.9532922 37.3862839 -2+16]
37.3862839 51.7694538 16
51.7694538 65.8598710 16
65.8598710 78.2168012 [16-2
78.2168012 80.0872424 [2]
80.0872424 85.4207180 -2+8]
85.4207180 99.6379025 16
99.6379025 113.8518268 16
113.8518268 129.8919434 16+2
129.8919434 140.5222138 12
140.5222138 149.4280470 10
149.4280470 163.6359304 16
163.6359304 175.9931888 [16-2
175.9931888 177.8596824 [2]
177.8596824 188.5298626 -2+16]
188.5298626 202.7271115 16
202.7271115 205.9023439 x
205.9023439 209.2920650 #
type I
pulses 16
0.0000000 0.0588499 #
0.0588499 9.6587452 8
9.6587452 28.8511890 16
28.8511890 57.6572819 24
57.6572819 76.8344662 16
76.8344662 93.6544910 12+2
93.6544910 112.8550840 16
112.8550840 122.4536460 8
122.4536460 132.0383322 -8+16
132.0383322 160.8548318 24
160.8548318 180.0531330 16
180.0531330 196.8485721 12+2
196.8485721 218.6629395 16+2
218.6629395 222.7426553 #
type III
pulses 24,16,12
0.0000000 0.8274155 #
0.8274155 18.5822838 16
18.5822838 36.3576997 16
36.3576997 54.1058108 16
54.1058108 71.8894682 16
71.8894682 87.4650666 16-2
87.4650666 105.2445422 16
105.2445422 125.2467135 16&2
125.2467135 134.1082233 -8+16
134.1082233 149.6817307 16-2
149.6817307 167.4674791 16
167.4674791 191.9458819 16+4
191.9458819 195.4183389 #
type I
pulses 16
0.0000000 0.0625000 #
0.0625000 11.2051574 8
11.2051574 22.3629358 8
22.3629358 44.6824407 16
44.6824407 55.8520639 8
55.8520639 78.1794653 16
78.1794653 100.5029185 16
100.5029185 122.8303200 16
122.8303200 134.0038914 8
134.0038914 156.3273446 16
156.3273446 178.6507978 16
178.6507978 200.9703027 16
200.9703027 212.1359776 8
212.1359776 234.4752238 16
234.4752238 239.2091857 x>
239.2091857 242.5652248 #
type II
pulses 16,8
0.0000000 0.1719582 #
0.1719582 3.7418903 4
3.7418903 10.8527088 8
10.8527088 23.2978679 16-2
23.2978679 37.5195049 16
37.5195049 51.7386881 16
51.7386881 65.9603250 16
65.9603250 83.7398249 16+4
83.7398249 90.8474701 8
90.8474701 105.0715248 16
105.0715248 119.2851184 16
119.2851184 133.5126354 16
133.5126354 151.3161766 16+4
151.3161766 153.0716903 2
153.0716903 167.2931988 16
167.2931988 170.8629309 4
170.8629309 183.2947815 16-2
183.2947815 197.5093347 16
197.5093347 215.2892933 16+4
215.2892933 218.7958636 4
218.7958636 225.0382646 x>
225.0382646 228.1475894 #
type I
pulses 16
0.0000000 0.0585525 #
0.0585525 1.0539451 x
1.0539451 5.0564270 4
5.0564270 17.0638729 12
17.0638729 25.0562898 8
25.0562898 41.0620352 16
41.0620352 53.0402048 12
53.0402048 69.0584972 16
69.0584972 77.0592788 8
77.0592788 93.0566596 16
93.0566596 105.0599231 12
105.0599231 121.0614862 16
121.0614862 140.5594703 16&3.5
140.5594703 154.5493367 12&2
154.5493367 170.5550821 16
170.5550821 186.5566452 16
186.5566452 202.9053411 16
202.9053411 206.6243882 #
type II
pulses 16,12
0.0000000 0.0919470 #
0.0919470 3.9931265 x
3.9931265 19.7291975 16
19.7291975 35.4687381 16
35.4687381 51.2066553 16
51.2066553 68.9143159 16+2
68.9143159 84.6455560 16
84.6455560 100.3834731 16
100.3834731 104.3229602 4
104.3229602 120.0706302 16
120.0706302 135.7921174 16
135.7921174 153.4997781 16+2
153.4997781 169.2443723 16
169.2443723 184.9822894 16
184.9822894 200.7135294 16
200.7135294 216.4581237 16
216.4581237 234.1631675 16+2
234.1631675 249.8915434 16
249.8915434 265.6496656 16
265.6496656 281.3706049 16
281.3706049 295.9463102 x>
295.9463102 298.7288915 #
type I
pulses 16
0.0000000 0.0650000 #
0.0650000 1.9639215 2
1.9639215 9.5249987 8
9.5249987 24.6408849 16
24.6408849 43.5152523 16&4
43.5152523 58.6428471 16
58.6428471 73.7762963 16
73.7762963 88.8696560 16
88.8696560 107.7939008 16&4
107.7939008 122.8865495 16
122.8865495 138.0125891 16
138.0125891 153.1219332 16
153.1219332 168.2646681 16
168.2646681 183.2270896 16
183.2270896 189.1631449 x
189.1631449 192.2556708 #
type I
pulses 16
0.0000000 0.0740494 #
0.0740494 3.8752516 x
3.8752516 10.7453897 8
10.7453897 24.4774382 16
24.4774382 38.1848036 16
38.1848036 51.9003967 16
51.9003967 65.6159899 16
65.6159899 79.3068998 16
79.3068998 93.0389484 16
93.0389484 99.9056056 8
99.9056056 113.6613879 16
113.6613879 127.3203364 16
127.3203364 141.0223221 16
141.0223221 154.7619655 16
154.7619655 168.4693309 16
168.4693309 182.1766963 16
182.1766963 195.4321705 16
195.4321705 202.7592630 8
202.7592630 216.4451098 16
216.4451098 230.1524752 16
230.1524752 243.8867389 16
243.8867389 257.6178381 16
257.6178381 271.4283145 16
271.4283145 277.0614408 #
type I
pulses 16
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment