allow to convert numpy arrays to ArrayOf

accept all sequences instead of just tuple / list
+ change Module.announceUpdate to convert value before
  comparing with previous one (comparing will not work with numpy arrays)

Change-Id: I5eceef4297607107e2dde688af2833d3651a8775
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/28525
Tested-by: Markus Zolliker <markus.zolliker@psi.ch>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
2022-05-25 09:23:16 +02:00
parent d717a481d7
commit 6a0261c728
2 changed files with 7 additions and 5 deletions

View File

@ -509,10 +509,11 @@ class Module(HasAccessibles):
# TODO: remove readerror 'property' and replace value with exception
pobj = self.parameters[pname]
timestamp = timestamp or time.time()
changed = pobj.value != value
try:
value = pobj.datatype(value)
changed = pobj.value != value
# store the value even in case of error
pobj.value = pobj.datatype(value)
pobj.value = value
except Exception as e:
if isinstance(e, DiscouragedConversion):
if DiscouragedConversion.log_message: