mxcube / mxcubecore

Backend used by MXCuBE
http://mxcube.github.io/mxcube/
GNU Lesser General Public License v3.0
11 stars 52 forks source link

tango attribute polling: fix issue with numpy array attributes #792

Closed elmjag closed 11 months ago

elmjag commented 11 months ago

In TangoChannel.update(), we'll get an exception if attribute value is of numpy.ndarray.

Value of numpy.ndarray type can't be compared to Poller.NotInitializedValue, Comparison raised following exception:

  ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Check first if value is ndarray, and only if it's not, compare it with Poller.NotInitializedValue. https://github.com/elmjag/mxcubecore/blob/tango_numpy/mxcubecore/Command/Tango.py#L325

Also, some minor clean-up.

marcus-oscarsson commented 11 months ago

Wonderful, thanks !