コード例 #1
0
 def test_issue2051(self):
     p1 = pyhmf.Population(1000, pyhmf.EIF_cond_exp_isfa_ista)
     p2 = pyhmf.Population(1000, pyhmf.EIF_cond_exp_isfa_ista)
     if self.API_VERSION == "0.8":
         prj = pyhmf.Projection(p1, p2, pyhmf.AllToAllConnector(),
                                pyhmf.StaticSynapse(weight=0.05, delay=0.5))
         params = {
             'U': 0.04,
             'tau_rec': 100.0,
             'tau_facil': 1000.0,
             'weight': 0.01
         }
         facilitating = pyhmf.TsodyksMarkramSynapse(**params)
         prj = pyhmf.Projection(
             p1,
             p2,
             pyhmf.FixedProbabilityConnector(p_connect=0.1),
             synapse_type=facilitating)
     elif self.API_VERSION == "0.7":
         prj = pyhmf.Projection(
             p1, p2, pyhmf.AllToAllConnector(weights=0.05, delays=0.5))
         params = {'U': 0.04, 'tau_rec': 100.0, 'tau_facil': 1000.0}
         facilitating = pyhmf.SynapseDynamics(
             fast=pyhmf.TsodyksMarkramMechanism(**params))
         prj = pyhmf.Projection(p1,
                                p2,
                                pyhmf.FixedProbabilityConnector(
                                    p_connect=0.1, weights=0.01),
                                synapse_dynamics=facilitating)
コード例 #2
0
    def big_network(self):
        pynn.setup(marocco=self.marocco)

        synapses = 0
        numberOfPopulations = random.randint(100, 150)
        logging.debug("number of populations: %d" % (numberOfPopulations))
        #print "numPops: %d" % (numberOfPopulations)

        # FIXME: spuouriously fails, why?
        #pops = [ Population(random.randint(50, 85), EIF_cond_exp_isfa_ista) for x in
        #range(numberOfPopulations) ]
        pops = [
            pynn.Population(80, pynn.EIF_cond_exp_isfa_ista)
            for x in range(numberOfPopulations)
        ]

        for idx, pop in enumerate(pops):

            connectorE = pynn.FixedProbabilityConnector(
                p_connect=0.20, allow_self_connections=True, weights=1.)

            connectorI = pynn.FixedProbabilityConnector(
                p_connect=0.10, allow_self_connections=True, weights=1.)

            # build ring like network topology
            proj = pynn.Projection(pop,
                                   pops[(idx + 1) % len(pops)],
                                   connectorE,
                                   target='excitatory')
            synapses += np.count_nonzero(proj.getWeights())

            proj = pynn.Projection(pop,
                                   pops[(idx + 1) % len(pops)],
                                   connectorI,
                                   target='inhibitory')
            synapses += np.count_nonzero(proj.getWeights())

            # add poisson stimulus
            source = pynn.Population(1, pynn.SpikeSourcePoisson, {'rate': 2})

            proj = pynn.Projection(source,
                                   pop,
                                   connectorE,
                                   target='excitatory')
            synapses += np.count_nonzero(proj.getWeights())

        pynn.run(100)
        pynn.end()

        logging.debug("synapses counted in python: %d", synapses)
        return synapses
コード例 #3
0
    def test(self):

        import pyhmf as pynn
        from pymarocco import PyMarocco
        import pylogging, pyhalbe
        pyhalbe.Debug.change_loglevel(2)
        pylogging.set_loglevel(pylogging.get("marocco"),
                               pylogging.LogLevel.TRACE)
        pylogging.set_loglevel(pylogging.get("sthal"),
                               pylogging.LogLevel.DEBUG)

        marocco = PyMarocco()
        marocco.neuron_placement.default_neuron_size(4)

        pynn.setup(marocco=marocco)

        neuron1 = pynn.Population(1, pynn.IF_cond_exp)

        inh = pynn.Population(1, pynn.SpikeSourceArray, {'spike_times': [0]})
        exc = pynn.Population(1, pynn.SpikeSourceArray, {'spike_times': [0]})
        exc_2 = pynn.Population(1, pynn.SpikeSourceArray, {'spike_times': [0]})
        exc_3 = pynn.Population(1, pynn.SpikeSourceArray, {'spike_times': [0]})

        c_exc = pynn.FixedProbabilityConnector(p_connect=1.0, weights=1)

        proj1 = pynn.Projection(inh, neuron1, c_exc, target='excitatory')
        proj2 = pynn.Projection(exc, neuron1, c_exc, target='excitatory')
        proj3 = pynn.Projection(exc_2, neuron1, c_exc, target='excitatory')
        proj4 = pynn.Projection(exc_3, neuron1, c_exc, target='inhibitory')

        pynn.run(10000)
        pynn.end()
コード例 #4
0
    def test_issue1565(self):
        # although there is only 1 synapse column per neuron (of size 2), a 2nd synapse is used
        self.marocco.neuron_placement.default_neuron_size(2)
        con = pynn.FixedProbabilityConnector(p_connect=1.0, weights=0.004)

        pynn.setup(marocco=self.marocco)
        pop1 = pynn.Population(10, pynn.IF_cond_exp, {})
        ipu1 = pynn.Population(2, pynn.SpikeSourceArray, {'spike_times': []})
        pro1 = pynn.Projection(ipu1, pop1, con, target='excitatory')
        pynn.run(0)
コード例 #5
0
    def build(self):

        self.neurons = pynn.Population(self.N, self.model)

        connector = pynn.FixedProbabilityConnector(p_connect=self.prob,
                                                   allow_self_connections=True,
                                                   weights=0.003)

        pynn.Projection(self.neurons,
                        self.neurons,
                        connector,
                        target='excitatory',
                        rng=pynn.NativeRNG(42))
