Auryn simulator  v0.8.1-206-gb56e451
Plastic Spiking Neural Network Simulator
Functions
sim_inputchannels.cpp File Reference

Example simulation which records the spiking output of InputChannelGroup. More...

#include "auryn.h"
Include dependency graph for sim_inputchannels.cpp:

Functions

int main (int ac, char *av[])
 

Detailed Description

Example simulation which records the spiking output of InputChannelGroup.

Function Documentation

◆ main()

int main ( int  ac,
char *  av[] 
)
35 {
36 
37  string dir = "./";
38  string file_prefix = "inputchan";
39 
40  NeuronID size = 1000;
41  unsigned int seed = 1;
42  double kappa = 5.;
43  double simtime = 10.;
44 
45  int errcode = 0;
46 
47  try {
48 
49  po::options_description desc("Allowed options");
50  desc.add_options()
51  ("help", "produce help message")
52  ("simtime", po::value<double>(), "simulation time")
53  ("kappa", po::value<double>(), "inputchannels firing rate constant")
54  ("dir", po::value<string>(), "output directory")
55  ("size", po::value<int>(), "input group size")
56  ("seed", po::value<int>(), "random seed")
57  ;
58 
59  po::variables_map vm;
60  po::store(po::parse_command_line(ac, av, desc), vm);
61  po::notify(vm);
62 
63  if (vm.count("help")) {
64  std::cout << desc << "\n";
65  return 1;
66  }
67 
68  if (vm.count("kappa")) {
69  std::cout << "kappa set to "
70  << vm["kappa"].as<double>() << ".\n";
71  kappa = vm["kappa"].as<double>();
72  }
73 
74  if (vm.count("dir")) {
75  std::cout << "dir set to "
76  << vm["dir"].as<string>() << ".\n";
77  dir = vm["dir"].as<string>();
78  }
79 
80  if (vm.count("simtime")) {
81  std::cout << "simtime set to "
82  << vm["simtime"].as<double>() << ".\n";
83  simtime = vm["simtime"].as<double>();
84  }
85 
86  if (vm.count("size")) {
87  std::cout << "size set to "
88  << vm["size"].as<int>() << ".\n";
89  size = vm["size"].as<int>();
90  }
91 
92  if (vm.count("seed")) {
93  std::cout << "seed set to "
94  << vm["seed"].as<int>() << ".\n";
95  seed = vm["seed"].as<int>();
96  }
97  }
98  catch(std::exception& e) {
99  std::cerr << "error: " << e.what() << "\n";
100  return 1;
101  }
102  catch(...) {
103  std::cerr << "Exception of unknown type!\n";
104  }
105 
106  auryn_init(ac, av);
107  sys->set_master_seed(seed);
108 
109  InputChannelGroup * inputs = new InputChannelGroup(size, kappa);
110  SpikeMonitor * smon_e = new SpikeMonitor( inputs, sys->fn("output","ras") );
111 
112  sys->run(simtime,false);
113 
114  logger->msg("Freeing ...",PROGRESS,true);
115  auryn_free();
116  return errcode;
117 }
void auryn_free()
Cleanly shuts down Auryn simulation environment.
Definition: auryn_global.cpp:107
A PoissonGroup with multiple subpopulations that co-modulate their firing rate according to an Ornste...
Definition: InputChannelGroup.h:48
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
The standard Monitor object to record spikes from a SpikingGroup and write them to a text file...
Definition: SpikeMonitor.h:52
System * sys
Global pointer to instance of System which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:37
void set_master_seed(unsigned int seed=123)
Set master seed.
Definition: System.cpp:1014
void auryn_init(int ac, char *av[], string dir, string simulation_name, string logfile_prefix, LogMessageType filelog_level, LogMessageType consolelog_level)
Initalizes MPI and the Auryn simulation environment.
Definition: auryn_global.cpp:84
void msg(std::string text, LogMessageType type=NOTIFICATION, bool global=false, int line=-1, std::string srcfile="")
Definition: Logger.cpp:74
Definition: Logger.h:41
string fn(std::string extension)
Format output file name.
Definition: System.cpp:689
unsigned int NeuronID
NeuronID is an unsigned integeger type used to index neurons in Auryn.
Definition: auryn_definitions.h:151
Here is the call graph for this function: