def getSigma(): ''' This function isn't complete. I need to cut out a 20x20 pxl window around large amplitude particles ''' from gaussianFitting import fitGaussian I=g.m.currentWindow.image xorigin=8 yorigin=9 sigma=2 amplitude=50 p0=[xorigin, yorigin, sigma,amplitude] p, I_fit, _ =fitGaussian(I,p0) xorigin, yorigin, sigma,amplitude = p return sigma
def refine_pts(pts,Movie): from gaussianFitting import fitGaussian new_pts=[] for pt in pts: print(pt) width=9 mid=int(np.floor(width/2)) I, corner=cutout(pt,Movie,width) xorigin=mid; yorigin=mid; sigma=1.1; amplitude=50 p0=[xorigin,yorigin,sigma,amplitude] fit_bounds = [(0,9), (0,9), (0,4), (0,1000)] p, I_fit, _ = fitGaussian(I,p0, fit_bounds) xfit=p[0]+corner[0] yfit=p[1]+corner[1] new_pts.append([pt[0],pt[1],pt[2],xfit,yfit,p[2],p[3]]) new_pts=np.array(new_pts) return new_pts