Auryn simulator

Simulator for spiking neural networks with synaptic plasticity

User Tools

Site Tools


examples:sim_background

sim_background

This simulation is a bit more sophisticated because it comes with many adjustable settings. Therefore the code might not be as straight forward to read as this is the case in the more simple examples. It was used in Zenke et al. 2013 to study the stability of the asynchronous irregular background state in a balanced network in the presence of TripletSTDP over extended periods of time (up to 24h network time; see A in Figure below).

How to run the code

To run the code after successful compilation it suffices to invoke

./sim_background --tau 20

Here the parameter tau is the time constant behind the homeostatic rate estimate, the role of which is center of the study in Zenke et al. 2013. The program will first simulate the non-plastic network for a period of 3*tau seconds before plasticity is enabled. Since the simulation of this plastic network is relatively heavy it offers itself for parallel simulation. Suppose you change the parameter tau to 50 seconds und run the script again the simulation will destabilize after some 10min (cf. Figure above).

The important bits

Similar to other network simulations such as sim_isp_orig we start by defining two neuron groups. The sim_background simulation supports a selection of different neuron models via command line parameters which is why this section looks a little more sophisticated than examples you might have encountered before. The simulation file further allows to specify the conductance ratio between AMPA and NMDA conductance via the function calls set_ampa_nmda_ratio(ratio)

    NeuronGroup * neurons_e;
    if ( adapt ) {
        neurons_e = new AIFGroup(ne);
        ((AIFGroup*)neurons_e)->set_ampa_nmda_ratio(ampa_nmda_ratio);
        ((AIFGroup*)neurons_e)->dg_adapt1=1.0;
    } else {
        if ( loadbalance ) 
            neurons_e = new IFGroup(ne,1.2,(1.2*ne+ni));
        else
            neurons_e = new IFGroup(ne);
        ((IFGroup*)neurons_e)->set_ampa_nmda_ratio(ampa_nmda_ratio);
    }
    IFGroup * neurons_i = new IFGroup(ni);
 
    // initialize membranes
    neurons_i->set_tau_mem(10e-3);
    neurons_e->random_mem(-60e-3,10e-3);
    neurons_i->random_mem(-60e-3,10e-3);
 
    ((IFGroup*)neurons_i)->set_ampa_nmda_ratio(ampa_nmda_ratio);

The non-plastic connections between the different neuron groups are set up in this section

msg = "Setting up I connections ...";
    logger->msg(msg,PROGRESS,true);
    SparseConnection * con_ie = new SparseConnection(neurons_i,neurons_e,
            w_ie,sparseness,GABA);
    SparseConnection * con_ii = new SparseConnection(neurons_i,neurons_i,
            w_ii,sparseness,GABA);
 
    msg =  "Setting up E connections ...";
    logger->msg(msg,PROGRESS,true);
    SparseConnection * con_ei;
    if ( !ei_plastic ) {
        con_ei = new SparseConnection(neurons_e,neurons_i,
                w_ei, sparseness,GLUT);
    } else {
        if (infilename.empty()) {
            con_ei = new TripletConnection(neurons_e,neurons_i,
                w_ei, sparseness,
                tau_hom, eta, kappa, wmax, GLUT);
        } else {
            string str;
            str = infilename;
            str += ".ei.wmat";
            stringstream oss;
            oss << "Loading weight matrix from " << str;
            logger->msg(oss.str(),PROGRESS,true);
            con_ei = new TripletConnection(neurons_e,neurons_i,
                str.c_str(),
                tau_hom, eta, kappa, wmax, GLUT);
        }
    }

Finally triplet STDP is setup here. The code again looks a bit more complicated since the simulation supports the use of different flavours of TripletSTDPConnection, the optional addition of Gaussian noise on the initial weights the loading of a predefined connectivity matrix via wmat file.

TripletConnection * con_ee;
 
    if (infilename.empty()) {
        if (decay)
            con_ee = new TripletDecayConnection(neurons_e,neurons_e,
                w_ee, sparseness,
                tau_hom, eta, tau_decay,
                kappa, wdecay, wmax, GLUT);
        else
            con_ee = new TripletConnection(neurons_e,neurons_e,
                w_ee, sparseness,
                tau_hom, eta, kappa, wmax, GLUT);
 
        // con_ee->set_min_weight(wmin);
        if ( noisyweights )
            con_ee->random_data(w_ee,w_ee/4);
        for ( int i = 0 ; i < n_strengthen ; ++i ) {
            con_ee->set_data(i,i*(wmax/n_strengthen));
        }
    }
    else {
        string str;
        str = infilename;
        str += ".wmat";
        stringstream oss;
        oss << "Loading weight matrix from " << str;
        logger->msg(oss.str(),PROGRESS,true);
        if (decay)
            con_ee = new TripletDecayConnection(neurons_e,neurons_e,
                str.c_str(),tau_hom,eta,tau_decay,kappa,wdecay,wmax,GLUT);
        else
            con_ee = new TripletConnection(neurons_e,neurons_e,
                str.c_str(),tau_hom,eta,kappa,wmax,GLUT);
 
 
        sprintf(strbuf, "%s.e.nstate", infilename.c_str());
        neurons_e->load_from_file(strbuf);
        sprintf(strbuf, "%s.i.nstate", infilename.c_str());
        neurons_i->load_from_file(strbuf);
 
        // primetime = 0;
    }
examples/sim_background.txt · Last modified: 2014/03/20 09:04 by zenke