parameters: (sigma, truncate=4.0)
return_statement: return k
docstring: Return Gaussian that truncates at the given number of standard deviations.
docstring_summary: Return Gaussian that truncates at the given number of standard deviations.
docstring_tokens: Return Gaussian that truncates at the given number of standard deviations .
function: def gaussian_kernel(sigma, truncate=4.0):
      """
      Return Gaussian that truncates at the given number of standard deviations. 
      """
  
      sigma = float(sigma)
      radius = int(truncate * sigma + 0.5)
  
      x, y = np.mgrid[-radius:radius + 1, -radius:radius + 1]
      sigma = sigma**2
  
      k = 2 * np.exp(-0.5 * (x**2 + y**2) / sigma)
      k = k / np.sum(k)
  
      return k
function_tokens: def gaussian_kernel ( sigma , truncate = 4.0 ) : sigma = float ( sigma ) radius = int ( truncate * sigma + 0.5 ) x , y = np . mgrid [ - radius : radius + 1 , - radius : radius + 1 ] sigma = sigma ** 2 k = 2 * np . exp ( - 0.5 * ( x ** 2 + y ** 2 ) / sigma ) k = k / np . sum ( k ) return k