This PR fixes a bug where if you tried to save_temp() when the ParamStore contained a numpy ndarray with 2 or more values an exception would be raised (ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all())
The cause of the exception was that on the second call to save_temp(), when updating the DB "temp" record, SqlAlchemy compared the Param from the DB with the new Param value using the Param class' __eq__(). This involved a simple == comparison which triggered the exception.
The fix provides a more elaborate implementation of __eq__() that handles ndarrays as special cases and compares them using recommended numpy comparison methods.
This PR fixes a bug where if you tried to
save_temp()
when theParamStore
contained a numpyndarray
with 2 or more values an exception would be raised (ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
)The cause of the exception was that on the second call to
save_temp()
, when updating the DB "temp" record, SqlAlchemy compared theParam
from the DB with the newParam
value using theParam
class'__eq__()
. This involved a simple==
comparison which triggered the exception.The fix provides a more elaborate implementation of
__eq__()
that handlesndarray
s as special cases and compares them using recommended numpy comparison methods.