Example #1
0
 def test_identicalprojection(self):
     for pop in self.pops:
         for pop_in in self.pops_in.values():
             pynn.Projection(pop_in, pop, pynn.OneToOneConnector())
             pynn.Projection(pynn.PopulationView(pop_in, [0]),
                             pop,
                             pynn.OneToOneConnector())
Example #2
0
    def test_number_of_spike_trains(self):
        """
        Here we test that only spikes are recorded for the neurons we set in
        the spike recording mode.
        """

        runtime = 0.5  # ms
        pop_size = 4

        pops = []
        pops.append(pynn.Population(pop_size, pynn.cells.HXNeuron()))
        pops.append(pynn.Population(pop_size, pynn.cells.HXNeuron()))
        pops.append(pynn.Population(pop_size, pynn.cells.HXNeuron()))

        # Once record whole population, once subset and once no neurons
        pops[0].record(['spikes'])
        pynn.PopulationView(pops[1], [0]).record(['spikes'])

        # Spike input
        input_pop = pynn.Population(1, pynn.cells.SpikeSourceArray(
            spike_times=np.arange(0.1, runtime, runtime / 10)))
        for pop in pops:
            pynn.Projection(input_pop, pop, pynn.AllToAllConnector(),
                            synapse_type=StaticSynapse(weight=63))

        pynn.run(runtime)

        # Assert correct number of recorded spike trains
        self.assertEqual(len(pops[0].get_data().segments[0].spiketrains),
                         pop_size)
        self.assertEqual(len(pops[1].get_data().segments[0].spiketrains), 1)
        self.assertEqual(len(pops[2].get_data().segments[0].spiketrains), 0)
Example #3
0
 def test_popviewalltoall(self):
     for pop in self.pops:
         for pop_in in self.pops_in.values():
             pynn.Projection(pop_in,
                             pynn.PopulationView(pop, [0]),
                             pynn.AllToAllConnector())
Example #4
0
 def test_popview1to1(self):
     for pop in self.pops:
         for pop_in in self.pops_in.values():
             pynn.Projection(pop_in,
                             pynn.PopulationView(pop, [0]),
                             pynn.OneToOneConnector())
    # Reset potential, range: 300-1000
    reset_v_reset=400,
    # Membrane capacitance, range: 0-63
    membrane_capacitance_capacitance=63,
    # Refractory time, range: 0-255
    refractory_period_refractory_time=120,
    # Enable reset on threshold crossing
    threshold_enable=True,
    # Reset conductance, range: 0-1022
    reset_i_bias=1022,
    # Enable strengthening of reset conductance
    reset_enable_multiplication=True))

for neuron_id in range(len(pop)):
    logger.INFO(f"Recording fixed-pattern variations: Run {neuron_id}")
    p_view = pynn.PopulationView(pop, [neuron_id])
    p_view.record(["v"])
    pynn.run(0.1)
    plot_membrane_dynamics(p_view)
    pynn.reset()
    pop.record(None)

# Show the recorded membrane traces of multiple different neurons. Due to
# the time-continuous nature of the system, there is no temporal alignment
# between the individual traces, so the figure shows multiple independent
# effects:
#  * Temporal misalignment: From the system's view, the recording happens in
#    an arbitrary time frame during the continuously evolving integration.
#    Neurons are not synchronized to each other.
#  * Circuit-level mismatch: Each individual neurons shows slightly
#    different analog properties. The threshold is different for all traces;