visualize_output.py 文件源码

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

项目:neurodriver 作者: neurokernel 项目源码 文件源码
def run(out_name):
    V = vis.visualizer()

    # Assumes that generic_lpu_0_input.h5 and generic_lpu_1_input.h5
    # contain the same data:
    V.add_LPU('./data/generic_lpu_0_input.h5', LPU='Sensory', is_input=True)
    V.add_plot({'type': 'waveform', 'uids': [['sensory_0']], 'variable':'I'},
                'input_Sensory')

    for i in [0, 1]:
        G = nx.read_gexf('./data/generic_lpu_%s.gexf.gz' % i)
        neu_proj = sorted([k for k, n in G.node.items() if \
                           n['name'][:4] == 'proj' and \
                           n['class'] == 'LeakyIAF'])
        N = len(neu_proj)
        V.add_LPU('generic_lpu_%s_%s_output.h5' % (i, out_name),
                  'Generic LPU %s' % i,
                  gexf_file='./data/generic_lpu_%s.gexf.gz' % i)
        V.add_plot({'type': 'raster', 'uids': [neu_proj],
                    'variable': 'spike_state',
                    'yticks': range(1, 1+N),
                    'yticklabels': neu_proj, 'title': 'Output'},
                    'Generic LPU %s' % i)

    V.rows = 3
    V.cols = 1
    V.fontsize = 8
    V.out_filename = '%s.mp4' % out_name
    V.codec = 'mpeg4'
    V.xlim = [0, 1.0]
    V.run()
    #V.run('%s.png' % out_name)

# Run the visualizations in parallel:
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号