@@ -20,34 +20,36 @@ def main():
2020 test_name = "F3OF DT2 Pitch Decay"
2121 executable_patterns = ["f3of_dt2_test" , "f3of_dt2_test.exe" ]
2222
23- # Find the result file
24- # C++ regression tests write under: <build>/bin/Release/results/tests/f3of/
25- build_dir = os .environ .get ('HYDROCHRONO_BUILD_DIR' , os .path .join (os .path .dirname (__file__ ), '..' , '..' , '..' , 'build' ))
26- hc_data_file = os .path .join (build_dir , "bin" , "Release" , "results" , "tests" , "f3of" , "results_f3of_dt2.txt" )
27- # Reference data lives under: <project_root>/data/reference_data/f3of/
28- project_root = os .path .abspath (os .path .join (os .path .dirname (__file__ ), ".." , ".." , ".." ))
29- ref_data_file = os .path .join (project_root , "data" , "reference_data" , "f3of" , "hc_ref_f3of_dt2_pitch.txt" )
30-
23+ if len (sys .argv ) != 3 :
24+ print ("Usage: python compare.py <reference_file> <test_file>" )
25+ sys .exit (1 )
26+
27+ # Get reference and results files
28+ ref_file = sys .argv [1 ]
29+ results_file = sys .argv [2 ]
30+ print ("Reference file: " , ref_file )
31+ print ("Results file: " , results_file )
32+
3133 # Check if files exist
32- if not os .path .exists (hc_data_file ):
33- print (f"Error: Test data file not found: { hc_data_file } " )
34+ if not os .path .exists (results_file ):
35+ print (f"Error: Test data file not found: { results_file } " )
3436 sys .exit (1 )
3537
36- if not os .path .exists (ref_data_file ):
37- print (f"Error: Reference data file not found: { ref_data_file } " )
38+ if not os .path .exists (ref_file ):
39+ print (f"Error: Reference data file not found: { ref_file } " )
3840 sys .exit (1 )
3941
4042 try :
4143 # Load data for validation
42- ref_data = np .loadtxt (ref_data_file , skiprows = 1 )
43- test_data = np .loadtxt (hc_data_file , skiprows = 1 )
44+ ref_data = np .loadtxt (ref_file , skiprows = 1 )
45+ test_data = np .loadtxt (results_file , skiprows = 1 )
4446
4547 # Extract pitch column (column 2) for comparison
4648 ref_pitch_data = np .column_stack ((ref_data [:, 0 ], ref_data [:, 2 ])) # time, pitch
4749 test_pitch_data = np .column_stack ((test_data [:, 0 ], test_data [:, 2 ])) # time, pitch
4850
4951 # Show where the plots will be saved
50- test_file_path = Path (hc_data_file )
52+ test_file_path = Path (results_file )
5153 plots_dir = test_file_path .parent / "plots"
5254 plots_dir .mkdir (parents = True , exist_ok = True )
5355 print (f"Plots will be saved to: { plots_dir } " )
@@ -68,8 +70,8 @@ def rel_to_root(path):
6870
6971 n1 , n2 = create_comparison_plot (
7072 ref_pitch_data , test_pitch_data , test_name , plots_dir ,
71- ref_file_path = rel_to_root (ref_data_file ),
72- test_file_path = rel_to_root (hc_data_file ),
73+ ref_file_path = rel_to_root (ref_file ),
74+ test_file_path = rel_to_root (results_file ),
7375 executable_path = rel_to_root (str (executable_path )) if executable_path else None ,
7476 y_label = "Base Pitch (rad)" ,
7577 executable_patterns = executable_patterns
0 commit comments