how to vectorize exponential probability function

I believe code below is somewhat correct implementation of this exponential heatmap function:

enter image description here

def expfunc(image, landmark, sigma=6): #image = array of shape (512,512), landmark = array of shape (2,)
  a= np.sqrt(np.log(2)/2)/sigma # 
  for i in range(image.shape[0]):
    for j in range(image.shape[1]):
      prob = np.exp(-a*(np.abs(i-landmark[0])+np.abs(j-landmark[1])))
      if prob > 0.01:
        image[i][j] = prob
        image[i][j]= 0
  return image

My questions are:

  1. How could I vectorize this code?
  2. This probability function gives values to all pixels so how should proceed with very small values? Now I am using threshold of 0.01 for zeros?
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum