examples:sim_isp_orig
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
| — | examples:sim_isp_orig [2014/01/20 10:19] (current) – created zenke | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== sim_isp_orig ====== | ||
| + | |||
| + | This simulation is the adapted from the network used to generate Figure 4 in [1]. It simulates a balanced network of 10,000 sparsely connected integrate-and-fire neurons[2] and features | ||
| + | plastic inhibitory-exciatory synapses. | ||
| + | |||
| + | {{: | ||
| + | |||
| + | [1] Vogels, T.P., Abbott, L.F., 2005. Signal propagation and logic gating in networks of integrate-and-fire neurons. J Neurosci 25, 10786. | ||
| + | [[http:// | ||
| + | |||
| + | [2] Vogels, T.P., Sprekeler, H., Zenke, F., Clopath, C., Gerstner, W., 2011. Inhibitory Plasticity Balances Excitation and Inhibition in Sensory Pathways and Memory Networks. Science 334, 1569 –1573. | ||
| + | [[http:// | ||
| + | |||
| + | ===== Running the program ===== | ||
| + | |||
| + | To run the program after [[manual: | ||
| + | <code shell> | ||
| + | ./ | ||
| + | </ | ||
| + | this will trigger a 1000s simulation which creates the following output files | ||
| + | <code shell> | ||
| + | 4 -rw-r--r-- 1 zenke lcn1 954 Jan 20 10:52 out.0.log | ||
| + | 5456 -rw-r--r-- 1 zenke lcn1 5555044 Jan 20 10:52 out.0_e.ras | ||
| + | 1412 -rw-r--r-- 1 zenke lcn1 1433909 Jan 20 10:52 out.0_i.ras | ||
| + | 936 -rw-r--r-- 1 zenke lcn1 951025 Jan 20 10:52 out.0.volt | ||
| + | 888 -rw-r--r-- 1 zenke lcn1 901395 Jan 20 10:52 out.0.ampa | ||
| + | 928 -rw-r--r-- 1 zenke lcn1 942420 Jan 20 10:52 out.0.gaba | ||
| + | </ | ||
| + | |||
| + | To see inhibitory plasticity in action the network can be initialized with small inithal I-E inhibitory weights. Try running the network with the following parameter | ||
| + | <code shell> | ||
| + | ./ | ||
| + | </ | ||
| + | if you then plot the spiking activity recorded in '' | ||
| + | |||
| + | {{: | ||
| + | |||
| + | if you wait for roughly a minute this type of activity will give way to asynchronous irregular activity of the following type | ||
| + | |||
| + | {{: | ||
| + | |||
| + | ==== Running in parallel ==== | ||
| + | |||
| + | This version of the simulation can be run in parallel like any other Auryn simulation. See [[manual: | ||
| + | |||
| + | |||
| + | ===== The important bits ===== | ||
| + | |||
| + | The following snipped of code first initializes two [[manual: | ||
| + | |||
| + | <code c++> | ||
| + | | ||
| + | TIFGroup * neurons_e = new TIFGroup(NE); | ||
| + | TIFGroup * neurons_i = new TIFGroup(NI); | ||
| + | neurons_e-> | ||
| + | neurons_i-> | ||
| + | PoissonGroup * poisson = new PoissonGroup(NP, | ||
| + | |||
| + | |||
| + | logger-> | ||
| + | SparseConnection * con_ei = new SparseConnection(neurons_e, | ||
| + | SparseConnection * con_ii = new SparseConnection(neurons_i, | ||
| + | |||
| + | SparseConnection * con_exte = new SparseConnection(poisson, | ||
| + | |||
| + | SparseConnection * con_ee = new SparseConnection(neurons_e, | ||
| + | SymmetricSTDPConnection * con_ie = new SymmetricSTDPConnection(neurons_i, | ||
| + | gamma*w, | ||
| + | gamma*eta, | ||
| + | GABA); | ||
| + | </ | ||
| + | |||
| + | Note also that in the above code the [[manual: | ||
| + | <code c++> | ||
| + | // stimulus | ||
| + | if (!stimfile.empty()) { | ||
| + | char ch; | ||
| + | NeuronID counter = 0; | ||
| + | ifstream fin(stimfile.c_str()); | ||
| + | while (!fin.eof() && counter< | ||
| + | ch = fin.get(); | ||
| + | if (ch == ' | ||
| + | if (poisson_stim==true) { | ||
| + | for (int i = 0 ; i < NP ; ++i) | ||
| + | con_exte-> | ||
| + | } else { | ||
| + | neurons_e-> | ||
| + | } | ||
| + | } | ||
| + | counter++; | ||
| + | } | ||
| + | fin.close(); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | To run the network and keep activity alive even in the case of highly synchronized activity all cells in the network receive depolarizing external currents. This is set up here | ||
| + | <code c++> | ||
| + | for ( int j = 0; j < NE ; j++ ) { | ||
| + | neurons_e-> | ||
| + | } | ||
| + | |||
| + | for ( int j = 0; j < NI ; j++ ) { | ||
| + | neurons_i-> | ||
| + | } | ||
| + | </ | ||
| + | note however that '' | ||
| + | |||
| + | |||
| + | ===== The full program ===== | ||
| + | <code c++> | ||
| + | /* | ||
| + | * Copyright 2014 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. | ||
| + | * GNU General Public License for more details. | ||
| + | * | ||
| + | * You should have received a copy of the GNU General Public License | ||
| + | * along with Auryn. | ||
| + | */ | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | #include < | ||
| + | |||
| + | #include " | ||
| + | #include " | ||
| + | #include " | ||
| + | #include " | ||
| + | |||
| + | #include " | ||
| + | #include " | ||
| + | #include " | ||
| + | #include " | ||
| + | #include " | ||
| + | #include " | ||
| + | #include " | ||
| + | #include " | ||
| + | |||
| + | #define NE 8000 | ||
| + | #define NI 2000 | ||
| + | #define NP 1000 | ||
| + | #define NSTIM 20 | ||
| + | |||
| + | using namespace std; | ||
| + | namespace po = boost:: | ||
| + | |||
| + | int main(int ac, char* av[]) | ||
| + | { | ||
| + | double w = 0.3 ; | ||
| + | double w_ext = w ; | ||
| + | double gamma = 10. ; | ||
| + | double wmax = 10*gamma*w; | ||
| + | |||
| + | double sparseness = 0.02 ; | ||
| + | |||
| + | double eta = 1e-4 ; | ||
| + | double kappa = 3. ; | ||
| + | double tau_stdp = 20e-3 ; | ||
| + | bool stdp_active = true; | ||
| + | bool poisson_stim = false; | ||
| + | double winh = -1; | ||
| + | double wei = 1; | ||
| + | double chi = 10.; | ||
| + | double bg_current = 2e-2; | ||
| + | |||
| + | double poisson_rate = 100.; | ||
| + | double sparseness_afferents = 0.05; | ||
| + | |||
| + | bool quiet = false; | ||
| + | double simtime = 1000. ; | ||
| + | NeuronID record_neuron = 30; | ||
| + | // handle command line options | ||
| + | |||
| + | string infilename = ""; | ||
| + | string outputfile = " | ||
| + | string stimfile = ""; | ||
| + | string strbuf ; | ||
| + | |||
| + | int errcode = 0; | ||
| + | |||
| + | try { | ||
| + | |||
| + | po:: | ||
| + | desc.add_options() | ||
| + | (" | ||
| + | (" | ||
| + | (" | ||
| + | (" | ||
| + | (" | ||
| + | (" | ||
| + | (" | ||
| + | (" | ||
| + | (" | ||
| + | (" | ||
| + | (" | ||
| + | (" | ||
| + | (" | ||
| + | ; | ||
| + | |||
| + | po:: | ||
| + | po:: | ||
| + | po:: | ||
| + | |||
| + | if (vm.count(" | ||
| + | cout << desc << " | ||
| + | return 1; | ||
| + | } | ||
| + | |||
| + | if (vm.count(" | ||
| + | quiet = true; | ||
| + | } | ||
| + | |||
| + | if (vm.count(" | ||
| + | cout << "input weight matrix " | ||
| + | << | ||
| + | infilename = vm[" | ||
| + | } | ||
| + | |||
| + | if (vm.count(" | ||
| + | cout << " | ||
| + | << | ||
| + | outputfile = vm[" | ||
| + | } | ||
| + | |||
| + | if (vm.count(" | ||
| + | cout << " | ||
| + | << | ||
| + | stimfile = vm[" | ||
| + | } | ||
| + | |||
| + | if (vm.count(" | ||
| + | cout << "eta set to " | ||
| + | << | ||
| + | eta = vm[" | ||
| + | } | ||
| + | |||
| + | if (vm.count(" | ||
| + | cout << "kappa set to " | ||
| + | << | ||
| + | kappa = vm[" | ||
| + | } | ||
| + | |||
| + | if (vm.count(" | ||
| + | cout << " | ||
| + | << | ||
| + | simtime = vm[" | ||
| + | } | ||
| + | |||
| + | if (vm.count(" | ||
| + | cout << "stdp active : " | ||
| + | << | ||
| + | stdp_active = vm[" | ||
| + | } | ||
| + | |||
| + | if (vm.count(" | ||
| + | cout << " | ||
| + | << | ||
| + | poisson_stim = vm[" | ||
| + | } | ||
| + | |||
| + | |||
| + | if (vm.count(" | ||
| + | cout << "inhib weight multiplier : " | ||
| + | << | ||
| + | winh = vm[" | ||
| + | } | ||
| + | |||
| + | if (vm.count(" | ||
| + | cout << "ei weight multiplier : " | ||
| + | << | ||
| + | wei = vm[" | ||
| + | } | ||
| + | |||
| + | if (vm.count(" | ||
| + | cout << "chi multiplier : " | ||
| + | << | ||
| + | chi = vm[" | ||
| + | } | ||
| + | |||
| + | } | ||
| + | catch(exception& | ||
| + | cerr << " | ||
| + | return 1; | ||
| + | } | ||
| + | catch(...) { | ||
| + | cerr << " | ||
| + | } | ||
| + | |||
| + | // BEGIN Global definitions | ||
| + | mpi:: | ||
| + | mpi:: | ||
| + | communicator = &world; | ||
| + | |||
| + | stringstream oss; | ||
| + | oss << outputfile << " | ||
| + | outputfile = oss.str(); | ||
| + | oss << " | ||
| + | string logfile = oss.str(); | ||
| + | logger = new Logger(logfile, | ||
| + | |||
| + | sys = new System(& | ||
| + | // END Global definitions | ||
| + | |||
| + | |||
| + | |||
| + | logger-> | ||
| + | TIFGroup * neurons_e = new TIFGroup(NE); | ||
| + | TIFGroup * neurons_i = new TIFGroup(NI); | ||
| + | neurons_e-> | ||
| + | neurons_i-> | ||
| + | PoissonGroup * poisson = new PoissonGroup(NP, | ||
| + | |||
| + | |||
| + | logger-> | ||
| + | SparseConnection * con_ei = new SparseConnection(neurons_e, | ||
| + | SparseConnection * con_ii = new SparseConnection(neurons_i, | ||
| + | |||
| + | SparseConnection * con_exte = new SparseConnection(poisson, | ||
| + | |||
| + | SparseConnection * con_ee = new SparseConnection(neurons_e, | ||
| + | SymmetricSTDPConnection * con_ie = new SymmetricSTDPConnection(neurons_i, | ||
| + | gamma*w, | ||
| + | gamma*eta, | ||
| + | GABA); | ||
| + | |||
| + | if (!infilename.empty()) { | ||
| + | sys-> | ||
| + | } | ||
| + | |||
| + | if (winh> | ||
| + | con_ie-> | ||
| + | |||
| + | logger-> | ||
| + | strbuf = outputfile; | ||
| + | strbuf += " | ||
| + | SpikeMonitor * smon_e = new SpikeMonitor( neurons_e , strbuf.c_str() ); | ||
| + | |||
| + | strbuf = outputfile; | ||
| + | strbuf += " | ||
| + | SpikeMonitor * smon_i = new SpikeMonitor( neurons_i, strbuf.c_str() ); | ||
| + | smon_i-> | ||
| + | |||
| + | strbuf = outputfile; | ||
| + | strbuf += " | ||
| + | StateMonitor * vmon = new StateMonitor( neurons_e, record_neuron, | ||
| + | |||
| + | strbuf = outputfile; | ||
| + | strbuf += " | ||
| + | StateMonitor * amon = new StateMonitor( neurons_e, record_neuron, | ||
| + | |||
| + | strbuf = outputfile; | ||
| + | strbuf += " | ||
| + | StateMonitor * gmon = new StateMonitor( neurons_e, record_neuron, | ||
| + | |||
| + | RateChecker * chk = new RateChecker( neurons_e , 0.1 , 1000. , 100e-3); | ||
| + | |||
| + | for ( int j = 0; j < NE ; j++ ) { | ||
| + | neurons_e-> | ||
| + | } | ||
| + | |||
| + | for ( int j = 0; j < NI ; j++ ) { | ||
| + | neurons_i-> | ||
| + | } | ||
| + | |||
| + | // stimulus | ||
| + | if (!stimfile.empty()) { | ||
| + | char ch; | ||
| + | NeuronID counter = 0; | ||
| + | ifstream fin(stimfile.c_str()); | ||
| + | while (!fin.eof() && counter< | ||
| + | ch = fin.get(); | ||
| + | if (ch == ' | ||
| + | if (poisson_stim==true) { | ||
| + | for (int i = 0 ; i < NP ; ++i) | ||
| + | con_exte-> | ||
| + | } else { | ||
| + | neurons_e-> | ||
| + | } | ||
| + | } | ||
| + | counter++; | ||
| + | } | ||
| + | fin.close(); | ||
| + | } | ||
| + | |||
| + | |||
| + | logger-> | ||
| + | con_ie-> | ||
| + | |||
| + | sys-> | ||
| + | |||
| + | logger-> | ||
| + | sys-> | ||
| + | |||
| + | logger-> | ||
| + | delete sys; | ||
| + | |||
| + | logger-> | ||
| + | return errcode; | ||
| + | } | ||
| + | </ | ||
examples/sim_isp_orig.txt · Last modified: 2014/01/20 10:19 by zenke
