mask.py 文件源码

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

项目:ugali 作者: DarkEnergySurvey 项目源码 文件源码
def mask_roi_digi(self):
        """
        Get the index of the unique magnitude tuple for each pixel in the ROI.
        """
        # http://stackoverflow.com/q/24205045/#24206440
        A = np.vstack([self.mask_1.mask_roi_sparse,self.mask_2.mask_roi_sparse]).T
        B = self.mask_roi_unique

        AA = np.ascontiguousarray(A)
        BB = np.ascontiguousarray(B)

        dt = np.dtype((np.void, AA.dtype.itemsize * AA.shape[1]))
        a = AA.view(dt).ravel()
        b = BB.view(dt).ravel()

        idx = np.argsort(b)
        indices = np.searchsorted(b[idx],a)
        return idx[indices]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号