def frac_coord(npixel, kernel_oversampling, p):
""" Compute whole and fractional parts of coordinates, rounded to
kernel_oversampling-th fraction of pixel size
The fractional values are rounded to nearest 1/kernel_oversampling pixel value. At
fractional values greater than (kernel_oversampling-0.5)/kernel_oversampling coordinates are
rounded to next integer index.
:param npixel: Number of pixels in total
:param kernel_oversampling: Fractional values to round to
:param p: Coordinate in range [-.5,.5[
"""
assert numpy.array(p >= -0.5).all() and numpy.array(
p < 0.5).all(), "Cellsize is too large: uv overflows grid uv= %s" % str(p)
x = npixel // 2 + p * npixel
flx = numpy.floor(x + 0.5 / kernel_oversampling)
fracx = numpy.around((x - flx) * kernel_oversampling)
return flx.astype(int), fracx.astype(int)
convolutional_gridding.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录