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') V.add_plot({'type': 'waveform', 'ids': [[0]]}, 'input_Sensory') for i in [0, 1]: G = nx.read_gexf('./data/generic_lpu_%s.gexf.gz' % i) neu_pub = sorted([int(n) for n, d in G.nodes_iter(True) \ if d['public'] == True]) V.add_LPU('generic_lpu_%s_%s_output_spike.h5' % (i, out_name), './data/generic_lpu_%s.gexf.gz' % i, 'Generic LPU %s' % i) V.add_plot({'type': 'raster', 'ids': {0: neu_pub}, #'yticks': range(1, 1+len(neu_out)), #'yticklabels': range(len(neu_out)) }, 'Generic LPU %s' % i, 'Output') V._update_interval = 50 V.rows = 3 V.cols = 1 V.fontsize = 18 V.out_filename = '%s.avi' % out_name V.codec = 'libtheora' V.dt = 0.0001 V.xlim = [0, 1.0] V.run()
def run(out_name): V = vis.visualizer() V.add_LPU('./data/generic_input_0.h5', LPU='Sensory') V.add_plot({'type':'waveform', 'ids': [[0]]}, 'input_Sensory') for i in [0, 1]: G = nx.read_gexf('./data/generic_lpu_%s.gexf.gz' % i) neu_out = [k for k, n in G.node.items() if n['name'][:3] == 'out'] V.add_LPU('generic_output_%s_%s_spike.h5' % (i, out_name), './data/generic_lpu_%s.gexf.gz' % i, 'Generic LPU %s' % i) V.add_plot({'type': 'raster', 'ids': {0: range(len(neu_out))}, #'yticks': range(1, 1+len(neu_out)), #'yticklabels': range(len(neu_out)) }, 'Generic LPU %s' % i, 'Output') V._update_interval = 50 V.rows = 3 V.cols = 1 V.fontsize = 18 V.out_filename = 'generic_output_%s.avi' % out_name V.codec = 'libtheora' V.dt = 0.0001 V.xlim = [0, 1.0] V.run()
import neurokernel.LPU.utils.visualizer as vis import networkx as nx nx.readwrite.gexf.GEXF.convert_bool = { 'false': False, 'False': False, 'true': True, 'True': True } # Select IDs of projection neurons: G = nx.read_gexf('./data/generic_lpu.gexf.gz') neu_proj = sorted( [int(k) for k, n in G.node.items() if n['name'][:4] == 'proj']) V = vis.visualizer() V.add_LPU('./data/generic_input.h5', LPU='Sensory') V.add_plot({'type': 'waveform', 'ids': [[0]]}, 'input_Sensory') V.add_LPU('generic_output_spike.h5', './data/generic_lpu.gexf.gz', 'Generic LPU') V.add_plot( { 'type': 'raster', 'ids': { 0: neu_proj }, 'yticks': range(1, 1 + len(neu_proj)), 'yticklabels': range(len(neu_proj)) }, 'Generic LPU', 'Output')
LAM_GEXF_FILE = 'lamina.gexf.gz' INPUT_FILE = 'vision_input.h5' IMAGE_FILE = 'image1.mat' RET_OUTPUT_FILE = 'retina_output' LAM_OUTPUT_FILE = 'lamina_output' RET_OUTPUT_GPOT = RET_OUTPUT_FILE + '_gpot.h5' LAM_OUTPUT_GPOT = LAM_OUTPUT_FILE + '_gpot.h5' RET_OUTPUT_PNG = 'retina_output.png' LAM_OUTPUT_PNG = 'lamina_output.png' RET_OUTPUT_AVI = 'retina_output.avi' LAM_OUTPUT_AVI = 'lamina_output.avi' RET_OUTPUT_MPEG = 'retina_output.mp4' LAM_OUTPUT_MPEG = 'lamina_output.mp4' V = vis.visualizer() n = Normalize(vmin=0, vmax=2000, clip=True) conf_input = {} conf_input['norm'] = n conf_input['type'] = 'dome' V.add_LPU('intensities.h5','retina.gexf.gz', LPU='Vision', is_input=True) V.add_plot(conf_input, 'input_Vision') conf_R1 = {} conf_R1['type'] = 'dome' V.add_LPU(RET_OUTPUT_GPOT,'retina.gexf.gz', LPU='Retina') V.add_plot(conf_R1, 'Retina', 'R1') conf_L1 = {} conf_L1['type'] = 'dome' V.add_LPU(LAM_OUTPUT_GPOT, 'lamina.gexf.gz', LPU='Lamina') V.add_plot(conf_L1, 'Lamina', 'L1')
position_PEN = list(uids).index(sort_list_dict_PEN[i]) id_positions_PEN.append(position_PEN) sort_list['PEN'] = sort_list_list_PEN data_out = data_T[id_positions_PEN, :].T with h5py.File('%s_output_pick.h5' % 'PEN', 'w') as f: f.create_dataset('/array', data=data_out) logger = setup_logger(screen=True) dt = 1e-4 update_interval = None fontsize = 16 xlim = [0, 1.0] v_BU = vis.visualizer() v_BU.add_LPU('BU_output.h5', LPU='BU') v_BU.add_plot( { 'type': 'raster', 'uids': [sort_list['BU']], 'variable': 'spike_state', 'yticks': range( 1, 1 + len(sort_list['BU'])), #'yticklabels': range(len(bu_neurons)) 'yticklabels': [] }, 'BU') #[list(np.arange(753,785, dtype=np.int32))] v_BU.add_LPU('bu_output.h5', LPU='bu')