# Note: this is an example sequence of commands I might run in ipython # The matplotlib windows may not open/close properly if you run this directly as a script import vlbi_imaging_utils as vb import maxen as mx import numpy as np # Load the image and the array #im = vb.load_im_fits('./models/avery_sgra_eofn.fits') #for a fits image im = vb.load_im_txt('./models/avery_sgra_eofn.txt') #for a text file eht = vb.load_array('./arrays/EHT2017.txt') #see the attached array text file # Look at the image im.display() # Observe the image # tint_sec is the integration time in seconds, and tadv_sec is the advance time between scans # tstart_hr is the GMST time of the start of the observation and tstop_hr is the GMST time of the end # bw_hz is the bandwidth in Hz # sgrscat=True blurs the visibilities with the Sgr A* scattering kernel for the appropriate image frequency # ampcal and phasecal determine if gain variations and phase errors are included tint_sec = 60 tadv_sec = 600 tstart_hr = 0 tstop_hr = 24 bw_hz = 4e9 obs = im.observe(eht, tint_sec, tadv_sec, tstart_hr, tstop_hr, bw_hz, sgrscat=False, ampcal=False, phasecal=False) # You can deblur the visibilities by dividing by the scattering kernel if necessary #obs = vb.deblur(obs)
import vlbi_imaging_utils as vb import maxen as mx import numpy as np import stochastic_optics as so import vlbi_plots as vp #observing parameters tint_sec = 1e5 tadv_sec = 300 tstart_hr = 0.5 tstop_hr = 4.2 bw_hz = 0.5e9 # Load the image and the array im = vb.load_im_txt('./models/avery_sgra_eofn.txt') #for a text file like the one attached eht = vb.load_array('./arrays/EHT2017.txt') #see the attached array text file # If the image has an odd number of pixels, make it even if im.xdim%2 == 0: newim = im.imvec.reshape(im.ydim, im.xdim) newim = newim[:-1,:-1] im = vb.Image(newim, im.psize, im.ra, im.dec, rf=im.rf, source=im.source, mjd=im.mjd) # Generate an image prior obs = im.observe(eht, tint_sec, tadv_sec, tstart_hr, tstop_hr, bw_hz, sgrscat=False, ampcal=True, phasecal=True) npix = im.psize*(im.xdim-1.0)/im.xdim npix = 101 #This must be odd fov = 1.0*im.xdim * im.psize zbl = np.sum(im.imvec) # total flux emptyprior = vb.make_square(obs, npix, fov)
import vlbi_imaging_utils as vb import maxen as mx import numpy as np im = vb.load_im_txt('./models/avery_sgra_eofn.txt') arr = vb.load_array("./arrays/EHT2017_wKP_wRedundant.txt") tint = 120 tadv = 600 bw = 4e9 obs = im.observe(arr, tint, tadv, 0, 24.0, bw, ampcal=False, phasecal=False, sgrscat=False) # 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)