I was being lazy, and had to code up a piecewise function. Rather than use the proper array tools, I used
np.vectorize instead but somehow got weird results:
[1 1 0 0 0]
[0.4 0.4 0.4 1. 1. ]
np.vectorize has the property that
The output type is determined by evaluating the first element of the input, unless it is specified
Took me a minute to figure this out. RTFM.