def setUpClass(cls): """ Compile the network for this test """ neuron = Neuron( equations="r = 1" ) neuron2 = Neuron( equations="r = sum(exc)" ) pop1 = Population((3, 3), neuron) pop2 = Population((3, 3), neuron2) proj1 = Projection(pre=pop1, post=pop2, target="exc") proj2 = Projection(pre=pop1, post=pop2, target="exc") proj3 = Projection(pre=pop1, post=pop2, target="exc") proj1.connect_one_to_one(weights=0.1) proj2.connect_all_to_all(weights=0.1) proj3.connect_fixed_number_pre(3, weights=0.1) cls.test_net = Network() cls.test_net.add([pop1, pop2, proj1, proj2, proj3]) cls.test_net.compile(silent=True) cls.test_proj1 = cls.test_net.get(proj1) cls.test_proj2 = cls.test_net.get(proj2) cls.test_proj3 = cls.test_net.get(proj3)
def setUpClass(cls): """ Compile the network for this test """ simple_neuron = Neuron( parameters="r=1.0" ) eq_set = Synapse( equations=""" glob_var = 0.1 : projection semi_glob_var = 0.2 : postsynaptic w = t + glob_var + semi_glob_var """ ) pop0 = Population(3, simple_neuron) pop1 = Population(1, simple_neuron) proj = Projection(pop0, pop1, "exc", eq_set) proj.connect_all_to_all(weights=0.0) cls.test_net = Network() cls.test_net.add([pop0, pop1, proj]) cls.test_net.compile(silent=True)
def setUpClass(cls): """ Compile the network for this test """ neuron = Neuron(equations="r = 1") neuron2 = Neuron(equations="r = sum(exc)") pop1 = Population((3, 3), neuron) pop2 = Population((3, 3), neuron2) proj1 = Projection(pre=pop1, post=pop2, target="exc") proj2 = Projection(pre=pop1, post=pop2, target="exc") proj3 = Projection(pre=pop1, post=pop2, target="exc") proj1.connect_one_to_one(weights=0.1) proj2.connect_all_to_all(weights=0.1) proj3.connect_fixed_number_pre(3, weights=0.1) cls.test_net = Network() cls.test_net.add([pop1, pop2, proj1, proj2, proj3]) cls.test_net.compile(silent=True) cls.test_proj1 = cls.test_net.get(proj1) cls.test_proj2 = cls.test_net.get(proj2) cls.test_proj3 = cls.test_net.get(proj3)
def setUpClass(self): """ Compile the network for this test """ neuron = Neuron(parameters="tau = 10", equations="r += 1/tau * t") neuron2 = Neuron(parameters="tau = 10: population", equations="r += 1/tau * t: init = 1.0") Oja = Synapse(parameters=""" tau = 5000.0 : postsynaptic alpha = 8.0 """, equations=""" tau * dw/dt = pre.r * post.r - alpha * post.r^2 * w """) pop1 = Population(5, neuron) pop2 = Population(8, neuron2) proj = Projection(pre=pop1, post=pop2, target="exc", synapse=Oja) proj.connect_all_to_all(weights=1.0) self.test_net = Network() self.test_net.add([pop1, pop2, proj]) self.test_net.compile(silent=True) self.net_proj = self.test_net.get(proj)
def setUpClass(cls): """ Define and compile the network for this test. """ input_neuron = Neuron(parameters="r=0.0") output_neuron = Neuron(equations=""" r = sum(p1) + sum(p2) """) syn_max = Synapse(psp="pre.r * w", operation="max") syn_min = Synapse(psp="pre.r * w", operation="min") syn_mean = Synapse(psp="pre.r * w", operation="mean") pop1 = Population((3, 3), neuron=input_neuron) pop2 = Population(4, neuron=output_neuron) proj1 = Projection(pop1, pop2, target="p1", synapse=syn_max) proj1.connect_all_to_all(weights=1.0) proj2 = Projection(pop1, pop2, target="p2", synapse=syn_min) proj2.connect_all_to_all(weights=1.0) proj3 = Projection(pop1, pop2, target="p3", synapse=syn_mean) proj3.connect_all_to_all(weights=1.0) cls.test_net = Network() cls.test_net.add([pop1, pop2, proj1, proj2, proj3]) cls.test_net.compile(silent=True) cls.net_pop1 = cls.test_net.get(pop1) cls.net_pop2 = cls.test_net.get(pop2)
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)
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)
GPe.phi = changed['noise_GPe'] GPe.B = params['baseline_GPe'] # MD MD = Population(name='MD', geometry=nBG, neuron=LinearNeuron) MD.phi = changed['noise_MD'] MD.B = changed['baseline_MD'] ##################################################### ######## 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,
v_old = v_new tau * dv/dt = 1.0 - cos(v_old) + (1.0 + cos(v_old))*(eta + J*g_syn*tau) : init=6.2832, min=0.0 tau_s * dg_syn/dt = g_exc*tau_s - g_syn v_tmp = v/(2*pi) : int v_new = (v/(2*pi) - v_tmp)*2*pi """, spike="(v_new > pi)*(v_old < pi)") # population setup pop1 = Population(N, neuron=Theta, name="ThetaPop1") pop1.eta = eta + D * np.tan( (np.pi / 2) * (2 * np.arange(1, N + 1) - N - 1) / (N + 1)) # projection setup proj = Projection(pre=pop1, post=pop1, target='exc', name='fb') proj.connect_all_to_all(100.0 / N, allow_self_connections=False) # monitoring obs = Monitor(pop1, variables=['spike', 'v_new'], start=True, period=0.01) # simulation compile() simulate(duration=T) # conversion to pyrates theta = pyrates_from_annarchy(monitors=[obs], vars=['v_new'], pop_average=False) rate = pyrates_from_annarchy(monitors=[obs], vars=['spike'], pop_average=True) plt.plot(theta)
otmV4 = np.ones(params['V4L4_shape'][-1])[:, None, None] AuxA_V4L4A = Convolution(AuxA, V4L4, target='A_SP') AuxA_V4L4A.connect_filters(weights=otmV4) ## Connection from FEF visuo-motoric to V4 L4 (suppressive) # A rectified inverse Gaussian is used as weight #G = Gaussian2D(1.0, [11, 9], [4, 3]) #wSP = np.tile(positive(1 - G**0.125)[None, :, :], params['PFC_shape'] + (1, 1)) G = Gaussian2D(1.0, [40, 40], [4, 4]) wSP = np.tile(positive(1 - G**0.125)[None, :, :], params['PFC_shape'] + (1, 1)) wSP[wSP > 0.188] = 0.188 AuxA_V4L4S = Convolution(AuxA, V4L4, target='S_SP') AuxA_V4L4S.connect_filters(weights=wSP) ## Connection from FEF visuo-motoric to FEF motoric (mean pooling) FEFvm_FEFm = Pooling(FEFvm, FEFm, target='vm', operation='mean') FEFvm_FEFm.connect_pooling(extent=(1, 1, params['FEFvm_shape'][-1])) ## Connection from FEF motoric to FEF visuo-motoric, distributing the activity otmFEF = np.ones(params['FEFvm_shape'][-1])[:, None, None] FEFm_FEFvm = Convolution(FEFm, FEFvm, target='E_m') FEFm_FEFvm.connect_filters(weights=otmFEF) ## Connection from prefrontal Cortex to V4 L2/3 (layerwise amplification) #PFC_V4L23 = Projection(PFC, V4L23, target='A_PFC') #PFC_V4L23.connect_with_func(one_to_dim, postDim=2) ## Connection from FEFfix to FEF motoric FEFfix_FEFm = Projection(FEFfix, FEFm, target='fix', synapse=StandardSynapse) FEFfix_FEFm.connect_all_to_all(1.0)
""" import unittest import numpy from ANNarchy import Izhikevich, Population, Projection, Network pop1 = Population((3, 3), Izhikevich) pop2 = Population((3, 3), Izhikevich) proj = Projection( pre = pop1, post = pop2, target = "exc", ) proj.connect_all_to_all(weights = 0.1, storage_format="csr") # TODO: PopulationViews class test_CSRConnectivity(unittest.TestCase): """ This class tests the functionality of the connectivity patterns within *Projections*. """ @classmethod def setUpClass(self): """ Compile the network for this test """ self.test_net = Network() self.test_net.add([pop1, pop2, proj]) self.test_net.compile(silent=True, debug_build=True, clean=True)
""" import unittest import numpy from ANNarchy import Izhikevich, Population, Projection, Network pop1 = Population((3, 3), Izhikevich) pop2 = Population((3, 3), Izhikevich) proj = Projection( pre=pop1, post=pop2, target="exc", ) proj.connect_all_to_all(weights=0.1, storage_format="csr") # TODO: PopulationViews class test_CSRConnectivity(unittest.TestCase): """ This class tests the functionality of the connectivity patterns within *Projections*. """ @classmethod def setUpClass(self): """ Compile the network for this test """ self.test_net = Network() self.test_net.add([pop1, pop2, proj])