crosstalk_deprojection.py 文件源码

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

项目:atoolbox 作者: liweitianux 项目源码 文件源码
def group_data(data, grouping):
    """
    Group the data with respect to the supplied `grouping' specification
    (i.e., "GROUPING" columns of a spectrum).  The channel counts of the
    same group are summed up and assigned to the FIRST channel of this
    group, while the OTHRE channels are all set to ZERO.
    """
    data_grp = np.array(data)
    for i in reversed(range(len(data))):
        if grouping[i] == 1:
            # the beginning channel of a group
            continue
        else:
            # other channels of a group
            data_grp[i-1] += data_grp[i]
            data_grp[i] = 0
    assert np.isclose(sum(data_grp), sum(data))
    return data_grp
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号