Python Stupid numpy.piecewise
piecewise() function in numpy is not very good. Due to the writing of the function, one wouldn’t be surprised to encounter the following error,
n is the length of condition list and
n2 is the length of function list.
To avoid it, the input should always be prepared as following