Example #1
0
 def setUp(self):
     neuron.Population.nPop = 0
     self.net = neuron.Population((3, 3), neuron.IF_curr_alpha)
     self.net2 = neuron.Population((5, ), 'StandardIF', {
         'syn_type': 'current',
         'syn_shape': 'exp'
     })
Example #2
0
 def setUp(self):
     neuron.Population.nPop = 0
     self.net1 = neuron.Population((10, ), neuron.IF_curr_alpha)
     self.net2 = neuron.Population((2, 4, 3), neuron.IF_curr_exp)
     self.net3 = neuron.Population((2, 2, 1), neuron.SpikeSourceArray)
     self.net4 = neuron.Population((1, 2, 1), neuron.SpikeSourceArray)
     self.net5 = neuron.Population((3, 3), neuron.IF_cond_alpha)
Example #3
0
 def setUp(self):
     self.target = neuron.Population((3, 3), neuron.IF_curr_alpha)
     self.source = neuron.Population((3, 3), neuron.SpikeSourcePoisson,
                                     {'rate': 200})
     self.distrib_Numpy = RandomDistribution(rng=NumpyRNG(12345),
                                             distribution='uniform',
                                             parameters=(0, 1))
     self.distrib_Native = RandomDistribution(rng=NativeRNG(12345),
                                              distribution='uniform',
                                              parameters=(0, 1))
Example #4
0
 def testSimpleInit(self):
     """Population.__init__(): the cell list in hoc should have the same length as the population size."""
     net = neuron.Population((3, 3), neuron.IF_curr_alpha)
     n_cells = getattr(h, net.label).count()
     n_cells_lower = int(getattr(h, net.label).count())
     # round-robin distribution
     assert 9 / neuron.nhost <= n_cells_lower <= 9 / neuron.nhost + 1, "%d not between %d and %d" % (
         n_cells_lower, 9 / neuron.nhost, 9 / neuron.nhost + 1)
Example #5
0
 def testInitWithParams(self):
     """Population.__init__(): Parameters set on creation should be the same as
     retrieved with the top-level HocObject"""
     net = neuron.Population((3, 3), neuron.IF_curr_alpha,
                             {'tau_syn_E': 3.141592654})
     cell_list = getattr(h, net.label)
     for i in range(int(cell_list.count())):
         tau_syn = cell_list.object(i).esyn.tau
         self.assertAlmostEqual(tau_syn, 3.141592654, places=5)
Example #6
0
 def testInitWithNonStandardModel(self):
     """Population.__init__(): the cell list in hoc should have the same length as the population size."""
     net = neuron.Population((3, 3), 'StandardIF', {
         'syn_type': 'current',
         'syn_shape': 'exp'
     })
     n_cells = getattr(h, net.label).count()
     n_cells_lower = int(getattr(h, net.label).count())
     # round-robin distribution
     assert 9 / neuron.nhost <= n_cells_lower <= 9 / neuron.nhost + 1, "%d not between %d and %d" % (
         n_cells_lower, 9 / neuron.nhost, 9 / neuron.nhost + 1)
Example #7
0
 def testRecordWithSpikeTimesGreaterThanSimTime(self):
     """
     If a `SpikeSourceArray` is initialized with spike times greater than the
     simulation time, only those spikes that actually occurred should be
     written to file or returned by getSpikes().
     """
     spike_times = numpy.arange(10.0, 200.0, 10.0)
     spike_source = neuron.Population(1, neuron.SpikeSourceArray,
                                      {'spike_times': spike_times})
     spike_source.record()
     neuron.running = False
     neuron.run(100.0)
     spikes = spike_source.getSpikes()[:, 1]
     if neuron.myid == 0:
         self.assert_(max(spikes) == 100.0, str(spikes))
Example #8
0
 def setUp(self):
     neuron.Population.nPop = 0
     neuron.Projection.nProj = 0
     self.target33 = neuron.Population((3, 3), neuron.IF_curr_alpha)
     self.target6 = neuron.Population((6, ), neuron.IF_curr_alpha)
     self.source5 = neuron.Population((5, ), neuron.SpikeSourcePoisson)
     self.source22 = neuron.Population((2, 2), neuron.SpikeSourcePoisson)
     self.source33 = neuron.Population((3, 3), neuron.SpikeSourcePoisson)
     self.expoisson33 = neuron.Population((3, 3), neuron.SpikeSourcePoisson,
                                          {'rate': 100})
Example #9
0
 def setUp(self):
     neuron.Population.nPop = 0
     self.pop1 = neuron.Population((5, ), neuron.IF_curr_alpha,
                                   {'tau_m': 10.0})
     self.pop2 = neuron.Population((5, 4), neuron.IF_curr_exp,
                                   {'v_reset': -60.0})
Example #10
0
 def setUp(self):
     neuron.Population.nPop = 0
     self.pop1 = neuron.Population((3, 3), neuron.SpikeSourcePoisson,
                                   {'rate': 20})
     self.pop2 = neuron.Population((3, 3), neuron.IF_curr_alpha)
Example #11
0
 def testInitWithLabel(self):
     """Population.__init__(): A label set on initialisation should be retrievable with the Population.label attribute."""
     net = neuron.Population((3, 3),
                             neuron.IF_curr_alpha,
                             label='iurghiushrg')
     assert net.label == 'iurghiushrg'