Ejemplo n.º 1
0
npix = 100
fov = 1*im.xdim * im.psize
zbl = np.sum(im.imvec) # total flux
prior_fwhm = 200*vb.RADPERUAS # Gaussian size in microarcssec
emptyprior = vb.make_square(obs, npix, fov)
flatprior = vb.add_flat(emptyprior, zbl)
gaussprior = vb.add_gauss(emptyprior, zbl, (prior_fwhm, prior_fwhm, 0, 0, 0))

# Image total flux with the bispectrum
flux = np.sum(im.imvec)
#out = mx.maxen_amp_cphase(obs, gaussprior, gaussprior, flux, maxit=50, alpha_clphase=1000, alpha_visamp=1000)

out = mx.maxen_bs(obs, gaussprior, gaussprior, flux, maxit=25, alpha=5000)
 
# Blur the image with a circular beam and image again to help convergance
out = mx.blur_circ(out, res)
out = mx.maxen_bs(obs, out, out, flux, maxit=100, alpha=500, entropy="tv")
out = mx.blur_circ(out, res/2)
out = mx.maxen_bs(obs, out, out, flux, maxit=100, alpha=100, entropy="tv")
out = mx.blur_circ(out, res/2)
out = mx.maxen_bs(obs, out, out, flux, maxit=100, alpha=50, entropy="tv")

# Blur the final image with 1/2 the clean beam
outblur = vb.blur_gauss(out, beamparams, 0.5)
out.display()

# Image Polarization
# out = mx.maxen_m(obs, out, beta=100, maxit=250, polentropy="hw")


# Save the images
Ejemplo n.º 2
0
# Generate an image prior
npix = 64
fov = 1.0 * im.xdim*im.psize #160.0*vb.RADPERUAS
zbl = 1.0 # total flux
prior_fwhm = 80*vb.RADPERUAS # Gaussian size in microarcssec
emptyprior = vb.make_square(obs, npix, fov)
flatprior = vb.add_flat(emptyprior, zbl)
gaussprior = vb.add_gauss(emptyprior, zbl, (prior_fwhm, prior_fwhm, 0, 0, 0))

beamparams = obs.fit_beam()
res = 1 / np.max(obs.unpack('uvdist')['uvdist'])
print beamparams 
print res

out_cl = mx.maxen_onlyclosure(obs, gaussprior, flux = 1.0, maxit=50, alpha_clphase=10, alpha_clamp=10, gamma=500, delta=1e10, entropy="simple", stop=1e-15, grads=True)
out_cl = mx.maxen_onlyclosure(obs, mx.blur_circ(out_cl, 1e-10), flux = 1.0, maxit=100, alpha_clphase=10, alpha_clamp=10, gamma=500, delta=1e10, entropy="tv", stop=1e-10, grads=True)
out_cl = mx.maxen_onlyclosure(obs, mx.blur_circ(out_cl, 1e-10), flux = 1.0, maxit=100, alpha_clphase=5, alpha_clamp=5, gamma=500, delta=1e10, entropy="tv", stop=1e-10, grads=True)
out_cl = mx.maxen_onlyclosure(obs, mx.blur_circ(out_cl, 1e-10), flux = 1.0, maxit=100, alpha_clphase=5, alpha_clamp=5, gamma=500, delta=1e10, entropy="tv", stop=1e-10, grads=True)
out_cl = mx.maxen_onlyclosure(obs, mx.blur_circ(out_cl, 1e-10), flux = 1.0, maxit=100, alpha_clphase=5, alpha_clamp=5, gamma=500, delta=1e10, entropy="tv", stop=1e-10, grads=True)

mx.blur_circ(out_cl, 0.5e-10).display()

im.save_txt("Truth_MAD-Disk.txt")
vb.blur_gauss(im, beamparams, 0.5, frac_pol=0).save_txt("Truth_MAD-Disk_halfCLEAN.txt")
out_cl.save_txt("ClosureOnly_MAD-Disk_EHT2017wKP_wRedundant.txt")
vb.blur_gauss(out_cl, beamparams, 0.5, frac_pol=0).save_txt("ClosureOnly_MAD-Disk_EHT2017wKP_wRedundant_halfCLEAN.txt")




mx.blur_circ(out_cl, 0.5e-10).display()