healpix.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:ugali 作者: DarkEnergySurvey 项目源码 文件源码
def index_pixels(lon,lat,pixels,nside):
   """
   Find the index for object amoung a subset of healpix pixels.
   Set index of objects outside the pixel subset to -1

   # ADW: Not really safe to set index = -1 (accesses last entry); 
   # -np.inf would be better, but breaks other code...
   """
   pix = ang2pix(nside,lon,lat)
   # pixels should be pre-sorted, otherwise...???
   index = np.searchsorted(pixels,pix)
   if np.isscalar(index):
       if not np.in1d(pix,pixels).any(): index = -1
   else:
       # Find objects that are outside the roi
       #index[np.take(pixels,index,mode='clip')!=pix] = -1
       index[~np.in1d(pix,pixels)] = -1
   return index

############################################################
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号