File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -695,9 +695,12 @@ def extract_stream_info(meta_file, meta):
695695 # Calculate sample_length from actual file size instead of metadata to handle stub/modified files
696696 # The metadata fileSizeBytes may not match the actual .bin file (e.g., in test stub files)
697697 # Original calculation (only correct for unmodified files):
698- # info["sample_length"] = int(meta["fileSizeBytes"]) // 2 // num_chan
699- actual_file_size = Path (meta_file ).with_suffix (".bin" ).stat ().st_size
700- info ["sample_length" ] = actual_file_size // 2 // num_chan # 2 bytes per int16 sample
698+ bin_file = Path (meta_file ).with_suffix (".bin" )
699+ if bin_file .exists ():
700+ file_size = bin_file .stat ().st_size
701+ else :
702+ file_size = int (meta ["fileSizeBytes" ])
703+ info ["sample_length" ] = file_size // 2 // num_chan # 2 bytes per int16 sample
701704 info ["gate_num" ] = gate_num
702705 info ["trigger_num" ] = trigger_num
703706 info ["device" ] = device
You can’t perform that action at this time.
0 commit comments