55 double sparseness = 0.05;
59 bool wmatdump =
false;
60 double simtime = 3600.;
61 double stimtime = simtime;
62 double wmat_interval = 600.;
69 bool noisyweights =
false;
74 double beta_scaling = 3600;
81 string infilename =
"";
83 const char * file_prefix =
"bg_scaling";
91 po::options_description desc(
"Allowed options");
93 (
"help",
"produce help message")
94 (
"quiet",
"quiet mode")
95 (
"load", po::value<string>(),
"input weight matrix")
96 (
"wmat",
"wmat dump mode")
97 (
"eta", po::value<double>(),
"learning rate")
98 (
"scaling", po::value<double>(),
"learning rate")
99 (
"tau_hom", po::value<double>(),
"homeostatic time constant")
100 (
"kappa", po::value<double>(),
"target rate")
101 (
"simtime", po::value<double>(),
"simulation time")
102 (
"dir", po::value<string>(),
"output dir")
103 (
"label", po::value<string>(),
"output label")
104 (
"we", po::value<double>(),
"we")
105 (
"strengthen", po::value<int>(),
"connections to strengthen by 10")
106 (
"stimfile", po::value<string>(),
"stimulus ras file")
107 (
"wstim", po::value<double>(),
"weight of stimulus connections")
108 (
"stimtime", po::value<double>(),
"time of stimulus on")
109 (
"adapt",
"adapting excitatory neurons")
110 (
"corr",
"add correlated inputs")
111 (
"stimfreq", po::value<double>(),
"CorrelatedPoissonGroup frequency default = 100")
112 (
"noisyweights",
"enables noisyweights for mean field checks")
113 (
"fast",
"turn off some of the monitors to run faster")
116 po::variables_map vm;
117 po::store(po::parse_command_line(ac, av, desc), vm);
120 if (vm.count(
"help")) {
121 std::cout << desc <<
"\n";
125 if (vm.count(
"quiet")) {
129 if (vm.count(
"load")) {
130 std::cout <<
"load from matrix " 131 << vm[
"load"].as<
string>() <<
".\n";
132 infilename = vm[
"load"].as<
string>();
135 if (vm.count(
"wmat")) {
137 std::cout <<
"wmat dump mode" << std::endl;
140 if (vm.count(
"eta")) {
141 std::cout <<
"eta set to " 142 << vm[
"eta"].as<
double>() <<
".\n";
143 eta = vm[
"eta"].as<
double>();
146 if (vm.count(
"scaling")) {
147 std::cout <<
"scaling set to " 148 << vm[
"scaling"].as<
double>() <<
".\n";
149 beta_scaling = vm[
"scaling"].as<
double>();
152 if (vm.count(
"tau_hom")) {
153 std::cout <<
"tau_hom set to " 154 << vm[
"tau_hom"].as<
double>() <<
".\n";
155 tau_hom = vm[
"tau_hom"].as<
double>();
158 if (vm.count(
"kappa")) {
159 std::cout <<
"kappa set to " 160 << vm[
"kappa"].as<
double>() <<
".\n";
161 kappa = vm[
"kappa"].as<
double>();
164 if (vm.count(
"simtime")) {
165 std::cout <<
"simtime set to " 166 << vm[
"simtime"].as<
double>() <<
".\n";
167 simtime = vm[
"simtime"].as<
double>();
171 if (vm.count(
"corr")) {
172 std::cout <<
"enabling corr " << std::endl;
176 if (vm.count(
"stimfreq")) {
177 std::cout <<
"stimfreq set to " 178 << vm[
"stimfreq"].as<
double>() <<
".\n";
179 stimfreq = vm[
"stimfreq"].as<
double>();
182 if (vm.count(
"dir")) {
183 std::cout <<
"dir set to " 184 << vm[
"dir"].as<
string>() <<
".\n";
185 dir = vm[
"dir"].as<
string>();
188 if (vm.count(
"label")) {
189 std::cout <<
"label set to " 190 << vm[
"label"].as<
string>() <<
".\n";
191 label = vm[
"label"].as<
string>();
194 if (vm.count(
"we")) {
195 std::cout <<
"we set to " 196 << vm[
"we"].as<
double>() <<
".\n";
197 w_ee = vm[
"we"].as<
double>();
200 if (vm.count(
"strengthen")) {
201 std::cout <<
"strengthen set to " 202 << vm[
"strengthen"].as<
int>() <<
".\n";
203 n_strengthen = vm[
"strengthen"].as<
int>();
206 if (vm.count(
"stimfile")) {
207 std::cout <<
"stimfile set to " 208 << vm[
"stimfile"].as<
string>() <<
".\n";
209 stimfile = vm[
"stimfile"].as<
string>();
212 if (vm.count(
"wstim")) {
213 std::cout <<
"wstim set to " 214 << vm[
"wstim"].as<
double>() <<
".\n";
215 wstim = vm[
"wstim"].as<
double>();
218 if (vm.count(
"stimtime")) {
219 std::cout <<
"stimtime set to " 220 << vm[
"stimtime"].as<
double>() <<
".\n";
221 stimtime = vm[
"stimtime"].as<
double>();
224 if (vm.count(
"adapt")) {
225 std::cout <<
"adaptation on " << std::endl;
229 if (vm.count(
"noisyweights")) {
230 std::cout <<
"noisyweights on " << std::endl;
234 if (vm.count(
"fast")) {
235 std::cout <<
"fast on " << std::endl;
239 catch(std::exception& e) {
240 std::cerr <<
"error: " << e.what() <<
"\n";
244 std::cerr <<
"Exception of unknown type!\n";
249 double primetime = 3.0*tau_hom;
254 if (!infilename.empty()) {
255 std::stringstream iss;
257 infilename = iss.str();
267 neurons_e =
new IFGroup(20000);
282 msg =
"Setting up I connections ...";
285 w_ie,sparseness,
GABA);
287 w_ii,sparseness,
GABA);
289 msg =
"Setting up E connections ...";
292 w_ei, sparseness,
GLUT);
297 w_ee, sparseness, tau_hom, eta, kappa, beta_scaling, wmax,
GLUT);
300 for (
int i = 0 ; i < n_strengthen ; ++i ) {
301 con_ee->
set_data(i,i*(wmax/n_strengthen));
304 msg =
"Initializing traces ...";
311 msg =
"Setting up monitors ...";
315 sprintf(strbuf,
"%s/%s_e%.2et%.2f%s.%d.weight", dir.c_str(), file_prefix, beta_scaling, tau_hom, label.c_str(),
sys->
mpi_rank());
320 sprintf(strbuf,
"%s/%s_e%.2et%.2f%s.%d.%c.spk", dir.c_str(), file_prefix, beta_scaling, tau_hom, label.c_str(),
sys->
mpi_rank(),
'e');
323 sprintf(strbuf,
"%s/%s_e%.2et%.2f%s.%d.%c.prate", dir.c_str(), file_prefix, beta_scaling, tau_hom, label.c_str(),
sys->
mpi_rank(),
'e');
327 sprintf(strbuf,
"%s/%s_e%.2et%.2f%s.%d.syn", dir.c_str(), file_prefix, beta_scaling, tau_hom, label.c_str(),
sys->
mpi_rank());
329 wmon->add_equally_spaced(20);
337 if (!stimfile.empty()) {
338 msg =
"Setting up stimulus ...";
342 con_stim->
set_name(
"Stimulus Connection");
343 con_stim->allocate_manually(4*500*100*sparseness);
344 con_stim->connect_block_random(wstim, sparseness, 0, 500, 0, 100);
345 con_stim->connect_block_random(wstim, sparseness, 500, 1000, 100, 200);
346 con_stim->connect_block_random(wstim, sparseness, 1000, 1500, 200, 300);
347 con_stim->connect_block_random(wstim, sparseness, 1500, 2000, 300, 400);
348 con_stim->finalize();
351 sprintf(strbuf,
"%s/%s_e%.2et%.2f%s.%d_stim.wmat", dir.c_str(), file_prefix, beta_scaling, tau_hom, label.c_str(),
sys->
mpi_rank());
361 std::stringstream oss;
362 oss <<
" Activating correlated input ... ";
366 const double ampl = 5.0;
375 for (
int i = 0 ; i < ngroups ; ++i ) {
376 con_corr_e->
set_block( i*psize, (i+1)*psize, i*psize, (i+1)*psize, w_ext );
377 con_exte->
set_block( i*psize, (i+1)*psize, i*psize, (i+1)*psize, 1e-3 );
381 sprintf(strbuf,
"%s/%s_e%.2et%.2f%s.%d.c.syn", dir.c_str(), file_prefix, beta_scaling, tau_hom, label.c_str(),
sys->
mpi_rank());
383 wmonc->add_equally_spaced(20);
390 sprintf(strbuf,
"%s/%s_e%.2et%.2f%s.%d.%c.spk", dir.c_str(), file_prefix, beta_scaling, tau_hom, label.c_str(),
sys->
mpi_rank(),
'c');
401 sys->run(primetime,
true);
414 if (!
sys->run(simtime,
true))
420 sprintf(strbuf,
"%s/%s_e%.2et%.2f%s.%d.e.nstate", dir.c_str(), file_prefix, beta_scaling, tau_hom, label.c_str(),
sys->
mpi_rank());
422 sprintf(strbuf,
"%s/%s_e%.2et%.2f%s.%d.i.nstate", dir.c_str(), file_prefix, beta_scaling, tau_hom, label.c_str(),
sys->
mpi_rank());
426 sprintf(strbuf,
"%s/%s_e%.2et%.2f%s.%d.wmat", dir.c_str(), file_prefix, beta_scaling, tau_hom, label.c_str(),
sys->
mpi_rank());
430 sprintf(strbuf,
"%s/%s_e%.2et%.2f%s.%d.lifetime", dir.c_str(), file_prefix, beta_scaling, tau_hom, label.c_str(),
sys->
mpi_rank());
431 std::ofstream killfile;
432 killfile.open(strbuf);
433 killfile <<
sys->
get_time()-primetime << std::endl;
void auryn_free()
Cleanly shuts down Auryn simulation environment.
Definition: auryn_global.cpp:107
void set_block(NeuronID lo_row, NeuronID hi_row, NeuronID lo_col, NeuronID hi_col, AurynWeight weight)
Sets all weights of existing connections in a block spanned by the first 4 parameters to the value gi...
Definition: SparseConnection.cpp:307
Standard Glutamatergic (excitatory) transmission.
Definition: auryn_definitions.h:139
The standard Monitor object to record spikes from a SpikingGroup and write them to a binary file...
Definition: BinarySpikeMonitor.h:48
virtual void set_data(NeuronID i, AurynWeight value)
Sets weight value of a given element referenced by its index in the data array.
Definition: SparseConnection.cpp:661
void random_mem(AurynState mean=-60e-3, AurynState sigma=5e-3)
Definition: NeuronGroup.cpp:81
unsigned int mpi_rank()
Returns current rank.
Definition: System.cpp:1009
bool stdp_active
Definition: TripletScalingConnection.h:84
Abstract base class of all objects producing spikes.
Definition: SpikingGroup.h:67
A Checker class that tracks population firing rate as a moving average and breaks a run if it goes ou...
Definition: RateChecker.h:59
The base class to create sparse random connections.
Definition: SparseConnection.h:66
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
void set_tau_mem(AurynFloat taum)
Sets the membrane time constant.
Definition: IFGroup.cpp:154
Saves the weight matrix of a given connection in regular time intervals.
Definition: WeightMatrixMonitor.h:41
virtual void set_all(AurynWeight weight)
Sets all weights of existing connections to the given value.
Definition: SparseConnection.cpp:335
void auryn_abort(int errcode)
Terminates Auryn simulation abnormally.
Definition: auryn_global.cpp:113
void random_data(AurynWeight mean, AurynWeight sigma)
Synonym for random_data.
Definition: SparseConnection.cpp:208
System * sys
Global pointer to instance of System which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:37
A SpikingGroup that creates poissonian spikes with a given rate.
Definition: PoissonGroup.h:52
A simple extension of IFGroup with spike triggered adaptation.
Definition: AIFGroup.h:37
AurynDouble get_time()
Gets the current system time in [s].
Definition: System.cpp:226
void set_hom_trace(AurynFloat freq)
Definition: TripletScalingConnection.cpp:123
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 set_beta(AurynFloat beta)
Definition: TripletScalingConnection.cpp:254
Standard Gabaergic (inhibitory) transmission.
Definition: auryn_definitions.h:140
void msg(std::string text, LogMessageType type=NOTIFICATION, bool global=false, int line=-1, std::string srcfile="")
Definition: Logger.cpp:74
Definition: TripletScalingConnection.h:33
Abstract base class for all neuron groups.
Definition: NeuronGroup.h:45
void set_name(std::string s)
Set connection name.
Definition: SpikingGroup.cpp:507
bool write_to_file(ForwardMatrix *m, string filename)
Writes rank specific weight matrix on the same rank to a file.
Definition: SparseConnection.cpp:690
Monitor class to record population firing rates.
Definition: PopulationRateMonitor.h:46
virtual bool write_to_file(const char *filename)
Writes current states of SpikingGroup to human-readible textfile if implemented in derived class...
Definition: SpikingGroup.cpp:549
Monitors the evolution of a single or a set of weights.
Definition: WeightMonitor.h:65
unsigned int NeuronID
NeuronID is an unsigned integeger type used to index neurons in Auryn.
Definition: auryn_definitions.h:151
Implements the standard integrate and file model used in Auryn.
Definition: IFGroup.h:47