コード例 #6
0
    def test_issue1681(self):
        con = pynn.FixedProbabilityConnector(p_connect=1.0, weights=0.004)

        pynn.setup(marocco=self.marocco)
        pop1 = pynn.Population(10, pynn.IF_cond_exp, {})
        ipu1 = pynn.Population(1, pynn.SpikeSourceArray, {'spike_times': []})
        pro1 = pynn.Projection(ipu1, pop1, con, target='excitatory')

        # Issue 1681 "IndexError after mapping ends" is triggered by adding a
        # population after a projection:
        # Expected Output: NO ERROR
        # Actual Output: "IndexError: vector::_M_range_check" (i.e. abnormal termination)
        pop2 = pynn.Population(10, pynn.IF_cond_exp, {})
        pynn.run(0)
コード例 #7
0
    def build(self):

        self.neurons = []
        for i in range(self.num_layers):
            self.neurons.append(
                pynn.Population(self.neurons_per_layer, self.model))

        connector = pynn.FixedProbabilityConnector(
            p_connect=self.conn_prob,
            allow_self_connections=False,
            weights=0.003)
        proj = []
        for i in range(1, self.num_layers):
            proj = pynn.Projection(self.neurons[i - 1],
                                   self.neurons[i],
                                   connector,
                                   target='excitatory',
                                   rng=pynn.NativeRNG(42))
コード例 #8
0
    def test_stimulated_network(self):
        con = pynn.FixedProbabilityConnector(p_connect=1.0, weights=0.004)

        pop_size = 100
        ipu_size = 20

        pynn.setup(marocco=self.marocco)
        ipu1 = pynn.Population(ipu_size, pynn.SpikeSourceArray, {'spike_times': []})
        pop1 = pynn.Population(pop_size, pynn.IF_cond_exp, {})
        pro1 = pynn.Projection(ipu1, pop1, con, target='excitatory')

        ipu2 = pynn.Population(ipu_size, pynn.SpikeSourceArray, {'spike_times': []})
        pop2 = pynn.Population(pop_size, pynn.IF_cond_exp, {})
        pro2 = pynn.Projection(ipu2, pop2, con, target='excitatory')

        pynn.run(0)
        all_pops = [pop1, ipu1, pop2, ipu2]
        map(self.helper_test_mapping, all_pops)
        pynn.end()
コード例 #9
0
def main():
    """
    create small network with synapse loss.  The synapse loss happens due to a
    maximum syndriver chain length of 5 and only 4 denmems per neuron.  After
    mapping, the synapse loss per projection is evaluated and plotted for one
    projection.  The sum of lost synapses per projection is compared to the
    overall synapse loss returnd by the mapping stats.
    """
    marocco = PyMarocco()
    marocco.neuron_placement.default_neuron_size(4)
    marocco.synapse_routing.driver_chain_length(5)
    marocco.continue_despite_synapse_loss = True
    marocco.calib_backend = PyMarocco.CalibBackend.Default
    marocco.neuron_placement.skip_hicanns_without_neuron_blacklisting(False)

    pynn.setup(marocco=marocco)

    neuron = pynn.Population(50, pynn.IF_cond_exp)
    source = pynn.Population(50, pynn.SpikeSourcePoisson, {'rate': 2})

    connector = pynn.FixedProbabilityConnector(allow_self_connections=True,
                                               p_connect=0.5,
                                               weights=0.00425)
    proj_stim = pynn.Projection(source, neuron, connector, target="excitatory")
    proj_rec = pynn.Projection(neuron, neuron, connector, target="excitatory")

    pynn.run(1)

    print marocco.stats

    total_syns = 0
    lost_syns = 0
    for proj in [proj_stim, proj_rec]:
        l, t = projectionwise_synapse_loss(proj, marocco)
        total_syns += t
        lost_syns += l

    assert total_syns == marocco.stats.getSynapses()
    assert lost_syns == marocco.stats.getSynapseLoss()

    plot_projectionwise_synapse_loss(proj_stim, marocco)
    pynn.end()
コード例 #10
0
ファイル: test_issue1550.py プロジェクト: cpehle/marocco
import pyhmf as pynn
from pymarocco import PyMarocco
import pylogging, pyhalbe
pyhalbe.Debug.change_loglevel(2)
pylogging.set_loglevel(pylogging.get("marocco"), pylogging.LogLevel.TRACE)
pylogging.set_loglevel(pylogging.get("sthal"), pylogging.LogLevel.DEBUG)

marocco = PyMarocco()
marocco.neuron_placement.default_neuron_size(4)

pynn.setup(marocco=marocco)

neuron1 = pynn.Population(1, pynn.IF_cond_exp)

inh = pynn.Population(1, pynn.SpikeSourceArray, {'spike_times': [0]})
exc = pynn.Population(1, pynn.SpikeSourceArray, {'spike_times': [0]})
exc_2 = pynn.Population(1, pynn.SpikeSourceArray, {'spike_times': [0]})
exc_3 = pynn.Population(1, pynn.SpikeSourceArray, {'spike_times': [0]})

c_exc = pynn.FixedProbabilityConnector(p_connect=1.0, weights=1)

proj1 = pynn.Projection(inh, neuron1, c_exc, target='excitatory')
proj2 = pynn.Projection(exc, neuron1, c_exc, target='excitatory')
proj3 = pynn.Projection(exc_2, neuron1, c_exc, target='excitatory')
proj4 = pynn.Projection(exc_3, neuron1, c_exc, target='inhibitory')

pynn.run(10000)
pynn.end()