Skip to content

Commit

Permalink
Add argument to CLI to hide plots
Browse files Browse the repository at this point in the history
  • Loading branch information
mlojek committed Jan 14, 2025
1 parent 8a081b2 commit 306029e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/optilab/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
parser.add_argument(
"pickle_path", type=Path, help="Path to pickle file with optimization runs."
)
parser.add_argument(
"--hide_plots", action="store_true", help="Hide plots when running the script."
)
args = parser.parse_args()

filename_stem = args.pickle_path.stem
Expand All @@ -30,6 +33,7 @@
plot_convergence_curve(
data={run.model_metadata.name: run.logs for run in data},
savepath=f"{filename_stem}.convergence.png",
show=not args.hide_plots,
)

plot_ecdf_curves(
Expand All @@ -38,11 +42,13 @@
n_thresholds=100,
allowed_error=data[0].tolerance,
savepath=f"{filename_stem}.ecdf.png",
show=not args.hide_plots,
)

plot_box_plot(
data={run.model_metadata.name: run.bests_y() for run in data},
savepath=f"{filename_stem}.box_plot.png",
show=not args.hide_plots,
)

stats = pd.concat([run.stats() for run in data], ignore_index=True)
Expand Down

0 comments on commit 306029e

Please sign in to comment.