@@ -568,7 +568,9 @@ def get_count_rate(
568568 - time : array of global times in seconds since scan start
569569 """
570570 mode = kwds .pop ("mode" , "point" )
571- return self .get_count_rate_ms (fids = fids , mode = mode , runs = runs , ** kwds )
571+ # Resolve runs to fids before calling get_count_rate_ms
572+ fids_resolved = self ._resolve_fids (fids = fids , runs = runs )
573+ return self .get_count_rate_ms (fids = fids_resolved , mode = mode , ** kwds )
572574
573575 # -------------------------------
574576 # Time-resolved count rate (binned)
@@ -685,18 +687,33 @@ def get_elapsed_time(
685687 )
686688
687689 elapsed_per_file : list [float ] = []
690+ prev_max_ts_s = None # Track previous file's max timestamp in seconds
688691
689- for fid in fids_resolved :
692+ for i , fid in enumerate ( fids_resolved ) :
690693 try :
691694 ts_info = file_statistics [str (fid )]["columns" ][ts_alias ]
692- print (f"ts_info: { ts_info } " )
693- dt = ts_info ["max" ] - ts_info ["min" ]
694-
695- # normalize to seconds
696- if hasattr (dt , "total_seconds" ):
697- dt_s = dt .total_seconds ()
695+
696+ max_ts = ts_info ["max" ]
697+ min_ts = ts_info ["min" ]
698+
699+ # Normalize to float seconds
700+ if hasattr (max_ts , "total_seconds" ):
701+ max_ts_s = max_ts .total_seconds ()
702+ else :
703+ max_ts_s = float (max_ts )
704+
705+ if hasattr (min_ts , "total_seconds" ):
706+ min_ts_s = min_ts .total_seconds ()
707+ else :
708+ min_ts_s = float (min_ts )
709+
710+ # Calculate elapsed time correctly for multi-file runs
711+ if i == 0 :
712+ dt_s = max_ts_s - min_ts_s
698713 else :
699- dt_s = float (dt )
714+ dt_s = max_ts_s - prev_max_ts_s
715+
716+ prev_max_ts_s = max_ts_s
700717
701718 if dt_s < 0 :
702719 raise ValueError (
@@ -717,10 +734,8 @@ def get_elapsed_time(
717734 elapsed_per_file .append (dt_s )
718735
719736 if aggregate :
720- print ("aggregate is True" )
721737 return sum (elapsed_per_file )
722738
723- print (f"Elapsed time: { elapsed_per_file } " )
724739 return elapsed_per_file
725740
726741 def read_dataframe (
0 commit comments