Commit 54db3189 by Martin Reinecke

### temporary

parent f53dd11d
 ... ... @@ -39,14 +39,17 @@ def convolve(alm1, alm2, lmax): return job.map2alm(map)[0]*np.sqrt(4*np.pi) lmax=60 kmax=13 lmax=2048 kmax=8 ncomp=1 separate=True separate=False nptg = 10000000 ncomp2 = ncomp if separate else 1 epsilon = 1e-4 ofactor = 2 nthreads = 0 ofactor = 1.5 nthreads = 0 # use as many threads as available ncomp2 = ncomp if separate else 1 # get random sky a_lm # the a_lm arrays follow the same conventions as those in healpy ... ... @@ -68,38 +71,39 @@ nph = 2*lmax+1 # compute a convolved map at a fixed psi and compare it to a map convolved # "by hand" ptg = np.zeros((nth,nph,3)) ptg[:,:,0] = (np.pi*(0.5+np.arange(nth))/nth).reshape((-1,1)) ptg[:,:,1] = (2*np.pi*(0.5+np.arange(nph))/nph).reshape((1,-1)) ptg[:,:,2] = np.pi*0.2 t0=time.time() # do the actual interpolation bar=foo.interpol(ptg.reshape((-1,3))).reshape((nth,nph,ncomp2)) print("interpolation time: ", time.time()-t0) plt.subplot(2,2,1) plt.imshow(bar[:,:,0]) bar2 = np.zeros((nth,nph)) blmfull = np.zeros(slm.shape)+0j blmfull[0:blm.shape[0],:] = blm for ith in range(nth): rbeamth=pyinterpol_ng.rotate_alm(blmfull[:,0], lmax, ptg[ith,0,2],ptg[ith,0,0],0) for iph in range(nph): rbeam=pyinterpol_ng.rotate_alm(rbeamth, lmax, 0, 0, ptg[ith,iph,1]) bar2[ith,iph] = convolve(slm[:,0], rbeam, lmax).real plt.subplot(2,2,2) plt.imshow(bar2) plt.subplot(2,2,3) plt.imshow(bar2-bar[:,:,0]) plt.show() ptg=np.random.uniform(0.,1.,3*1000000).reshape(1000000,3) # ptg = np.zeros((nth,nph,3)) # ptg[:,:,0] = (np.pi*(0.5+np.arange(nth))/nth).reshape((-1,1)) # ptg[:,:,1] = (2*np.pi*(0.5+np.arange(nph))/nph).reshape((1,-1)) # ptg[:,:,2] = np.pi*0.2 # t0=time.time() # # do the actual interpolation # bar=foo.interpol(ptg.reshape((-1,3))).reshape((nth,nph,ncomp2)) # print("interpolation time: ", time.time()-t0) # plt.subplot(2,2,1) # plt.imshow(bar[:,:,0]) # bar2 = np.zeros((nth,nph)) # blmfull = np.zeros(slm.shape)+0j # blmfull[0:blm.shape[0],:] = blm # for ith in range(nth): # rbeamth=pyinterpol_ng.rotate_alm(blmfull[:,0], lmax, ptg[ith,0,2],ptg[ith,0,0],0) # for iph in range(nph): # rbeam=pyinterpol_ng.rotate_alm(rbeamth, lmax, 0, 0, ptg[ith,iph,1]) # bar2[ith,iph] = convolve(slm[:,0], rbeam, lmax).real # plt.subplot(2,2,2) # plt.imshow(bar2) # plt.subplot(2,2,3) # plt.imshow(bar2-bar[:,:,0]) # plt.show() ptg=np.random.uniform(0.,1.,3*nptg).reshape(nptg,3) ptg[:,0]*=np.pi ptg[:,1]*=2*np.pi ptg[:,2]*=2*np.pi #foo = pyinterpol_ng.PyInterpolator(slm,blm,separate,lmax, kmax, epsilon=1e-6, nthreads=2) t0=time.time() bar=foo.interpol(ptg) del foo print("interpolation time: ", time.time()-t0) fake = np.random.uniform(0.,1., (ptg.shape[0],ncomp2)) foo2 = pyinterpol_ng.PyInterpolator(lmax, kmax, ncomp2, epsilon=epsilon, ofactor=ofactor, nthreads=nthreads) ... ...