From 591e15624a592caa9f8f0d0cb3f4469ef619ea3f Mon Sep 17 00:00:00 2001 From: Mark Histed Date: Wed, 18 Jul 2018 22:47:30 -0400 Subject: [PATCH] Fix reading blackrock digital events. Blackrock specs say packet_insertion_reason is 1 for PARALLEL and 129 for SERIAL. (also 64 for PERIODIC, not implemented) i.e. bit 1 is set for parallel and bits 1 and 7 are set for serial. Because the bitfield is just a unique ID, I removed the bit testing and use equality instead. --- neo/rawio/blackrockrawio.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/neo/rawio/blackrockrawio.py b/neo/rawio/blackrockrawio.py index e081d63cd..7530b0a06 100644 --- a/neo/rawio/blackrockrawio.py +++ b/neo/rawio/blackrockrawio.py @@ -1854,18 +1854,18 @@ def __get_nonneural_evtypes_variant_b(self, data): a 2.3 nev file. """ # digital events + if not np.all(np.in1d(data['packet_insertion_reason'], [1,129])): + raise ValueError('Unknown event codes found.') # Blackrock spec gives reason==64 means PERIODIC, but never seen this live event_types = { 'digital_input_port': { 'name': 'digital_input_port', 'field': 'digital_input', - 'mask': self.__is_set(data['packet_insertion_reason'], 0), + 'mask': data['packet_insertion_reason'] == 1, 'desc': "Events of the digital input port"}, 'serial_input_port': { 'name': 'serial_input_port', 'field': 'digital_input', - 'mask': - self.__is_set(data['packet_insertion_reason'], 0) & - self.__is_set(data['packet_insertion_reason'], 7), + 'mask': data['packet_insertion_reason'] == 129, 'desc': "Events of the serial input port"}} return event_types