本文整理汇总了C++中Output::closeSynapticWeightFile方法的典型用法代码示例。如果您正苦于以下问题:C++ Output::closeSynapticWeightFile方法的具体用法?C++ Output::closeSynapticWeightFile怎么用?C++ Output::closeSynapticWeightFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Output
的用法示例。
在下文中一共展示了Output::closeSynapticWeightFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: maass
int maass()
{
/*
зависимость выходной частоты от тока в первом эксперименте
зависимость порога от характера сигнала
зависимость порога от реализации
зависимость частоты выходного сигнала от порога
использовать сигнал кости
*/
srand(time(NULL));
double timeMax = 50.0;
double dt = 0.01;
double dumpPeriod = 10.0;
Node::dt = dt;
std::vector<Node *> generators;
std::vector<Synapse *> synapses1;
std::vector<Synapse *> synapses2;
std::cout<<"Creating neurons..."<<std::endl;
Node node1 = Node("leaky iaf");
node1.I_stim = genran::uniform(14.5, 15.5);
node1.addPsWaveType(PsWave(3.0), "current", 1.0); // exc input
node1.addPsWaveType(PsWave(6.0), "current", -1.0); // inh input
node1.initialiseSpikeBuffer(dt);
Node node2 = Node("leaky iaf");
node2.I_stim = node1.I_stim;
node2.addPsWaveType(PsWave(3.0), "current", 1.0); // exc input
node2.addPsWaveType(PsWave(6.0), "current", -1.0); // inh input
node2.initialiseSpikeBuffer(dt);
std::cout<<"Creating generators..."<<std::endl;
for (int i=0; i < 90; i++){
generators.push_back(new Node("poisson generator"));
Synapse* synapse1 = new Synapse("stdp and tm", &node1, "hard boundaries");
synapse1->setPreset(0); // excitatory constants
synapse1->control(0); // disable stdp and shuffle tm
synapse1->reset();
topology::connectN2N(generators.back(), &node1, synapse1);
synapses1.push_back(synapse1);
Synapse* synapse2 = synapse1->duplicate(&node2); //copy everything
synapse2->control(1); // enable stdp with gamma, don't touch tm
synapse2->reset();
topology::connectN2N(generators.back(), &node2, synapse2);
synapses2.push_back(synapse2);
std::cout<<"\t\t generators created: "<< i << "%\r";
}
for (int i=0; i < 10; i++){
generators.push_back(new Node("poisson generator"));
Synapse* synapse1 = new Synapse("stdp and tm", &node1, "hard boundaries");
synapse1->setPreset(2); // inhibitory constants
synapse1->control(0); // disable stdp and shuffle tm
synapse1->reset();
synapse1->waveType = 1; // inhibitory
topology::connectN2N(generators.back(), &node1, synapse1);
// synapses1.push_back(synapse1);
Synapse* synapse2 = synapse1->duplicate(&node2); //copy everything
topology::connectN2N(generators.back(), &node2, synapse2);
// synapses2.push_back(synapse2);
std::cout<<"\t\t generators created: "<< i+90 << "%\r";
}
std::cout<<std::endl;
std::cout<<"Start output..."<<std::endl;
Output output;
output.openSpikeFile();
output.openSynapticWeightFile("data/target.txt");
output.synapses = synapses1;
output.printSynapticWeights(0.0);
output.closeSynapticWeightFile();
output.openSynapticWeightFile("data/start.txt");
output.synapses = synapses2;
output.printSynapticWeights(0.0);
output.closeSynapticWeightFile();
output.printEssentialData(timeMax);
std::string s;
std::stringbuf dumpTimesBuffer;
std::ostream dumpTimes (&dumpTimesBuffer);
std::cout<<"Starting simulation..."<<std::endl;
for (double t = 0.0; t <= timeMax+dt; t += dt){
for (unsigned i=0; i<generators.size(); i++)
if (generators.at(i)->step(t))
//.........这里部分代码省略.........