Commit 15670aa3 authored by Julien Lin's avatar Julien Lin
Browse files

multiple threshold

parent 9d228b9e
......@@ -14,7 +14,7 @@ def get_args_parse():
can.add_argument("--nb-run", type=int, default=10, help="number of runs")
can.add_argument(
"--quality-threshold", type=float, default=600, help="Quality threshold"
"--quality-threshold", type=float, default=660, nargs="+", help="Quality threshold"
)
can.add_argument(
......@@ -26,11 +26,11 @@ def get_args_parse():
return can
def main():
def main(eaf_args=None):
can = get_args_parse()
the = can.parse_args()
the = can.parse_args(eaf_args)
args = ["--solver", the.solver, "--iters", "2000", "--steady-delta", "500"]
......@@ -47,20 +47,30 @@ def main():
results = Parallel(n_jobs=num_cores)(delayed(f)(i) for i in range(the.nb_run))
fig = plt.figure()
ax3 = fig.add_subplot(111)
plt.title(f"{the.solver}, threshold {the.quality_threshold}")
values = [(val, iter) for val, iter, _, _ in results]
values = sorted(values, key=lambda el: el[1])
t = [iter for _, iter in values]
values = np.array([val for val, _ in values])
values = np.cumsum(values >= the.quality_threshold) / len(values)
buff = np.empty((1,the.nb_run))
for quality_threshold in the.quality_threshold:
curr_qualities = np.cumsum(values >= quality_threshold) / len(values)
curr_qualities = np.expand_dims(curr_qualities, axis=0)
buff = np.concatenate((buff,curr_qualities))
ax3.step(t, values)
fig = plt.figure()
ax3 = fig.add_subplot(121)
plt.title(f"{the.solver}, threshold {the.quality_threshold}")
for i in range(1, buff.shape[0]):
ax3.step(t, buff[i])
# ax4 = fig.add_subplot(122, projection="3d")
# plt.title(f"{the.solver}, thresholds : {the.quality_threshold}")
# ax4.plot_surface(t, values, the.quality_threshold )
plt.legend([f'threshold : {the.quality_threshold[i]}' for i in range(len(the.quality_threshold))])
plt.show()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment