def gausskern1d(sigma,size): k = size/2 x = float32(arange(-k,k+1)) kern = npdf(0,sigma,x) return kern / sum(kern)
def objective(theta): (sigma,scale,dc) = theta z = npdf(0,sigma,X)*scale+dc error = sum( (z-Y)**2 ) return error
def gausskern2d(sigma,size): k = size/2 x = float32(arange(-k,k+1)) p = npdf(0,sigma,x) kern = outer(p,p) return kern / sum(kern)