How do I do conditional array arithmetic on a numpy array?
In [45]: a = np.array([1,2,3,-1,-2,-3])
In [46]: a[a<0]+=1
In [47]: a
Out[47]: array([ 1, 2, 3, 0, -1, -2])
To mutate it:
a[a<0] += 1
To leave the original array alone:
a+[a<0]