come compilare: g++ prova.cpp -lboost_system -liSpike -lnemo -lnemo_base -L /usr/local/lib #include #include #include #include #include // solo per nemo #include #include #include #include #include #include #include int main() { ispike::FileAngleReader* far = new ispike::FileAngleReader(); map farp = far->getProperties(); farp.at("File Name") = ispike::Property("prova.txt", "File Name", "description", true); far->initialize(farp); ispike::JointInputChannel* jc = new ispike::JointInputChannel(); map jcp = jc->getProperties(); //jcp.at("minAngle") = ispike::Property(ispike::Property::Double, -90.0, "Minimum Angle", "The minimum angle to read",true); jc->initialize(far, jcp); //Se non diversamente specificato, iSpike genera impulsi per una rete il cui input รจ composto // da una sezione di 10x1 neuroni /* * addProperty(Property(Property::Integer, 0, DEGREE_OF_FREEDOM_NAME, "The degree of freedom to read from this joint", false)); addProperty(Property(Property::Double, 0.5, STANDARD_DEVIATION_NAME, "The standard deviation as a percentage of neurons covered", true)); addProperty(Property(Property::Double, -90.0, MIN_ANGLE_NAME, "The minimum angle to read", true)); addProperty(Property(Property::Double, 90.0, MAX_ANGLE_NAME, "The maximum angle to read", true)); addProperty(Property(Property::Integer, 10, NEURON_WIDTH_NAME, "Width of the neuron network", true)); addProperty(Property(Property::Integer, 1, NEURON_HEIGHT_NAME, "Height of the neuron network", true)); addProperty(Property(Property::Double, 0.1, PARAM_A_NAME, "Parameter A of the Izhikevich Neuron Model", false)); addProperty(Property(Property::Double, 0.2, PARAM_B_NAME, "Parameter B of the Izhikevich Neuron Model", false)); addProperty(Property(Property::Double, -65.0, PARAM_C_NAME, "Parameter C of the Izhikevich Neuron Model", false)); addProperty(Property(Property::Double, 2.0, PARAM_D_NAME, "Parameter D of the Izhikevich Neuron Model", false)); addProperty(Property(Property::Double, 40.0, PEAK_CURRENT_NAME, "Maximum current that will be injected into neuron", true)); addProperty(Property(Property::Double, 0.0, CONSTANT_CURRENT_NAME, "This value is added to the incoming current", false)); * * * */ /*--------- inizio config. nemo -----------*/ //Promemoria: la rete di nemo deve avere tanti neuroni di input quanti ne ho //deciso anche su ispike, quindi sono 10, se non diversam. specificato /*---------- fine config. nemo -----------*/ /*--------- inizio simulazione -----------*/ // promemoria: la simulaz. ispike e la simulaz. nemo devono essere rese sincrone. for (unsigned ms=0; ms<10; ms++) { jc->step(); //avanza simulazione canale const vector& spiked = jc->getFiring(); // restituisce impulsi prodotti nella riga precedente /* posso vedere il contenuto di questo vector con un for*/ for(std::vector::const_iterator fi = spiked.begin(); fi != spiked.end(); ++fi) std::cout << "ispike: "<< ms << " ms " << *fi << "\n"; // ad ogni passo stampa id neuroni che hanno pulsato //poi passare questi impulsi al simulatore NeMo per simulazione nemo: } return 0; } output in caso di angolo di 89 gradi (mancano degli step?????) ispike: 1 ms 9 ispike: 3 ms 9 ispike: 5 ms 8 ispike: 5 ms 9 ispike: 7 ms 9 ispike: 9 ms 9