hcNetworks.py 文件源码

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

项目:synchrony 作者: cknd 项目源码 文件源码
def distances_to_roi(network,inputc,roi):
    """
    Returns a list of shortest path lengths from each
    input-receiving cell to all measured cells.

    Args:
        network: networkx graph
        inputc: MxN array, nonzero positions are treated as 'input receiving'
        inputc: MxN array, nonzero positions are treated as 'measured'
    """
    inputnodes = [tuple(ind) for ind in np.transpose(inputc.nonzero())]
    roinodes   = [tuple(ind) for ind in np.transpose(roi.nonzero())]
    lengths = [nx.shortest_path_length(network,src,trg) for src in inputnodes for trg in roinodes]
    return lengths
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号