-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Friedemann Zenke
committed
Jul 20, 2016
1 parent
ab4b36b
commit c39f3c2
Showing
1 changed file
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/* | ||
* Copyright 2014-2016 Friedemann Zenke | ||
* | ||
* This file is part of Auryn, a simulation package for plastic | ||
* spiking neural networks. | ||
* | ||
* Auryn is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Auryn is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Auryn. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "auryn.h" | ||
|
||
#define N 1 | ||
|
||
/*!\file | ||
* | ||
* \brief Simulates multiple step currents of increasing amplitude to a neuron | ||
* */ | ||
|
||
using namespace auryn; | ||
|
||
namespace po = boost::program_options; | ||
namespace mpi = boost::mpi; | ||
|
||
int main(int ac, char* av[]) | ||
{ | ||
|
||
int errcode = 0; | ||
char strbuf [255]; | ||
string simname = "current_steps"; | ||
string tmpstr; | ||
AurynWeight w = 1.0; | ||
|
||
// BEGIN Global definitions | ||
mpi::environment env(ac, av); | ||
mpi::communicator world; | ||
communicator = &world; | ||
|
||
try | ||
{ | ||
sprintf(strbuf, "current_steps.%d.log", world.rank()); | ||
string logfile = strbuf; | ||
logger = new Logger(logfile,world.rank(),PROGRESS,EVERYTHING); | ||
} | ||
catch ( AurynOpenFileException excpt ) | ||
{ | ||
std::cerr << "Cannot proceed without log file. Exiting all ranks ..." << '\n'; | ||
env.abort(1); | ||
} | ||
|
||
sys = new System(&world); | ||
sys->set_simulation_name(simname); | ||
// END Global definitions | ||
|
||
// define neuron group | ||
IzhikevichGroup * neuron = new IzhikevichGroup(1); | ||
|
||
// define current input | ||
CurrentInjector * curinject = new CurrentInjector(neuron, "mem"); | ||
|
||
// define monitors | ||
SpikeMonitor * smon = new SpikeMonitor( neuron, sys->fn("ras") ); | ||
StateMonitor * vmon = new StateMonitor( neuron, 0, "mem", sys->fn("mem") ); | ||
|
||
// run simulation | ||
logger->msg("Running ...",PROGRESS); | ||
|
||
const double simtime = 0.2; | ||
// simulate | ||
sys->run(simtime); | ||
|
||
// simulate current steps of increasing size | ||
for ( int i = 0 ; i < 10 ; ++i ) { | ||
// turn current on | ||
curinject->set_current(0,1.0*i); // current is in arbitrary units | ||
|
||
// simulate | ||
sys->run(simtime); | ||
|
||
// turn current off | ||
curinject->set_current(0,0.0); | ||
|
||
// simulate | ||
sys->run(simtime); | ||
} | ||
|
||
// clean up | ||
logger->msg("Freeing ...",PROGRESS,true); | ||
delete sys; | ||
|
||
if (errcode) | ||
env.abort(errcode); | ||
return errcode; | ||
} |