def py_sampleProfile(intensity, Rmin, dR, nxy, dxy, udat, vdat, dRA=0., dDec=0., PA=0, inc=0.):
"""
Python implementation of sampleProfile.
"""
inc_cos = np.cos(inc)
nrad = len(intensity)
gridrad = np.linspace(Rmin, Rmin + dR * (nrad - 1), nrad)
ncol, nrow = nxy, nxy
# create the mesh grid
x = (np.linspace(0.5, -0.5 + 1./float(ncol), ncol)) * dxy * ncol
y = (np.linspace(0.5, -0.5 + 1./float(nrow), nrow)) * dxy * nrow
# we shrink the x axis, since PA is the angle East of North of the
# the plane of the disk (orthogonal to the angular momentum axis)
# PA=0 is a disk with vertical orbital node (aligned along North-South)
x_axis, y_axis = np.meshgrid(x / inc_cos, y)
x_meshgrid = np.sqrt(x_axis ** 2. + y_axis ** 2.)
# convert to Jansky
sr_to_px = dxy**2.
intensity *= sr_to_px
f = interp1d(gridrad, intensity, kind='linear', fill_value=0.,
bounds_error=False, assume_sorted=True)
intensmap = f(x_meshgrid)
f_center = interp1d(gridrad, intensity, kind='linear', fill_value='extrapolate',
bounds_error=False, assume_sorted=True)
intensmap[int(nrow/2), int(ncol/2)] = f_center(0.)
vis = py_sampleImage(intensmap, dxy, udat, vdat, PA=PA, dRA=dRA, dDec=dDec)
return vis
评论列表
文章目录