# Setup data for adaptive source modelling
img,sig,psf = galsub, sig2,psf2
#pl.figure()
#pl.imshow(img)
y,x = iT.coords(img.shape)
y,x=y+10,x+15
cpsf = convolve.convolve(img,psf)[1]
ifltm = img[mask]
sfltm = sig[mask]
vfltm = sfltm**2
cmatm = diags(1./sfltm,0)
xm = x[mask]
ym = y[mask]
coords = [xm,ym]

PSF = pT.getPSFMatrix(psf,img.shape)
PSFm = pT.maskPSFMatrix(PSF,mask)

iflt = img.flatten()
sflt = sig.flatten()
vflt = sflt**2

xflt = x.flatten()
yflt = y.flatten()

src = aT.AdaptiveSource(ifltm/sfltm,ifltm.size/Npnts)

xl,yl = pylens.getDeflections(lenses,coords)
src.update(xl,yl)
osrc = showRes(xl,yl,src,PSFm,img,sig,mask,ifltm,vfltm,cmatm,1e-5,1,400)
pylab.show()
예제 #2
0
# for now, we'll just use a single colour of lens
img = img[:,:,0]
mask = img*0
mask = np.where(mask==0,True,False)
# nicht sicher

ifltm = img1[mask]
sfltm = sig1[mask]
vfltm = sfltm**2 # variance from standard deviation.
cmatm = diags(1./sfltm,0) # make a diagnonal covariance matrix
xm = x[mask]
ym = y[mask]
coords = [xm,ym]

PSF = pT.getPSFMatrix(psf1,img1.shape) # 2750x2750 - why so large?
PSFm = pT.maskPSFMatrix(PSF,mask)


# for us, as we have no mask, this is a repeat of the above
iflt = img1.flatten()
sflt = sig1.flatten()
vflt = sflt**2

xflt = x.flatten()
yflt = y.flatten()

Npnts = 4  # Defines `fineness' of source reconstruction (bigger is coarser)
src = aT.AdaptiveSource(ifltm/sfltm,ifltm.size/Npnts)
reg = 1.