C++ model

Functions

template<class T>
void print_vector(const vector<T> &v)

Templated function printing a vector.

string join_and_correct_config(string conf, string dest)

Function managing config file names.

Variables

const double EPSILON = 0.0001

External input with frequency below this threshold (expressed in kHz) will be ignored.

const double TOLL = 0.0001

Parameter setting the precision for the precision in the bisection procedure followed by Network::find_sol_bisection (used in case of oscillatory external poissonian input)

class RandomGenerator
#include <model.hpp>

Class useful to generate a (pseudo)random double between 0 and 1 using the pcg generator.

Public Functions

inline RandomGenerator()
inline double getRandomUniform()

Function returning a (pseudo)random double between 0 and 1.

Private Members

pcg32 gen
uniform_real_distribution<double> dis
class Neuron
#include <model.hpp>

Class handling the neuron structure

Public Functions

Neuron(unsigned _dim)

Class constructor.

void info()

Method printing a list of the attributes and their value.

Public Members

vector<double> x

State vector.

unsigned dim

Dimenssion of the state vector x.

double t_last_spike

time of last spike (initialized to -1 - SubNetwork::t_ref) [ms]

map<string, vector<unsigned>> neighbors

First outwards neighbors. A dictionary is implemetnted with format: {target SubNetwork : list of neurons}

map<string, vector<double>> input_t_ex

Excitatory inputs [ms]. A dictionary is implemetnted with format: {source SubNetwork : list of input times}

map<string, vector<double>> input_t_in

Inhibitory inputs [ms]. A dictionary is implemetnted with format: {source SubNetwork : list of input times}

map<string, unsigned> next_sp_ex_index

Dictionary containing the index of the next relevant spike in the vector input_t_ex for each excitatory Subnetwork.

map<string, unsigned> next_sp_in_index

Dictionary containing the index of the next relevant spike in the vector input_t_in for each inhibitory Subnetwork.

double ext_weight

External input weight: for each neuron in the subnetwork, it is given by SubNetwork::weights_ex[‘ext’] plus a random value uniformly extracted in [-SubNetwork::dev_ext_weight, SubNetwork::dev_ext_weight] [nS]

vector<double> t_spikes

Vector of the neuron spike times [ms].

class SubNetwork
#include <model.hpp>

Class handling the SubNetwork structure.

Public Functions

SubNetwork(string _name, string _neuron_model, int _N, double _C_m, double _E_L, double _E_ex, double _E_in, double _V_res, double _V_th, double _t_ref, double _I_e, double _osc_amp, double _osc_omega, double _dev_ext_weight, double _ext_in_rate, double _osc_amp_poiss, double _osc_omega_poiss, double _tau_syn_ex, double _tau_syn_in, RandomGenerator _g)

class constructor

void save_t_spikes(string out_file)

Method which save Neuron::t_spikes of each Neuron in pop

Parameters

out_file – output file XXX scrivi come viene stampato

void info()

Method printing a list of the attributes and their value.

Public Members

string name

Name of the SubNetwork (must be unique in the Network)

string neuron_model

Model of neurons (Name-conventions of NEST-simulator adopted). Supported models:

  • iaf_cond_alpha (id_model 0)

  • aeif_cond_exp (id_model 1)

  • aqif_cond_exp (id_model 2)

  • aqif2_cond_exp (id_model 3)

  • iaf_cond_exp (id_model 4)

In order to add your own model you need to: XXX complete here

unsigned id_model

Identificative number for the neuron model.

unsigned N

Number of neurons in the SubNetwork.

double C_m

Membrain capacity [pF].

double E_L

Resting potential [mV].

double E_ex

Excitatory reversal potential [mV].

double E_in

Inhibitory reversal potential [mV].

double V_res

Reset potential [mV].

double V_th

Threshold potential [mV].

double t_ref

Refractory time [ms].

double I_e

External injected current [pA].

double osc_amp

Amplitude of the oscillatory part of the external injected current [pA].

double osc_omega

Angular frequency of the oscillatory part of the external injected current [kHz].

double osc_amp_poiss

Amplitude of the oscillatory part of the external input rate [kHz].

double osc_omega_poiss

Angular frequency of the oscillatory part of the external input rate [kHz].

double dev_ext_weight

Deviation of weights_ex[‘ext’] from its central value [nS].

double ext_in_rate

Input rate from external source [kHz] (here simulating cortical input)

double tau_syn_ex

characteristic time of excitatory synaptic inputs [ms]

double tau_syn_in

characteristic time of inhibitory synaptic inputs [ms]

map<string, double> weights_ex

Weights of excitatory input connections. A dictionary is implemetnted with format: {source SubNetwork : weight [nS]}.

map<string, double> weights_in

Weights of inhibitory input connections. A dictionary is implemetnted with format: {source SubNetwork : weight [NS]}; all weights are positive.

map<string, double> out_delays

Synaptic delays from the subnet to the other subnets. A dictionary is implemetnted with format: {target SubNetwork : delay [ms]}; all weights are positive.

map<string, double> probabilities_out

Connection probabilities of the SubNetwork with the other SubNetworks. A dictionary is implemetnted with format: {target SubNetwork : probability}.

