@@ -315,9 +315,10 @@ def dataplot(config_filename,**kwargs):
315315
316316
317317 # loop over the rows of the config file
318- for pos , (irow , row ) in enumerate (C .iterrows ()):
318+ for pos , (idx , row ) in enumerate (C .iterrows ()):
319319
320- pp = define_plot_parameters (C , pos ) # use position, not label
320+ csv_rownum = int (row ["__orig_index__" ]) + header_rows + 1
321+ pp = define_plot_parameters (C , pos )
321322
322323 # ----------------------------------------------------------------------
323324 # Handle MATLAB dataplot switch_id behavior (d, f, o, g, s)
@@ -344,7 +345,7 @@ def dataplot(config_filename,**kwargs):
344345 # If it’s none of the recognized ones, skip safely
345346 if not (dtest or ftest or gtest or switch_id == 'o' ):
346347 if verbose :
347- print (f"[dataplot] Skipping unrecognized switch_id '{ pp .switch_id } ' on line { irow + 2 } " )
348+ print (f"[dataplot] Skipping unrecognized switch_id '{ pp .switch_id } ' on line { csv_rownum } " )
348349 continue
349350
350351 # Track drange like MATLAB (1-based CSV lines starting at row 2)
@@ -419,7 +420,6 @@ def dataplot(config_filename,**kwargs):
419420 # --- Create new figure or reuse last one ---
420421 if pp .Plot_Filename != Plot_Filename_Last :
421422 if verbose :
422- csv_rownum = int (row ["__orig_index__" ]) + header_rows + 1 # true CSV 1-based line
423423 print (f"Generating plot { csv_rownum } { pltdir } { pp .Plot_Filename } ..." )
424424 if close_figs :
425425 plt .close ('all' )
@@ -576,7 +576,7 @@ def dataplot(config_filename,**kwargs):
576576 len_m = np .size (Save_Measured_Metric [- 1 ])
577577 len_p = np .size (vals_pred )
578578 if len_m != len_p :
579- print (f"[dataplot] Length mismatch at index { irow + 2 } : "
579+ print (f"[dataplot] Length mismatch at index { csv_rownum } : "
580580 f"{ pp .Dataname } | { pp .Quantity } | "
581581 f"Measured={ len_m } , Predicted={ len_p } " )
582582
0 commit comments