utils.py 文件源码

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

项目:enterprise 作者: nanograv 项目源码 文件源码
def quant2ind(U):
    """
    Use quantization matrix to return slices of non-zero elements.

    :param U: quantization matrix

    :return: list of `slice`s for non-zero elements of U

    .. note:: This function assumes that the pulsar TOAs were sorted by time.

    """
    inds = []
    for cc, col in enumerate(U.T):
        epinds = np.flatnonzero(col)
        if epinds[-1] - epinds[0] + 1 != len(epinds):
            raise ValueError('ERROR: TOAs not sorted properly!')
        inds.append(slice(epinds[0], epinds[-1]+1))
    return inds
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号