def _connect(self): '''Connect populations.''' sigma = self._params['sigma'] cutoff = self._max_dist self._cs = csa.cset( csa.cross([0], xrange(self._N - 1)) * (csa.random * (csa.gaussian(sigma, cutoff) * self._d)), 1.0, 1.0)
def _connect(self): '''Connect populations.''' g1 = self._geometryFunction(self._ls) g2 = self._geometryFunction(self._lt) d = csa.euclidMetric2d(g1, g2) sigma = self._params['sigma'] cutoff = self._max_dist cs = csa.cset( csa.cross([0], xrange(self._N - 1)) * (csa.random * (csa.gaussian(sigma, cutoff) * d)), 1.0, 1.0) nest.CGConnect( nest.GetLeaves(self._ls)[0], nest.GetLeaves(self._lt)[0], cs, { 'weight': 0, 'delay': 1 })
def csa_topology_example(): # layers have 20x20 neurons and extent 1 x 1 pop1 = topo.CreateLayer({'elements': 'iaf_neuron', 'rows': 20, 'columns': 20}) pop2 = topo.CreateLayer({'elements': 'iaf_neuron', 'rows': 20, 'columns': 20}) # create CSA-style geometry functions and metric g1 = geometryFunction(pop1) g2 = geometryFunction(pop2) d = csa.euclidMetric2d(g1, g2) # Gaussian connectivity profile, sigma = 0.2, cutoff at 0.5 cs = csa.cset(csa.random * (csa.gaussian(0.2, 0.5) * d), 10000.0, 1.0) # create connections nest.CGConnect(pop1, pop2, cs, {"weight": 0, "delay": 1}) # show targets of center neuron topo.PlotTargets(topo.FindCenterElement(pop1), pop2)
}) """ For each layer, we create a CSA-style geometry function and a CSA metric based on them. """ g1 = geometryFunction(pop1) g2 = geometryFunction(pop2) d = csa.euclidMetric2d(g1, g2) """ The connection set ``cs`` describes a Gaussian connectivity profile with sigma = 0.2 and cutoff at 0.5, and two values (10000.0 and 1.0) used as weight and delay, respectively. """ cs = csa.cset(csa.random * (csa.gaussian(0.2, 0.5) * d), 10000.0, 1.0) """ We can now connect the populations using the `CGConnect` function. It takes the IDs of pre- and postsynaptic neurons (``pop1`` and ``pop2``), the connection set (``cs``) and a dictionary that maps the parameters weight and delay to positions in the value set associated with the connection set. """ # This is a work-around until NEST 3.0 is released. It will issue a deprecation # warning. pop1_gids = nest.GetLeaves(pop1)[0] pop2_gids = nest.GetLeaves(pop2)[0] nest.CGConnect(pop1_gids, pop2_gids, cs, {"weight": 0, "delay": 1}) """
""" For each layer, we create a CSA-style geometry function and a CSA metric based on them. """ g1 = geometryFunction(pop1) g2 = geometryFunction(pop2) d = csa.euclidMetric2d(g1, g2) """ The connection set ``cs`` describes a Gaussian connectivity profile with sigma = 0.2 and cutoff at 0.5, and two values (10000.0 and 1.0) used as weight and delay, respectively. """ cs = csa.cset(csa.random * (csa.gaussian(0.2, 0.5) * d), 10000.0, 1.0) """ We can now connect the populations using the `CGConnect` function. It takes the IDs of pre- and postsynaptic neurons (``pop1`` and ``pop2``), the connection set (``cs``) and a dictionary that maps the parameters weight and delay to positions in the value set associated with the connection set. """ # This is a work-around until NEST 3.0 is released. It will issue a deprecation # warning. pop1_gids = nest.GetLeaves(pop1)[0] pop2_gids = nest.GetLeaves(pop2)[0] nest.CGConnect(pop1_gids, pop2_gids, cs, {"weight": 0, "delay": 1})
print "Process with rank %d running on %s" % (node, socket.gethostname()) rng = NumpyRNG(seed=seed, parallel_safe=True) print "[%d] Creating populations" % node n_spikes = int(2*tstop*input_rate/1000.0) spike_times = numpy.add.accumulate(rng.next(n_spikes, 'exponential', [1000.0/input_rate], mask_local=False)) input_population = Population(10, SpikeSourceArray, {'spike_times': spike_times }, label="input") output_population = Population(10, IF_curr_exp, cell_params, label="output") g=csa.grid2d(3) d=csa.euclidMetric2d(g,g) connector = CSAConnector(csa.cset(csa.random(0.5), csa.gaussian(0.1,1.0)*d, 1.0)) projection = Projection(input_population, output_population, connector, rng=rng) file_stem = "Results/simpleRandomNetwork_np%d_%s" % (num_processes(), simulator_name) projection.saveConnections('%s.conn' % file_stem) output_population.record_v() print "[%d] Running simulation" % node run(tstop) print "[%d] Writing Vm to disk" % node output_population.print_v('%s.v' % file_stem) print "[%d] Finishing" % node