decoding.py 文件源码

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

项目:nept 作者: vandermeerlab 项目源码 文件源码
def decode_location(likelihood, pos_centers, time_centers):
    """Finds the decoded location based on the centers of the position bins.

    Parameters
    ----------
    likelihood : np.array
        With shape(n_timebins, n_positionbins)
    pos_centers : np.array
    time_centers : np.array

    Returns
    -------
    decoded : nept.Position
        Estimate of decoded position.

    """
    prob_rows = np.sum(np.isnan(likelihood), axis=1) < likelihood.shape[1]
    max_decoded_idx = np.nanargmax(likelihood[prob_rows], axis=1)

    prob_decoded = pos_centers[max_decoded_idx]

    decoded_pos = np.empty((likelihood.shape[0], pos_centers.shape[1])) * np.nan
    decoded_pos[prob_rows] = prob_decoded

    decoded_pos = np.squeeze(decoded_pos)

    return nept.Position(decoded_pos, time_centers)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号