Skip to content

Commit

Permalink
Modify generic LPU example to generate LPUs containing output graded …
Browse files Browse the repository at this point in the history
…potential neurons.
  • Loading branch information
lebedov committed Dec 7, 2015
1 parent f0e67b1 commit 2bc7d94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/generic/data/gen_generic_lpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def create_lpu(file_name, lpu_name, N_sensory, N_local, N_proj):
name = t+"_"+str(i)

# All local neurons are graded potential only:
if t != 'local' or np.random.rand() < 0.5:
if t != 'local' and np.random.rand() < 0.5:
G.node[idx] = {
'model': 'LeakyIAF',
'name': name+'_s',
Expand Down Expand Up @@ -93,7 +93,7 @@ def create_lpu(file_name, lpu_name, N_sensory, N_local, N_proj):
# ports (which are not represented as separate nodes):
if t == 'proj':
G.node[idx]['selector'] = '/%s/out/gpot/%s' % (lpu_name, str(gpot_out_id))
gpot_out_id = 1
gpot_out_id += 1

idx += 1

Expand Down
6 changes: 4 additions & 2 deletions examples/generic/visualize_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
nx.readwrite.gexf.GEXF.convert_bool = {'false':False, 'False':False,
'true':True, 'True':True}

# Select IDs of projection neurons:
# Select IDs of spiking 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'])
neu_proj = sorted([int(k) for k, n in G.node.items() if \
n['name'][:4] == 'proj' and \
n['spiking']])

V = vis.visualizer()
V.add_LPU('./data/generic_input.h5', LPU='Sensory')
Expand Down

0 comments on commit 2bc7d94

Please sign in to comment.