File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -276,12 +276,19 @@ def _parse_header(self):
276276 self .internal_unit_ids = [] # pair of chan['packet_id'], spikes['unit_class_nb']
277277 for i in range (len (self .__nev_ext_header [b"NEUEVWAV" ])):
278278
279- channel_id = self .__nev_ext_header [b"NEUEVWAV" ]["electrode_id" ][i ]
279+ # electrode_id values are stored at uint16 which can overflow when
280+ # multiplying by 1000 below. We convert to a regular python int which
281+ # won't overflow
282+ channel_id = int (self .__nev_ext_header [b"NEUEVWAV" ]["electrode_id" ][i ])
280283
281284 chan_mask = spikes ["packet_id" ] == channel_id
282285 chan_spikes = spikes [chan_mask ]
286+
287+ # all `unit_class_nb` is uint8. Also will have issues with overflow
288+ # cast this to python int
283289 all_unit_id = np .unique (chan_spikes ["unit_class_nb" ])
284290 for u , unit_id in enumerate (all_unit_id ):
291+ unit_id = int (unit_id )
285292 self .internal_unit_ids .append ((channel_id , unit_id ))
286293 name = f"ch{ channel_id } #{ unit_id } "
287294 _id = f"Unit { 1000 * channel_id + unit_id } "
You can’t perform that action at this time.
0 commit comments