I have two arrays, lets say x and y that contain a few thousand datapoints. Plotting a scatterplot gives a beautiful representation of them. Now I'd like to select all points within a certain radius. For example r=10
I tried this, but it does not work, as it's not a grid.
x = [1,2,4,5,7,8,....]
y = [-1,4,8,-1,11,17,....]
RAdeccircle = x**2+y**2
r = 10
regstars = np.where(RAdeccircle < r**2)
This is not the same as an nxn array, and RAdeccircle = x**2+y**2
does not seem to work as it does not try all permutations.
You can only perform
**
on a numpy array, But in your case you are using lists, and using**
on a list returns an error,so you first need to convert the list to numpy array usingnp.array()