I am having a very difficult time vectoring, I can't seem to think about math in that way yet. I have this right now:
#!/usr/bin/env python
import numpy as np
import math
grid = np.zeros((2,2))
aList = np.arange(1,5).reshape(2,2)
i,j = np.indices((2,2))
iArray = (i - aList[:,0:1])
jArray = (j - aList[:,1:2])
print np.power(np.power(iArray, 2) + np.power(jArray, 2), .5)
My print out looks like this:
[[ 2.23606798 1.41421356]
[ 4.47213595 3.60555128]]
What I am trying to do is take a 2D array of pixel values, grid, and say how far each pixel is from a list of important pixels, aList.
# # @
# # #
* # *
An example is if the *s (0,2) and (2,2) are important pixels and I am currently at the @ (2,0) pixel, my value for the @ pixel would be:
[(0-2)^2 + (2-0)^2]^.5 + [(2-2)^2 + (0-2)^2]^.5
All grid does is hold pixel values so I need to get the index of each pixel value to associate distance. However my Alist array holds [x,y] coordinates, So that one is easy. I think I right now I have two issues: 1. I am not getting the indeces correctly 2. I am not looping over the coordinates in aList properly

(2,0), (2,2)and @ is(0, 2).dist2 = lambda index_array, i, j: (index_array[0]-i)**2 + (index_array[1]-j)**2, whereindex_array = np.indices((N,N)). This yields a mesh where each point is the distance^2 from the important point(i, j). Create one of these for each important point, thennp.sqrt(sum(dist_arrays))to get the combined distance from all important points.