src/utils.py
def gauss1d(sigma=1,order=0,nstd=3,x=np.empty((0,)),normalize=True):
	"""
	Derivative of the 1d Gaussian filter

	"""
	assert sigma>0, "sigma cannot be equal to zero"

	x_max = nstd * sigma
	if x.size==0:
		x = np.arange(-x_max,x_max+1)
	var = sigma**2
	num = x * x
	den = 2 * var
	g   = np.exp(-num/den) / (np.sqrt(2*np.pi)*sigma)
	if order==1:
		g *= -x/var
	elif order==2:
		g *= (num-var)/var**2
	if normalize:
		# return g / np.linalg.norm(g,1)
		return g / g.sum()
	else:
		return g

	Derivative of the 1d Gaussian filter

	
Derivative of the 1d Gaussian filter
Derivative of the 1d Gaussian filter
def gauss1d(sigma=1,order=0,nstd=3,x=np.empty((0,)),normalize=True):
	assert sigma>0, "sigma cannot be equal to zero"
	x_max = nstd * sigma
	if x.size==0:
		x = np.arange(-x_max,x_max+1)
	var = sigma**2
	num = x * x
	den = 2 * var
	g   = np.exp(-num/den) / (np.sqrt(2*np.pi)*sigma)
	if order==1:
		g *= -x/var
	elif order==2:
		g *= (num-var)/var**2
	if normalize:
		return g / g.sum()
	else:
		return g
def gauss1d ( sigma = 1 , order = 0 , nstd = 3 , x = np . empty ( ( 0 , ) ) , normalize = True ) : assert sigma > 0 , "sigma cannot be equal to zero" x_max = nstd * sigma if x . size == 0 : x = np . arange ( - x_max , x_max + 1 ) var = sigma ** 2 num = x * x den = 2 * var g = np . exp ( - num / den ) / ( np . sqrt ( 2 * np . pi ) * sigma ) if order == 1 : g *= - x / var elif order == 2 : g *= ( num - var ) / var ** 2 if normalize : return g / g . sum ( ) else : return g
Derivative of the 1d Gaussian filter
Derivative of the 1d Gaussian filter
"""
	Derivative of the 1d Gaussian filter

	""" # return g / np.linalg.norm(g,1)
sigma
order
nstd
x
normalize