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) #Here is the 2-Gaussian fit from Rusen's paper Rusen_2gauss_image = vb.add_gauss(emptyprior, 0.77, (18.*vb.RADPERUAS, 18.*vb.RADPERUAS, 0, 0, 0)) Rusen_2gauss_image = vb.add_gauss(Rusen_2gauss_image, 2.37, (58.*vb.RADPERUAS, 58.*vb.RADPERUAS, 0, 0, 0),x=29.0*vb.RADPERUAS,y=36.0*vb.RADPERUAS) #Here is the Crescent fit from Rusen's paper (im, flux, Rp, Rn, a, b, x=0, y=0): Rusen_Crescent_image = vb.add_crescent(emptyprior, 3.14, 49.0*vb.RADPERUAS, 12.0*vb.RADPERUAS, -1.0*vb.RADPERUAS, 25.0*vb.RADPERUAS) #Here is the Crescent fit from Michael's paper (im, flux, Rp, Rn, a, b, x=0, y=0): Michael_Crescent_image = vb.add_crescent(emptyprior, 3.14, 47.9881*vb.RADPERUAS, 11.3345*vb.RADPERUAS, -6.716*vb.RADPERUAS, 33.9294*vb.RADPERUAS) #Here is the Annulus fit from Michael's paper (im, flux, Rp, Rn, a, b, x=0, y=0): Michael_Annulus_image = vb.add_crescent(emptyprior, 3.14, 97.0/2.0*vb.RADPERUAS, 21.0/2.0*vb.RADPERUAS, 0.0, 0.0) #Here's how to add scattering (following https://arxiv.org/abs/1610.05326)
nScales = 10; sizeStart = 20; sizeFinal = 64; ############ RUN OPTIMIZATION ############### # determine the multiplier you use to increase the scale if(nScales == 1): scaleFactor = 1 else: scaleFactor = np.exp((np.log(sizeFinal) - np.log(sizeStart))/(nScales-1)); # create the prior emptyprior = vb.make_square(obs, sizeStart, fov) emptyprior.pulse = pulses.trianglePulse2D gaussprior = vb.add_gauss(emptyprior, flux, (prior_fwhm, prior_fwhm, 0, 0, 0)) gaussprior.pulse = pulses.trianglePulse2D # initial image cleanI = mx.maxen_bs(obs, gaussprior, gaussprior, flux, maxit=50, alpha=1e5, stop=1e-15) # iterate through scales for s in range(1,nScales+1): # resize the image sizeCurr = np.round(scaleFactor**(s-1)*sizeStart); cleanI = vb.resample_square(cleanI, sizeCurr) # solve for the image under different patch noise levels (beta)