Skip to content

Commit 5968cdf

Browse files
committed
specific about bytes
1 parent 9796814 commit 5968cdf

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

neo/rawio/blackrockrawio.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -984,28 +984,28 @@ def __read_nsx_dataheader_variant_b(
984984
"""
985985
filename = f"{self._filenames['nsx']}.ns{nsx_nb}"
986986

987-
filesize = self.__get_file_size(filename)
987+
filesize_bytes = self.__get_file_size(filename)
988988

989989
data_header = {}
990990

991991
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-
current_offset = offset_to_first_data_block
994+
current_offset_bytes = offset_to_first_data_block
995995
data_block_index = 0
996-
while current_offset < filesize:
997-
packet_header = self.__read_nsx_dataheader(nsx_nb, current_offset)
996+
while current_offset_bytes < filesize_bytes:
997+
packet_header = self.__read_nsx_dataheader(nsx_nb, current_offset_bytes)
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 {current_offset:#x} in ns{nsx_nb} file. "
1002+
f"Invalid NSX data block header at offset {current_offset_bytes:#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 = current_offset + packet_header.dtype.itemsize
1008+
offset_to_data_block_start = current_offset_bytes + packet_header.dtype.itemsize
10091009
num_data_points = int(packet_header["nb_data_points"])
10101010

10111011
data_header[data_block_index] = {
@@ -1016,8 +1016,8 @@ def __read_nsx_dataheader_variant_b(
10161016
}
10171017

10181018
# Jump to the next data block
1019-
data_block_size = num_data_points * channel_count * np.dtype("int16").itemsize
1020-
current_offset = offset_to_data_block_start + data_block_size
1019+
data_block_size_bytes = num_data_points * channel_count * np.dtype("int16").itemsize
1020+
current_offset_bytes = offset_to_data_block_start + data_block_size_bytes
10211021

10221022
data_block_index += 1
10231023

0 commit comments

Comments
 (0)