np.where for 2 conditions code example
Example 1: Numpy where function multiple conditions
dists[(dists >= r) & (dists <= r+dr)]
# or if you want to use np.where #
dists[(np.where((dists >= r) & (dists <= r + dr)))]
Example 2: np.where
>>> a = np.arange(10)
>>> a
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> np.where(a < 5, a, 10*a)
array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90])