Skip to content

Commit

Permalink
Fix np array compare
Browse files Browse the repository at this point in the history
  • Loading branch information
bengineerd committed Sep 13, 2023
1 parent 9c952d5 commit ee4a0ab
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion python/pyrogue/_Block.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
# contained in the LICENSE.txt file.
#-----------------------------------------------------------------------------
import threading
import numpy as np
import pyrogue as pr
import rogue.interfaces.memory as rim



def startTransaction(block, *, type, forceWr=False, checkEach=False, variable=None, index=-1, **kwargs):
"""
Helper function for calling the startTransaction function in a block. This helper
Expand Down Expand Up @@ -228,10 +230,12 @@ def set(self, var, value, index=-1):
"""
with self._lock:

if index < 0 and (isinstance(value, list) or isinstance(value,dict)):
if index < 0 and (isinstance(value, list) or isinstance(value, dict)):
changed = True
elif index >= 0:
changed = self._value[index] != value
elif isinstance(value, np.ndarray):
changed = np.array_equal(self._value, value)
else:
changed = self._value != value

Expand Down

0 comments on commit ee4a0ab

Please sign in to comment.