Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion neo/rawio/blackrockrawio.py
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,21 @@ def __read_nev_data(self, nev_data_masks, nev_data_types):
# read all raw data packets and markers
dt0 = [("timestamp", ts_format), ("packet_id", "uint16"), ("value", f"S{data_size - header_skip}")]

raw_data = np.memmap(filename, offset=header_size, dtype=dt0, mode="r")
# expected number of data packets. We are not sure why, but it seems we can get partial data packets
# based on blackrock's own code this is okay so applying an int to round down is necessary to obtain the
# memory map of full packets and toss the partial packet.
Comment thread
luiztauffer marked this conversation as resolved.
# See reference: https://github.com/BlackrockNeurotech/Python-Utilities/blob/fa75aa671680306788e10d3d8dd625f9da4ea4f6/brpylib/brpylib.py#L580-L587
n_packets = int(
(self.__get_file_size(filename) - header_size) / data_size
Comment thread
zm711 marked this conversation as resolved.
)

raw_data = np.memmap(
filename,
offset=header_size,
dtype=dt0,
shape=(n_packets,),
mode="r",
)

masks = self.__nev_data_masks(raw_data["packet_id"])
types = self.__nev_data_types(data_size)
Expand Down
Loading