Skip to content
Snippets Groups Projects
Unverified Commit fe297d91 authored by Sebastian Schmitt's avatar Sebastian Schmitt Committed by GitHub
Browse files

List comprehension to speed up brunel python example (#1864)

parent 938d9da2
No related branches found
No related tags found
No related merge requests found
...@@ -64,11 +64,16 @@ class brunel_recipe (arbor.recipe): ...@@ -64,11 +64,16 @@ class brunel_recipe (arbor.recipe):
gen = RandomState(gid + self.seed_) gen = RandomState(gid + self.seed_)
connections=[] connections=[]
# Add incoming excitatory connections. # Add incoming excitatory connections.
for i in sample_subset(gen, gid, 0, self.ncells_exc_, self.in_degree_exc_): connections = [
connections.append(arbor.connection((i,"src"), "tgt", self.weight_exc_, self.delay_)) arbor.connection((i,"src"), "tgt", self.weight_exc_, self.delay_)
for i in sample_subset(gen, gid, 0, self.ncells_exc_, self.in_degree_exc_)
]
# Add incoming inhibitory connections. # Add incoming inhibitory connections.
for i in sample_subset(gen, gid, self.ncells_exc_, self.ncells_exc_ + self.ncells_inh_, self.in_degree_inh_): connections += [
connections.append(arbor.connection((i,"src"), "tgt", self.weight_inh_, self.delay_)) arbor.connection((i,"src"), "tgt", self.weight_inh_, self.delay_)
for i in sample_subset(gen, gid, self.ncells_exc_, self.ncells_exc_ + self.ncells_inh_, self.in_degree_inh_)
]
return connections return connections
def cell_description(self, gid): def cell_description(self, gid):
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment