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 = 0;
81 string infilename =
"";
83 const char * file_prefix =
"bg_homtriplet";
90 po::options_description desc(
"Allowed options");
92 (
"help",
"produce help message")
93 (
"quiet",
"quiet mode")
94 (
"load", po::value<string>(),
"input weight matrix")
95 (
"wmat",
"wmat dump mode")
96 (
"eta", po::value<double>(),
"learning rate")
97 (
"scaling", po::value<double>(),
"learning rate")
98 (
"tau_hom", po::value<double>(),
"homeostatic time constant")
99 (
"kappa", po::value<double>(),
"target rate")
100 (
"simtime", po::value<double>(),
"simulation time")
101 (
"dir", po::value<string>(),
"output dir")
102 (
"label", po::value<string>(),
"output label")
103 (
"we", po::value<double>(),
"we")
104 (
"strengthen", po::value<int>(),
"connections to strengthen by 10")
105 (
"stimfile", po::value<string>(),
"stimulus ras file")
106 (
"wstim", po::value<double>(),
"weight of stimulus connections")
107 (
"stimtime", po::value<double>(),
"time of stimulus on")
108 (
"adapt",
"adapting excitatory neurons")
109 (
"corr",
"add correlated inputs")
110 (
"stimfreq", po::value<double>(),
"CorrelatedPoissonGroup frequency default = 100")
111 (
"noisyweights",
"enables noisyweights for mean field checks")
112 (
"fast",
"turn off some of the monitors to run faster")
115 po::variables_map vm;
116 po::store(po::parse_command_line(ac, av, desc), vm);
119 if (vm.count(
"help")) {
120 std::cout << desc <<
"\n";
124 if (vm.count(
"quiet")) {
128 if (vm.count(
"load")) {
129 std::cout <<
"load from matrix " 130 << vm[
"load"].as<
string>() <<
".\n";
131 infilename = vm[
"load"].as<
string>();
134 if (vm.count(
"wmat")) {
136 std::cout <<
"wmat dump mode" << std::endl;
139 if (vm.count(
"eta")) {
140 std::cout <<
"eta set to " 141 << vm[
"eta"].as<
double>() <<
".\n";
142 eta = vm[
"eta"].as<
double>();
145 if (vm.count(
"scaling")) {
146 std::cout <<
"scaling set to " 147 << vm[
"scaling"].as<
double>() <<
".\n";
148 beta_scaling = vm[
"scaling"].as<
double>();
151 if (vm.count(
"tau_hom")) {
152 std::cout <<
"tau_hom set to " 153 << vm[
"tau_hom"].as<
double>() <<
".\n";
154 tau_hom = vm[
"tau_hom"].as<
double>();
157 if (vm.count(
"kappa")) {
158 std::cout <<
"kappa set to " 159 << vm[
"kappa"].as<
double>() <<
".\n";
160 kappa = vm[
"kappa"].as<
double>();
163 if (vm.count(
"simtime")) {
164 std::cout <<
"simtime set to " 165 << vm[
"simtime"].as<
double>() <<
".\n";
166 simtime = vm[
"simtime"].as<
double>();
170 if (vm.count(
"corr")) {
171 std::cout <<
"enabling corr " << std::endl;
175 if (vm.count(
"stimfreq")) {
176 std::cout <<
"stimfreq set to " 177 << vm[
"stimfreq"].as<
double>() <<
".\n";
178 stimfreq = vm[
"stimfreq"].as<
double>();
181 if (vm.count(
"dir")) {
182 std::cout <<
"dir set to " 183 << vm[
"dir"].as<
string>() <<
".\n";
184 dir = vm[
"dir"].as<
string>();
187 if (vm.count(
"label")) {
188 std::cout <<
"label set to " 189 << vm[
"label"].as<
string>() <<
".\n";
190 label = vm[
"label"].as<
string>();
193 if (vm.count(
"we")) {
194 std::cout <<
"we set to " 195 << vm[
"we"].as<
double>() <<
".\n";
196 w_ee = vm[
"we"].as<
double>();
199 if (vm.count(
"strengthen")) {
200 std::cout <<
"strengthen set to " 201 << vm[
"strengthen"].as<
int>() <<
".\n";
202 n_strengthen = vm[
"strengthen"].as<
int>();
205 if (vm.count(
"stimfile")) {
206 std::cout <<
"stimfile set to " 207 << vm[
"stimfile"].as<
string>() <<
".\n";
208 stimfile = vm[
"stimfile"].as<
string>();
211 if (vm.count(
"wstim")) {
212 std::cout <<
"wstim set to " 213 << vm[
"wstim"].as<
double>() <<
".\n";
214 wstim = vm[
"wstim"].as<
double>();
217 if (vm.count(
"stimtime")) {
218 std::cout <<
"stimtime set to " 219 << vm[
"stimtime"].as<
double>() <<
".\n";
220 stimtime = vm[
"stimtime"].as<
double>();
223 if (vm.count(
"adapt")) {
224 std::cout <<
"adaptation on " << std::endl;
228 if (vm.count(
"noisyweights")) {
229 std::cout <<
"noisyweights on " << std::endl;
233 if (vm.count(
"fast")) {
234 std::cout <<
"fast on " << std::endl;
238 catch(std::exception& e) {
239 std::cerr <<
"error: " << e.what() <<
"\n";
243 std::cerr <<
"Exception of unknown type!\n";
248 double primetime = 3.0*tau_hom;
253 if (!infilename.empty()) {
254 std::stringstream iss;
256 infilename = iss.str();
266 neurons_e =
new IFGroup(20000);
281 msg =
"Setting up I connections ...";
284 w_ie,sparseness,
GABA);
286 w_ii,sparseness,
GABA);
288 msg =
"Setting up E connections ...";
291 w_ei, sparseness,
GLUT);
296 w_ee, sparseness,tau_hom,eta,kappa,wmax,
GLUT);
299 for (
int i = 0 ; i < n_strengthen ; ++i ) {
300 con_ee->
set_data(i,i*(wmax/n_strengthen));
307 msg =
"Setting up monitors ...";
311 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());
316 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');
319 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');
323 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());
325 wmon->add_equally_spaced(20);
333 if (!stimfile.empty()) {
334 msg =
"Setting up stimulus ...";
338 con_stim->
set_name(
"Stimulus Connection");
339 con_stim->allocate_manually(4*500*100*sparseness);
340 con_stim->connect_block_random(wstim, sparseness, 0, 500, 0, 100);
341 con_stim->connect_block_random(wstim, sparseness, 500, 1000, 100, 200);
342 con_stim->connect_block_random(wstim, sparseness, 1000, 1500, 200, 300);
343 con_stim->connect_block_random(wstim, sparseness, 1500, 2000, 300, 400);
344 con_stim->finalize();
347 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());
357 std::stringstream oss;
358 oss <<
" Activating correlated input ... ";
362 const double ampl = 5.0;
371 for (
int i = 0 ; i < ngroups ; ++i ) {
372 con_corr_e->
set_block( i*psize, (i+1)*psize, i*psize, (i+1)*psize, w_ext );
373 con_exte->
set_block( i*psize, (i+1)*psize, i*psize, (i+1)*psize, 1e-3 );
376 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());
378 wmonc->add_equally_spaced(20);
385 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');
388 msg =
"Initializing traces ...";
401 sys->run(primetime,
true);
411 if (!
sys->run(simtime,
true))
417 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());
419 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());
423 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());
426 sprintf(strbuf,
"%s/%s_e%.2et%.2f%s.%d.c.wmat", dir.c_str(), file_prefix, beta_scaling, tau_hom, label.c_str(),
sys->
mpi_rank());
429 sprintf(strbuf,
"%s/%s_e%.2et%.2f%s.%d.in.wmat", dir.c_str(), file_prefix, beta_scaling, tau_hom, label.c_str(),
sys->
mpi_rank());
433 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());
434 std::ofstream killfile;
435 killfile.open(strbuf);
436 killfile <<
sys->
get_time()-primetime << std::endl;
void set_hom_trace(AurynFloat freq)
Definition: TripletConnection.cpp:127
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
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
bool stdp_active
Toggles stdp active/inactive. When inactive traces are still updated, but weights are not...
Definition: TripletConnection.h:153
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
Implements triplet STDP with metaplasticity as described by Pfister and Gerstner 2006.
Definition: TripletConnection.h:48
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 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
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
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