|
|
@@ -33,7 +33,7 @@ def clean_data(df):
|
|
|
# Single-pass boolean indexing (extremely fast)
|
|
|
return df[(df["total_time"] >= lower) & (df["total_time"] <= upper)]
|
|
|
|
|
|
-def plot_time_vs_param(csv_files, param, fixed_param=None, fixed_value=None, max_value=0, path="", name="", bw=False):
|
|
|
+def plot_time_vs_param(csv_files, param, fixed_param=None, fixed_value=None, max_value=0, o_path="", name="", bw=False):
|
|
|
results = {}
|
|
|
models = []
|
|
|
for path in csv_files:
|
|
|
@@ -91,8 +91,11 @@ def plot_time_vs_param(csv_files, param, fixed_param=None, fixed_value=None, max
|
|
|
# Set directory relative to script parent
|
|
|
script_dir = Path(__file__).resolve().parent
|
|
|
output_dir = script_dir / "Plots"
|
|
|
- if path:
|
|
|
- output_dir = output_dir / path
|
|
|
+ if o_path:
|
|
|
+ print(f"Output directory: {output_dir}")
|
|
|
+ output_dir = output_dir / o_path
|
|
|
+ print(f"Output directory: {output_dir}")
|
|
|
+
|
|
|
output_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
|
output_file = output_dir / f"{final_name}.png"
|
|
|
@@ -120,13 +123,11 @@ def main():
|
|
|
parser_tvn = subparsers.add_parser("number", help="Plot total time vs number")
|
|
|
parser_tvn.add_argument("--bw", action="store_true", help="Black and white / Colorblind friendly mode")
|
|
|
parser_tvn.add_argument("csv_files", nargs="+", type=Path, help="CSV files to process")
|
|
|
- parser_tvparam.add_argument("-p", "--path", type=str, default="", help="the subdirectory where the plots will be stored")
|
|
|
+ parser_tvn.add_argument("-p", "--path", type=str, default="", help="the subdirectory where the plots will be stored")
|
|
|
parser_tvn.add_argument("-n", "--name", type=str, help="Name of output file")
|
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
- import time
|
|
|
- start_time = time.time()
|
|
|
if args.command == "param":
|
|
|
if args.width is not None:
|
|
|
fixed_param, fixed_value = "width", args.width
|
|
|
@@ -136,10 +137,9 @@ def main():
|
|
|
varying_param = "width"
|
|
|
plot_time_vs_param(args.csv_files, param=varying_param,
|
|
|
fixed_param=fixed_param, fixed_value=fixed_value,
|
|
|
- max_value=args.max, path=args.path, name=args.name, bw=args.bw)
|
|
|
+ max_value=args.max, o_path=args.path, name=args.name, bw=args.bw)
|
|
|
elif args.command == "number":
|
|
|
- plot_time_vs_param(args.csv_files, param="number", path=args.path, name=args.name, bw=args.bw)
|
|
|
- print(f"Time Rendering: {time.time() - start_time}")
|
|
|
+ plot_time_vs_param(args.csv_files, param="number", o_path=args.path, name=args.name, bw=args.bw)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
main()
|