def world2pix(self, x, y):
"""
Convert the world coordinates (R.A., Dec.) into the pixel
coordinates (indexes) within the sky data array.
Parameters
----------
x, y : float, `~numpy.ndarray`
The R.A., Dec. world coordinates
Unit: [deg]
Returns
-------
ri, ci : int, `~numpy.ndarray`
The row, column indexes within the sky data array.
"""
pixelsize = self.pixelsize * AUC.arcsec2deg # [deg]
x, y = np.asarray(x), np.asarray(y) # [deg]
ri0, ci0 = self.ysize//2, self.xsize//2
ri = np.round((y - self.ycenter) / pixelsize + ri0).astype(int)
ci = np.round((x - self.xcenter) / pixelsize + ci0).astype(int)
return (ri, ci)
评论列表
文章目录