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)
tstop_hr = tstart_hr + movielen_hr tint_sec = 60.0 tadv_sec = 60.0 bw_hz = 4e9 # Load the movie - this will take a while! Not sure why yet! mov = mv.load_movie_txt('./movie/a9_face/', nframes, framedur_sec) # I frames are in U column in current movie text files !!! mov.frames = mov.uframes # Change the mjd of the movie start to correspond with the desired observation start mov.mjd = np.floor(mov.mjd) + tstart_hr/24.0 # Load the array eht = vb.load_array('./arrays/EHT2017.txt') # Observe the movie obs = mov.observe(eht, tint_sec, tadv_sec, tstart_hr, .999*tstop_hr, bw_hz) # OR observe the movie for 24 hr with repeats obs2 = mov.observe(eht, tint_sec, 10*tadv_sec, 0., 24., bw_hz, repeat=True) # You can then plot and save to file as normal obs.plotall('u','v', conj=True) # uv coverage obs.plotall('uvdist','amp') # amplitude with baseline distance' obs.plot_bl('SMA','ALMA','phase') # visibility phase on a baseline over time obs.plot_cphase('SMA', 'SMT', 'ALMA') # closure phase 1-2-3 on a over time obs.plot_camp('ALMA','LMT','SMA','SPT') # closure amplitude (1-2)(3-4)/(1-4)(2-3) over time # You can get lists of closure phases and amplitudes and save them to a file
#!/usr/bin/python import vlbi_imaging_utils as vb import numpy as np import sys im = vb.load_im_fits(sys.argv[1], punit="deg") arr = vb.load_array(sys.argv[2]) out = sys.argv[3] tint = float(sys.argv[4]) tadv = float(sys.argv[5]) bw = float(sys.argv[6]) obs = im.observe(arr, tint, tadv, 0, 24.0, bw, ampcal=False, phasecal=False, sgrscat=False) obs.save_txt(out)