#import os
#os.environ["OMP_NUM_THREADS"] = "1"

Rmin = 1e-6  # arcsec
dR = 0.0008  # arcsec
nR = int(1.5 / dR)
dR *= arcsec
Rmin *= arcsec
##### Define a mesh for the space
R = np.linspace(Rmin, Rmin + dR * nR, nR, endpoint=False)
u, v, Re, Im, w = np.require(np.loadtxt('uvtable2.txt', unpack=True),
                             requirements='C')

#x=np.random.rand(len(uf))<0.01

nxy, dxy = get_image_size(u, v, verbose=False)
#lastsamples,_,_,_=np.load('results/optimization/optigal_6_60_6300_merged.npy',allow_pickle=True)
#lastsamples=lastsamples[:,-500:,:].reshape((-1,6))

#igauss,wgauss,inc,PA,dRA,dDec=np.mean(lastsamples[:,:], axis=0)
#siginc,sigPA,sigdRA,sigdDec=np.std(lastsamples[:,2:], axis=0)

igauss, wgauss, inc, PA, dRA, dDec = 10.420409422990984, 0.3862295668301837, 0.8062268497358551, 2.5555283969130116, 4.727564265115043e-08, -2.6084635508588672e-08
inc, PA, dRA, dDec = inc * deg, PA * deg, dRA * arcsec, dDec * arcsec


##### Define a gaussian profile
def GaussianProfile(f0, sigma):
    """ Gaussian brightness profile.
    """
    return (f0 * np.exp(-(0.5 * ((sigma)**-2.)) * (R**2.)))
예제 #2
0
    ### return gaussian profile
    return f, r


# ========================== Code ==========================

### read in UV table visibilities
print("\nReading in UV table: " + args.uvtable)
U, V, Re, Im, W = np.loadtxt(args.uvtable, unpack=True)
U, V = np.ascontiguousarray(U), np.ascontiguousarray(V)
U /= args.wavelength
V /= args.wavelength

### get image dimensions
print("\nImage size: ")
Nxy, Dxy = g_double.get_image_size(U, V, verbose=True, f_max=2.1, f_min=2.0)
Rmin, dR, nR = 1e-4 * arcsec, 0.0005 * arcsec, 20000

### get initial guesses and ranges of gaussian fit parameters
if args.r_in:
    p0 = [
        args.f0, args.sigma, args.r_in, args.incl, args.pa, args.dra, args.ddec
    ]
    p_ranges = [[0.1, 100.0], [0.01, 5.0], [0.01, 5.0], [0., 90.], [0., 180.],
                [-2.0, 2.0], [-2.0, 2.0]]
else:
    p0 = [args.f0, args.sigma, args.incl, args.pa, args.dra, args.ddec]
    p_ranges = [[1.0, 50.0], [0.01, 5.0], [0., 90.], [0., 180.], [-2.5, 2.5],
                [-2.5, 2.5]]

### setup mcmc