code: def crtGauss2D(varSizeX, varSizeY, varPosX, varPosY, varSd):
      
      varSizeX = int(varSizeX)
      varSizeY = int(varSizeY)
  
      # aryX and aryY are in reversed order, this seems to be necessary:
      aryY, aryX = sp.mgrid[0:varSizeX,
                            0:varSizeY]
  
      # The actual creation of the Gaussian array:
      aryGauss = (
          (np.square((aryX - varPosX)) + np.square((aryY - varPosY))) /
          (2.0 * np.square(varSd))
          )
      aryGauss = np.exp(-aryGauss) / (2 * np.pi * np.square(varSd))
  
      return aryGauss
docs: Create 2D Gaussian kernel.
  
      Parameters
      ----------
      varSizeX : int, positive
          Width of the visual field.
      varSizeY : int, positive
          Height of the visual field..
      varPosX : int, positive
          X position of centre of 2D Gauss.
      varPosY : int, positive
          Y position of centre of 2D Gauss.
      varSd : float, positive
          Standard deviation of 2D Gauss.
      Returns
      -------
      aryGauss : 2d numpy array, shape [varSizeX, varSizeY]
          2d Gaussian.
      Reference
      ---------
      [1]