Open damazter opened 7 years ago
The simplest solution is probably to check against the numbers abstract base class http://stackoverflow.com/questions/3441358/python-most-pythonic-way-to-check-if-an-object-is-a-number alternatively we can add the relevant numpy types to the tuple (np.int32, np.int64 ...)
I think the return type of np.arange is platform acitecture dependent. At least I see
In [17]: a=np.arange(0, 1000, 1)
In [18]: isinstance(a[0], np.int32)
Out[18]: False
In [19]: isinstance(a[0], np.int64)
Out[19]: True
In [20]: isinstance(a[0], int)
Out[20]: False
@giulioungaretti
Steps to reproduce
use
a=np.arange(0, 1000, 1)
to create an array of sweep values for, say theivvi.dac1
. useivvi.dac1(a[0])
to change the dac valueExpected behaviour
this should work without warnings
Actual behaviour
a warning is spit out:
This is because the following code gives an error (copied from StandardParameter):
the isinstance is probably not the correct way to check if something is a number, (np.arange yields an array of int32's instead of int64's which is the root cause of the problem)
System
windows 7 (64 bit) master branch 9602616bb924b540d56880b4f3437980271fcd9e