Exemplo n.º 1
0
    def setUpClass(cls):
        """
        Compile the network for this test.

        The input_neuron will generate a sequence of values:

            r_t = [-1, 0, 2, 5, 9, 14, 20, ...]
        """
        input_neuron = Neuron(equations="""
                r = r + t : init = -1
            """)

        neuron2 = Neuron(equations="""
                r = sum(ff)
            """)

        pop1 = Population((3), input_neuron)
        pop2 = Population((3), neuron2)

        # A projection with non-uniform delay
        proj = Projection(pop1, pop2, target="ff")
        proj.connect_one_to_one(weights=1.0, delays=Uniform(1, 5))

        # Build up network
        cls.test_net = Network()
        cls.test_net.add([pop1, pop2, proj])
        cls.test_net.compile(silent=True)

        # Store references for easier usage in test cases
        cls.net_proj = cls.test_net.get(proj)
        cls.net_pop1 = cls.test_net.get(pop1)
        cls.net_pop2 = cls.test_net.get(pop2)
Exemplo n.º 2
0
    def setUpClass(cls):
        """
        Compile the network for this test
        """
        neuron = Neuron(parameters="r=0.0")

        out1 = Neuron(equations="""
                r =  sum(one2one)
            """)

        out2 = Neuron(equations="""
                r =  sum(all2all) + sum(fnp)
            """)

        pop1 = Population((17, 17), neuron)
        pop2 = Population((17, 17), out1)
        pop3 = Population(4, out2)

        proj = Projection(pre=pop1, post=pop2, target="one2one")
        proj.connect_one_to_one(
            weights=0.0,
            force_multiple_weights=True)  # weights set in the test

        proj2 = Projection(pre=pop1, post=pop3, target="all2all")
        proj2.connect_all_to_all(weights=Uniform(0, 1))

        proj3 = Projection(pre=pop1, post=pop3, target="fnp")
        proj3.connect_fixed_number_pre(5, weights=Uniform(0, 1))

        cls.test_net = Network()
        cls.test_net.add([pop1, pop2, pop3, proj, proj2, proj3])
        cls.test_net.compile(silent=True)

        cls.net_pop1 = cls.test_net.get(pop1)
        cls.net_pop2 = cls.test_net.get(pop2)
        cls.net_pop3 = cls.test_net.get(pop3)
        cls.net_proj = cls.test_net.get(proj)
        cls.net_proj2 = cls.test_net.get(proj2)
        cls.net_proj3 = cls.test_net.get(proj3)
Exemplo n.º 3
0
    def setUpClass(cls):
        """
        Build up the network
        """
        simple_emit = Neuron(spike="t==1", )
        simple_recv = Neuron(equations="""
                g_exc1 = 0
                g_exc2 = 0
                g_exc3 = 0
            """,
                             spike="g_exc1>30")

        # simple in/out populations
        in_pop = Population(5, neuron=simple_emit)
        out_pop = Population(2, neuron=simple_recv)

        # create the projections for the test cases (TC)
        # TC: no delay
        proj = Projection(pre=in_pop, post=out_pop, target="exc1")
        proj.connect_all_to_all(weights=1.0, storage_format="csr")
        # TC: uniform delay
        proj_u = Projection(pre=in_pop, post=out_pop, target="exc2")
        proj_u.connect_all_to_all(weights=1.0,
                                  delays=2.0,
                                  storage_format="csr")
        # TC: non-uniform delay
        proj_nu = Projection(pre=in_pop, post=out_pop, target="exc3")
        proj_nu.connect_all_to_all(weights=1.0, delays=Uniform(2, 10))

        # Monitor to record the currents
        m = Monitor(out_pop, ["g_exc1", "g_exc2", "g_exc3"])

        # build network and store required object
        # instances
        net = Network()
        net.add([in_pop, out_pop, proj, proj_u, proj_nu, m])
        cls.test_net = net
        cls.test_net.compile(silent=True)
        cls.test_g_exc_m = net.get(m)
        cls.test_proj = net.get(proj_nu)
Exemplo n.º 4
0
#####################################################
########  PROJECTIONS  ##############################
#####################################################

############# FROM INPUT #############

ITPFC = Projection(pre=IT, post=PFC, target='exc', synapse=PostCovariance)
ITPFC.connect_all_to_all(
    weights=changed['ITPFC.connect_all_to_all'])  #Normal(0.3,0.1) )

ITStrD1 = Projection(pre=IT,
                     post=StrD1,
                     target='exc',
                     synapse=DAPostCovarianceNoThreshold)
ITStrD1.connect_all_to_all(weights=Uniform(0, 0.3))  #Normal(0.15,0.15))

ITStrD2 = Projection(pre=IT,
                     post=StrD2,
                     target='exc',
                     synapse=DAPostCovarianceNoThreshold)
ITStrD2.connect_all_to_all(weights=Uniform(0, 0.3))  #Normal(0.15,0.15))
ITStrD2.DA_type = -1

ITSTN = Projection(pre=IT,
                   post=STN,
                   target='exc',
                   synapse=DAPostCovarianceNoThreshold)
ITSTN.connect_all_to_all(weights=Uniform(0, 0.3))  #Normal(0.15,0.15))
ITSTN.DA_type = 1
Exemplo n.º 5
0
    tau_syn_E * dg_exc/dt = - g_exc : exponential
    tau_syn_I * dg_inh/dt = - g_inh : exponential
"""

# population setup
pop = Population(Ne + Ni, neuron=neuron)
E = pop[:Ne]
I = pop[Ne:]

# projection setup
C_ei = Projection(pre=E, post=I, target='exc', name='EI')
C_ie = Projection(pre=I, post=E, target='inh', name='IE')
#C_ee = Projection(E, E, 'exc', name='EE')
#C_ii = Projection(I, I, 'inh', name='II')
C_ei.connect_fixed_probability(0.1, weights=Uniform(c_min, c_max))
C_ie.connect_fixed_probability(0.1, weights=Uniform(c_min, c_max))
#C_ee.connect_fixed_probability(0.3, weights=Uniform(c_min, c_max))
#C_ii.connect_fixed_probability(0.3, weights=Uniform(c_min, c_max))

# input
#steps = int(T/dt)
#I_e_tmp = 5.0 + np.random.randn(steps, Ne) * 50.0 * np.sqrt(dt)   # input current for excitatory neurons
#I_i_tmp = 4.0 + np.random.randn(steps, Ni) * 44.0 * np.sqrt(dt)   # input current for inhibitory neurons
#I_e = TimedArray(rates=I_e_tmp, name="E_inp")
#I_i = TimedArray(rates=I_i_tmp, name="I_inp")
#inp_e = Projection(pre=I_e, post=E, target='exc')
#inp_i = Projection(pre=I_i, post=I, target='exc')
#inp_e.connect_one_to_one(1.0)
#inp_i.connect_one_to_one(1.0)
E.i_offset = 5.0