@@ -988,24 +988,24 @@ def __read_nsx_dataheader_variant_b(
988988
989989 data_header = {}
990990
991- offset_to_first_data_block = offset or int ( self .__nsx_basic_header [nsx_nb ]["bytes_in_headers" ])
991+ offset_to_first_data_block = int ( offset or self .__nsx_basic_header [nsx_nb ]["bytes_in_headers" ])
992992
993993 channel_count = int (self .__nsx_basic_header [nsx_nb ]["channel_count" ])
994- offset = offset_to_first_data_block
994+ current_offset = offset_to_first_data_block
995995 data_block_index = 0
996- while offset < filesize :
997- packet_header = self .__read_nsx_dataheader (nsx_nb , offset )
996+ while current_offset < filesize :
997+ packet_header = self .__read_nsx_dataheader (nsx_nb , current_offset )
998998 header_flag = packet_header ["header_flag" ]
999999 # NSX data blocks must have header_flag = 1, other values indicate file corruption
10001000 if header_flag != 1 :
10011001 raise ValueError (
1002- f"Invalid NSX data block header at offset { offset :#x} in ns{ nsx_nb } file. "
1002+ f"Invalid NSX data block header at offset { current_offset :#x} in ns{ nsx_nb } file. "
10031003 f"Expected header_flag=1, got { header_flag } . "
10041004 f"This may indicate file corruption or unsupported NSX format variant. "
10051005 f"Block index: { data_block_index } , File size: { filesize } bytes"
10061006 )
10071007 timestamp = packet_header ["timestamp" ]
1008- offset_to_data_block_start = offset + packet_header .dtype .itemsize
1008+ offset_to_data_block_start = current_offset + packet_header .dtype .itemsize
10091009 num_data_points = int (packet_header ["nb_data_points" ])
10101010
10111011 data_header [data_block_index ] = {
@@ -1017,7 +1017,7 @@ def __read_nsx_dataheader_variant_b(
10171017
10181018 # Jump to the next data block
10191019 data_block_size = num_data_points * channel_count * np .dtype ("int16" ).itemsize
1020- offset = offset_to_data_block_start + data_block_size
1020+ current_offset = offset_to_data_block_start + data_block_size
10211021
10221022 data_block_index += 1
10231023
0 commit comments