@@ -162,7 +162,7 @@ def get_verified_aggregated_es_values(es_scores: dict, folder_name: str) -> dict
162162 return verified_es_values
163163
164164
165- def plot_ES_results (s_scores : dict , cli_args : argparse .Namespace ):
165+ def plot_ES_results (s_scores : dict , args : argparse .Namespace ):
166166 """
167167 Plot ES(t) curve
168168 """
@@ -179,8 +179,7 @@ def plot_ES_results(s_scores: dict, cli_args: argparse.Namespace):
179179 for (
180180 t_key ,
181181 score_data ,
182- ) in scores_dict .items (): # Change variable name to score_data
183- # Access the 'score' key from the nested dictionary
182+ ) in scores_dict .items ():
184183 if isinstance (score_data , dict ):
185184 score = score_data ["score" ]
186185 else :
@@ -234,8 +233,8 @@ def plot_ES_results(s_scores: dict, cli_args: argparse.Namespace):
234233 markersize = 6 ,
235234 )
236235
237- p = cli_args .negative_speedup_penalty
238- config = f"p = { p } , b = { cli_args .fpdb } "
236+ p = args .negative_speedup_penalty
237+ config = f"p = { p } , b = { args .fpdb } "
239238 fig .text (0.5 , 0.9 , config , ha = "center" , fontsize = 16 , style = "italic" )
240239
241240 ax .set_xlabel ("t" , fontsize = 18 )
@@ -253,51 +252,7 @@ def plot_ES_results(s_scores: dict, cli_args: argparse.Namespace):
253252 return fig , ax , all_x_coords
254253
255254
256- def main ():
257- """Main execution function for plotting ES(t)."""
258- parser = argparse .ArgumentParser (
259- description = "Calculate and plot ES(t) scores from benchmark results." ,
260- formatter_class = argparse .RawTextHelpFormatter ,
261- )
262- # Add arguments (same as plot_St)
263- parser .add_argument (
264- "--benchmark-path" ,
265- type = str ,
266- required = True ,
267- help = "Path to the benchmark log file or directory containing benchmark JSON files or sub-folders." ,
268- )
269- parser .add_argument (
270- "--output-dir" ,
271- type = str ,
272- default = "analysis_results" ,
273- help = "Output directory for saving the plot. Default: analysis_results" ,
274- )
275- parser .add_argument (
276- "--negative-speedup-penalty" ,
277- type = float ,
278- default = 0.0 ,
279- help = "Penalty power (p) for negative speedup. Formula: speedup**(p+1). Default: 0.0." ,
280- )
281- parser .add_argument (
282- "--fpdb" ,
283- type = float ,
284- default = 0.1 ,
285- help = "Base penalty for severe errors (e.g., crashes, correctness failures)." ,
286- )
287- parser .add_argument (
288- "--enable-aggregation-mode" ,
289- action = "store_true" ,
290- help = "Enable aggregation mode to verify aggregated/microscopic consistency. Default: enabled." ,
291- )
292- parser .add_argument (
293- "--disable-aggregation-mode" ,
294- dest = "enable_aggregation_mode" ,
295- action = "store_false" ,
296- help = "Disable aggregation mode verification." ,
297- )
298- parser .set_defaults (enable_aggregation_mode = True )
299- args = parser .parse_args ()
300-
255+ def main (args ):
301256 # 1. Scan folders to get data
302257 all_results = analysis_util .scan_all_folders (args .benchmark_path )
303258 if not all_results :
@@ -433,4 +388,45 @@ def main():
433388
434389
435390if __name__ == "__main__" :
436- main ()
391+ parser = argparse .ArgumentParser (
392+ description = "Calculate and plot ES(t) scores from benchmark results." ,
393+ formatter_class = argparse .RawTextHelpFormatter ,
394+ )
395+ parser .add_argument (
396+ "--benchmark-path" ,
397+ type = str ,
398+ required = True ,
399+ help = "Path to the benchmark log file or directory containing benchmark JSON files or sub-folders." ,
400+ )
401+ parser .add_argument (
402+ "--output-dir" ,
403+ type = str ,
404+ default = "analysis_results" ,
405+ help = "Output directory for saving the plot. Default: analysis_results" ,
406+ )
407+ parser .add_argument (
408+ "--negative-speedup-penalty" ,
409+ type = float ,
410+ default = 0.0 ,
411+ help = "Penalty power (p) for negative speedup. Formula: speedup**(p+1). Default: 0.0." ,
412+ )
413+ parser .add_argument (
414+ "--fpdb" ,
415+ type = float ,
416+ default = 0.1 ,
417+ help = "Base penalty for severe errors (e.g., crashes, correctness failures)." ,
418+ )
419+ parser .add_argument (
420+ "--enable-aggregation-mode" ,
421+ action = "store_true" ,
422+ help = "Enable aggregation mode to verify aggregated/microscopic consistency. Default: enabled." ,
423+ )
424+ parser .add_argument (
425+ "--disable-aggregation-mode" ,
426+ dest = "enable_aggregation_mode" ,
427+ action = "store_false" ,
428+ help = "Disable aggregation mode verification." ,
429+ )
430+ parser .set_defaults (enable_aggregation_mode = True )
431+ args = parser .parse_args ()
432+ main (args )
0 commit comments