para = np.loadtxt(file1) file1.close() #print len(para) ln=len(para) #print ln filename='../fits/sub1000.fits' psf = pyfits.open(filename)[0].data.copy().T #psf = psf[40:-40,40:-40] # if the psf should be shear psf /= psf.sum() for l in range(ln): filename='../fits/HE_arc-{0}.fits'.format(l+1) # take one image #print l hsa = pyfits.open(filename)[0].data.copy() (a1,a2),(b1,b2),(c1,c2),(d1,d2)=findpt(hsa) #finding two corresponding positions where to add from two arcs #print findpt(hsa) #a1=181 #a2=181 filename='../fits/HE0435-{0}.fits'.format(l+1) # take one image hs = pyfits.open(filename)[0].data.copy() hs=hs.T x1=a1-len(psf)/2 #location to start put the psf(not center but bottom left) y1=a2-len(psf)/2 x2=b1-len(psf)/2 y2=b2-len(psf)/2 x3=c1-len(psf)/2 #location to start put the psf(not center but bottom left) y3=c2-len(psf)/2 x4=d1-len(psf)/2 y4=d2-len(psf)/2
#Copy the image of PSF and lensed imaged from pylens with sub=4 from findpt import * import numpy as np import pyfits filename='test1000.fits' psf = pyfits.open(filename)[0].data.copy() #psf = psf[20:-20,20:-20] # if the psf should be shear psf /= psf.sum() print len(psf) for l in range(4): filename='HE1104-{0}.fits'.format(l+1) # take one image hs = pyfits.open(filename)[0].data.copy() hs=hs.T (a1,a2),(b1,b2)=findpt(l+1) #find one brightest point from two arces x1=a1-len(psf)/2 #where to put the psf y1=a2-len(psf)/2 x2=b1-len(psf)/2 y2=b2-len(psf)/2 cell=np.zeros([600,600]) sw=(len(cell)-len(hs))/2 for m in range(len(hs)): for n in range(len(hs)): cell[m+180,n+180]+=hs[m,n] #put image in a larger frame for i in range(len(psf)): for j in range(len(psf)): cell[i+x1+180,j+y1+180]+=psf[i,j]*940 cell[i+x2+180,j+y2+180]+=psf[i,j]*3030 pyfits.PrimaryHDU(cell.T).writeto('bfadd-{0}.fits'.format(l+1),clobber=True) sh= np.zeros([len(hs),len(hs)]) #shear the lager frame to regular one for i in range(len(hs)):