#extract peak frequencies smallcm = IU.Circularmask(autoc,s/2,3) pkfft = IU.PeakFilteredFFT(autoc,cxy,sigma=50) pkfft_abs = np.abs(pkfft)*smallcm #imshow_z(pkfft_abs) #get reci lattice vectors pos = IU.FindPeakPos(pkfft_abs) pos_zero = pos[:,3:5] - s/2 pos_zero = np.round(pos_zero,2) bs = VF.find_basis_set(pos_zero.T) r1,r2 = VF.get_reci_vecs2(bs[:,0],bs[:,1],1024) fig1 = imshow_z(filt2s,vmin=0,vmax=350) IU.draw_circles_along_vec(fig1,r1,[512,512],[1024,1024]) IU.draw_circles_along_vec(fig1,r2,[512,512],[1024,1024]) ########################################################################## #Extract peaks ########################################################################## #sort the peaks by strength and recenter some of them #thevecs1 = fill_space_with_basis2D(autoc,r1,r2,PY.array([512,512])) thevecs1 = VF.fill_space_with_basis2D_2(autoc,r1,r2,np.array([512,512])) #fig1 = imshow_z(filt2s,vmin=0,vmax=250) #IU.draw_circles_at_vec(fig1,thevecs1) #slightly shift the centroids and collec the intensities cents,sums = IU.DiffPeakSums(filt2s,thevecs1) fig1 = imshow_z(filt2s,vmin=0,vmax=250) IU.draw_circles_at_vec(fig1,thevecs1,color='w')