I have a numpy array and I want to find all the indexes that verifies a certain condition. Example, I want to plot the Heaviside function;
import numpy as np
x=np.linspace(-5,5,11)
k_neg=x.find(x<0)
k_pos=x.find(x>=0)
y=np.zeros(len(x))
y(k_neg)=-1
y(k_pos)=1
I don't find such a function (like it exists on Matlab).
Note : my actual problem IS NOT to plot Heavyside, of corse ;)
np.where