map<string, bool> reverse_effect

Characterization of the effect of spike on target population A dictionary is implemetnted with format: {target SubNetwork : bool}. If true the effect of a spike on the target population is reverted (e.g. an excitatory input on a iaf_cond_exp neuron decreases g_ex)

double a_adaptive

Subthreshold adaptation [nS] (only adaptive models)

double b_adaptive

Spike-triggered adaptation: step_height of adaptation variable after spike emission [pA] (only adaptive models)

double tau_w_adaptive

Characteristic decay time of the adaptation variable (only adaptive models)

double V_peak

Spike detection threshold (only aeif_cond_exp and aqif_cond_exp models)

double g_L

Membrain leakage conductance [nS] (only aeif_cond_exp and iaf_cond_alpha)

double delta_T_aeif_cond_exp

Slope factor of exponential rise (only aeif_cond_exp)

double k_aqif_cond_exp

k parameter of Izhikevich adaptive model [pA/mV2]

double V_b_aqif2_cond_exp

V_b parameter of Izhikevich adaptive fast spiking interneurons model (only aqif2_cond_exp)

vector<Neuron> pop

Vector of N Neuron-type objects.

vector<unsigned> to_save

Vector of neurons whose state you want to save.

Private Members

RandomGenerator g

RandomGenerator object useful to generate random numbers from uniform a uniform distribution in [0,1].

class Network
#include <model.hpp>

Class handling the network structure.

Public Functions

Network(double _t_end, unsigned _n_step, double _dt, unsigned _input_mode, string _subnets_config_yaml, string _weights_config_yaml, string _connections_config_yaml, string _to_save_config_yaml, string _out_dir, RandomGenerator _g, string _input_mode_config = "")

Class constructor // XXX handle errors in createSubnet.

void createSubnets()

Method initializing the subnets vector using configurations files:

void createPops()

Method initializing the vector SubNetwork::pop of each SubNetwork in subnets Neurons are initialized with Neuron::x[0] = SubNetwork::E_L of the belonging SubNetwork

void evolve(double _T)

Method evolving the network for time _T.

void externalInputUpdate()

Method updating external input according to input_mode.

double input_func(double y_, double r0_, double A_, double omega_, double t0_, double t_)

Function whose solutions==0 needs to be find in case of oscillatory external input rate.

double find_sol_bisection(double y_, double r0_, double A_, double omega_, double t0_)

Function determining next spike time in case of oscillatory external input rate.

void free_past()

Method freeing memory from past spikes and performing a control operation over the state vector of each neuron.

void info()

Method printing:

  • main characteristics of the Network composition

  • the simulation control variables

Public Members

map<string, unsigned> supported_models = {{"iaf_cond_alpha", 5}, {"aeif_cond_exp", 4}, {"aqif_cond_exp", 4}, {"aqif2_cond_exp", 4}, {"iaf_cond_exp", 3}}

Dictionary containing the relation between the supported Neuron models and the dimension of its state vector.

map<string, unsigned> subnet_model_id = {{"iaf_cond_alpha", 0}, {"aeif_cond_exp", 1}, {"aqif_cond_exp", 2}, {"aqif2_cond_exp", 3}, {"iaf_cond_exp", 4}}

Dictionary with format { SubNetwork::neuron_model : SubNetwork::id_model }.

Private Members

double t_end

End time of simulation [ms].

double t = 0

Current time during simulation (starts at t=0 and ends at t_end)

unsigned n_step = 0

Number of calls to evolve method with argument t_end / n_step.

double dt

Time resolution of the simulation [ms].

string subnets_config_yaml

Input yaml-file with Network composition and features.

string weights_config_yaml

Input yaml-file with connection weights (positive weights are excitatory, negative weights are inhibitory)

string connections_config_yaml

Input yaml-file with connectivity probabilities between subnetworks and corresponding delays. Note that each delay must immediately follow the related probability

string to_save_config_yaml

Input yaml-file with list of neurons whose state you want to save at each step. You can leave this file empty if you don’t want to save any nuron state.

string out_dir

Output directory of the simulation.

map<string, unsigned> subnet_name_index

Dictionary with format {SubNetwork::name : related index in SubNetwork::subnets}.

map<string, unsigned> subnet_name_N

Dictionary with format {SubNetwork::name : related SubNetwork::N}.

vector<SubNetwork> subnets

Vector of SubNetwork-type objects.

RandomGenerator g

RandomGenerator object useful to generate random numbers from uniform uniform distribution in [0,1].

unsigned input_mode

External input mode:

  • 0 (base mode): each neuron receives an indipendent poisson signal with mean frequency = SubNetwork::ext_in_rate and possibly with the osccillatory component

  • 2 (with_correlation mode): implementation of method A (ask for details, not compatible with oscillatory input)

double rho_corr

Parameter regulating the input correlation of the striatum populations (only in input_mode=2)

vector<unsigned> corr_pops

Vector containing the subnets indices corresponding to the population with correlatated inputs (only in input_mode=2)

map<string, double> corr_last_time

Map containg the last time generated by the exponential distribution for the (partially correlated) external input.