示例#1
0
//! trigger all UserErrors
// TODO: add more error checking
TEST(Interface, connectDeath) {
	::testing::FLAGS_gtest_death_test_style = "threadsafe";

	CARLsim* sim = new CARLsim("Interface.connectDeath",CPU_MODE,SILENT,1,42);
	int g1=sim->createSpikeGeneratorGroup("excit", 10, EXCITATORY_NEURON);
	int g2=sim->createGroup("excit", Grid3D(2,3,4), EXCITATORY_NEURON);
	sim->setNeuronParameters(g2, 0.02f, 0.2f,-65.0f,8.0f);

	// regular connect call
	EXPECT_DEATH(sim->connect(g1,g1,"random",RangeWeight(0.1f),0.1f),""); // g-post cannot be PoissonGroup
	EXPECT_DEATH(sim->connect(g1,g2,"random",RangeWeight(-0.01f),0.1f),""); // weight cannot be negative
	EXPECT_DEATH(sim->connect(g1,g2,"random",RangeWeight(0.01f,0.1f,0.1f),0.1f),""); // wt.min>0
	EXPECT_DEATH(sim->connect(g1,g2,"random",RangeWeight(0.0f,0.01f,0.1f),0.1f),""); // SYN_FIXED wt.init!=wt.max
	EXPECT_DEATH(sim->connect(g1,g2,"random",RangeWeight(0.0f,0.01f,0.1f),-0.1f),""); // prob<0
	EXPECT_DEATH(sim->connect(g1,g2,"random",RangeWeight(0.0f,0.01f,0.1f),2.3f),""); // prob>1
	EXPECT_DEATH(sim->connect(g1,g2,"one-to-one",RangeWeight(0.1f),0.1f,RangeDelay(1),RadiusRF(3,0,0)),""); // rad>0
	EXPECT_DEATH(sim->connect(g1,g2,"random",RangeWeight(0.1f),0.1f,RangeDelay(1),RadiusRF(-1),SYN_FIXED,-1.0f,0.0f),""); // mulSynFast<0
	EXPECT_DEATH(sim->connect(g1,g2,"random",RangeWeight(0.1f),0.1f,RangeDelay(1),RadiusRF(-1),SYN_FIXED,0.0f,-1.0f),""); // mulSynSlow<0

	// custom ConnectionGenerator
	ConnectionGenerator* CGNULL = NULL;
	DummyCG* CG = new DummyCG;
	EXPECT_DEATH({sim->connect(g1,g2,CGNULL);},""); // CG=NULL
示例#2
0
	void MCNeuronSim::setupGroups(){
		//int poissonGroup[scenCount];
			/*
			 * (A) first setup groups for somatic scenarios! - connect compartments for MC!
			 */
			float G_up, G_dn;
			for(int k = 0; k < scenCount; k++)
			{
				//std::string poissonGroupName = "poisson_" + patch::to_string(k);
				//poissonGroup[k] = network->createSpikeGeneratorGroup(poissonGroupName, popSize_neuronCount, EXCITATORY_NEURON);
				for(int c=0; c<compCount; c++)
				{
					std::string excGroupName = "exc_" + patch::to_string(k) + patch::to_string(c);
					excGroup[k][c] = network->createGroup(excGroupName, popSize_neuronCount, EXCITATORY_NEURON);
					network->setNeuronParameters(excGroup[k][c], 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f);
			//		network->setExternalCurrent(excGroup[k][c], 0);
					if(compCount>1){
						G_up = 0;
						G_dn = 0;
						network->setCompartmentParameters(excGroup[k][c], G_up, G_dn);
					}
					excMonitor[k][c] = network->setSpikeMonitor(excGroup[k][c], "/dev/null");

					if(c>0){//connect compartments based on layout
						if(compCount>2 && c==1 && connLayout[c]==connLayout[c+1]){ //meaning 2 dendrites (dend 1 and dend2 ) connecting to the same point
							network->connectCompartments(excGroup[k][c], excGroup[k][connLayout[c]]);
						}else{
							network->connectCompartments(excGroup[k][connLayout[c]], excGroup[k][c]);
						}
					}
				}

				//????????????
				//network->connect(poissonGroup[k], excGroup[k][0],"random", RangeWeight(0.0f), 0.5f, RangeDelay(1));
				//????????????
			}
			/*
			 * (B) secondly, setup groups for MC scenarios! - connect compartments depending on scenarios as below
			 *  - 1. rheo group : decoupled
			 *  - 2. IR: decoupled
			 *  - 3. spike prop: Coupled
			 *  - 4. syn ampl: Coupled
			 */
			for(int k = scenCount; k < scenCount+mcScenCount; k++)
				{
				for(int c=0; c<compCount; c++)
					{
						std::string excGroupName = "mcc_exc_" + patch::to_string(k) + patch::to_string(c);
						excGroup[k][c] = network->createGroup(excGroupName, popSize_neuronCount, EXCITATORY_NEURON);
						network->setNeuronParameters(excGroup[k][c], 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f);
						if(k>=scenCount+2){// coupled scenarios for mcc
							G_up = 0;
							G_dn = 0;
							network->setCompartmentParameters(excGroup[k][c], G_up, G_dn);
						}

						excMonitor[k][c] = network->setSpikeMonitor(excGroup[k][c], "/dev/null");

						if(k>=scenCount+2){
							if(c>0){//connect compartments based on layout
								if(compCount>2 && c==1 && connLayout[c]==connLayout[c+1]){ //meaning 2 dendrites (dend 1 and dend2 ) connecting to the same point
									network->connectCompartments(excGroup[k][c], excGroup[k][connLayout[c]]);
								}else{
									network->connectCompartments(excGroup[k][connLayout[c]], excGroup[k][c]);
								}
							}
						}
					}
				}
			//single neuron single compartment for EPSP stimulation
			for(int pssg=0;  pssg<nPreSynSpikerGroups;pssg++){
				excGroup[scenCount+mcScenCount][pssg] = network->createGroup("spiker_"+patch::to_string(pssg), 1, EXCITATORY_NEURON);
				network->setNeuronParameters(excGroup[scenCount+mcScenCount][pssg], 121.0f, 0.5343182f,-61.20764f,-40.00114f,
									0.0336908f, 6.5490165f, 35.965454f,-41.31163f, 7.0f);
			}

			float connProb=0.3f;
			if(writeAllVs){
				connProb=1.0f;
			}
			const int epspGrpRowStartIdx = scenCount + 2+ (compCount-1);
			float _weight = 1.0f;
			for(int kc=0; kc<(compCount-1); kc++){
				/*
				 * new addition for CA1 pyramidal dendrites analysis
				 */
				if(compCount==4 && kc==0)
					_weight = 1.0f;
				if(compCount==4 && kc==1)
					_weight = 1.0f/3.0f;//1.0f/6.0f;
				if(compCount==4 && kc==2)
					_weight = 2.5f*(1.0f/3.0f); //3.0f*(1.0f/3.0f);


				/*if(compCount==4 && kc==2)
					_weight = 1.0f;
					*/
				/*
				 * new addition ends
				 */


				for(int pssg=0;  pssg<nPreSynSpikerGroups;pssg++){
					network->connect(excGroup[scenCount+mcScenCount][pssg], excGroup[epspGrpRowStartIdx + kc][kc+1],
											"random", RangeWeight(_weight), connProb,
											RangeDelay(1),  RadiusRF(-1), SYN_FIXED, 1.0f, 0.0f);
				}
			}

			//multi neuron single compartment spikers for new spike prop implementation via synaptic stimulation
			for(int pssg=nPreSynSpikerGroups;  pssg<nPreSynSpikerGroups*2;pssg++){
				//excGroup[scenCount+mcScenCount][pssg] = network->createGroup("spiker_"+ patch::to_string(pssg), 16, EXCITATORY_NEURON);
				excGroup[scenCount+mcScenCount][pssg] = network->createGroup("spiker_"+ patch::to_string(pssg), 85, EXCITATORY_NEURON);

				network->setNeuronParameters(excGroup[scenCount+mcScenCount][pssg], 121.0f, 0.5343182f,-61.20764f,-40.00114f,
									0.0336908f, 6.5490165f, 35.965454f,-41.31163f, 7.0f);
			}

			const int propRateGrpRowStartIdx = scenCount + 2;

			//_weight =33.0f;
			_weight =2.0f;
			for(int kc=0; kc<(compCount-1); kc++){
				//if(kc+1>1)
				//	_weight = 10.0f;
					if(compCount==4 && kc==0)
						_weight = 1.0f;
					if(compCount==4 && kc==1)
						_weight = 1.0f;	//_weight = 0;			//0, cuz this is not a check for prop in SR. By setting this weight 0, SR only has the I(=700?, {see determine prop rate function})- this is a baseline to test conditional spike propagation
					if(compCount==4 && kc==2)
						_weight = 2.0f;

				for(int pssg=nPreSynSpikerGroups;  pssg<nPreSynSpikerGroups*2;pssg++){
					network->connect(excGroup[scenCount+mcScenCount][pssg], excGroup[propRateGrpRowStartIdx + kc][kc+1],
																"random", RangeWeight(_weight), connProb,
																RangeDelay(1,10),  RadiusRF(-1), SYN_FIXED, 1.0f, 0.0f );
				}
			}

			if(customI==1){
				std::cout<<"pre - in";
				custom_grp_in=network->createSpikeGeneratorGroup("custom_input_0", 1, EXCITATORY_NEURON);
				std::vector<int> spkTimes = {150, 250, 400, 600};
				SpikeGeneratorFromVector SGV(spkTimes);
				network->setSpikeGenerator(custom_grp_in, &SGV);

				int compartment_to_stimulate = 1;
				//create poisson group!
				network->connect(custom_grp_in, excGroup[0][compartment_to_stimulate], "full", RangeWeight(10), 1, RangeDelay(1),RadiusRF(-1),SYN_FIXED);

				std::cout<<"custom_input EXIT ";							//
			}


			//
			/*
			 *  (C) Now, setup network!
			 */
			network->setConductances(true);
			network->setIntegrationMethod(RUNGE_KUTTA4, time_step);
			network->setupNetwork();
		}