Skip to content

Commit ea95545

Browse files
committed
fix
1 parent f34680d commit ea95545

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

neo/rawio/intanrawio.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,9 @@ def _decode_current_from_stim_data(self, raw_stim_data, i_start, i_stop):
631631
sign_bit = np.bitwise_and(np.right_shift(data, 8), 0x01) # Shift right by 8 bits to get the sign bit
632632

633633
# Apply sign to current values
634+
# We need to cast to int16 to handle negative values correctly
635+
# The max value of 8 bits is 255 so the casting is safe as there are non-negative values
636+
magnitude = magnitude.astype(np.int16)
634637
current = np.where(sign_bit == 1, -magnitude, magnitude)
635638

636639
# Note: If needed, other flag bits could be extracted as follows:

0 commit comments

Comments
 (0)