Auryn simulator  v0.8.1-206-gb56e451
Plastic Spiking Neural Network Simulator
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
auryn::AIF2Group Class Reference

An adaptive integrate and fire group comparable to AIFGroup but with two independent adaptation timescales. More...

#include <AIF2Group.h>

Inheritance diagram for auryn::AIF2Group:
Inheritance graph
[legend]
Collaboration diagram for auryn::AIF2Group:
Collaboration graph
[legend]

Public Member Functions

 AIF2Group (NeuronID size, NodeDistributionMode distmode=AUTO)
 
virtual ~AIF2Group ()
 
void random_adapt (AurynState mean, AurynState sigma)
 
void clear ()
 
virtual void evolve ()
 Virtual pure evolve function which needs to be implemented by derived classes. More...
 
- Public Member Functions inherited from auryn::AIFGroup
 AIFGroup (NeuronID size, NodeDistributionMode distmode=AUTO)
 
virtual ~AIFGroup ()
 
void set_tau_mem (AurynFloat taum)
 
AurynFloat get_tau_mem ()
 
void set_tau_ampa (AurynFloat tau)
 
void set_tau_gaba (AurynFloat tau)
 
void set_tau_nmda (AurynFloat tau)
 
void set_tau_adapt (AurynFloat tau)
 
AurynFloat get_tau_ampa ()
 
AurynFloat get_tau_gaba ()
 
AurynFloat get_tau_nmda ()
 
AurynFloat get_tau_adapt ()
 
void random_adapt (AurynState mean, AurynState sigma)
 
void set_ampa_nmda_ratio (AurynFloat ratio)
 
void calculate_scale_constants ()
 
void clear ()
 
void evolve ()
 Virtual pure evolve function which needs to be implemented by derived classes. More...
 
- Public Member Functions inherited from auryn::NeuronGroup
 NeuronGroup (NeuronID n, NodeDistributionMode mode=AUTO)
 Default constructor. More...
 
 NeuronGroup (NeuronID n, double loadmultiplier, NeuronID total)
 Old default constructor. More...
 
virtual ~NeuronGroup ()
 
void set_state (std::string name, AurynState val)
 Conveniently sets all values in a state vector identified by name in this group. More...
 
void set_state (std::string name, NeuronID i, AurynState val)
 Conveniently sets a single value of element i in a state vector identified by name in this group. More...
 
virtual AurynStateVectorget_default_exc_target ()
 Returns default exc target input. More...
 
virtual AurynStateVectorget_default_inh_target ()
 Returns default inh target input. More...
 
void random_mem (AurynState mean=-60e-3, AurynState sigma=5e-3)
 
virtual void init_state ()
 
void safe_tadd (NeuronID id, AurynWeight amount, TransmitterType t=GLUT)
 
void tadd (NeuronID id, AurynWeight amount, TransmitterType t=GLUT)
 
void tadd (AurynStateVector *state, NeuronID id, AurynWeight amount)
 
- Public Member Functions inherited from auryn::SpikingGroup
void add_state_vector (std::string key, AurynStateVector *state_vector)
 Adds a state vector passed as an argument to the dictinary. More...
 
void remove_state_vector (std::string key)
 Removes a state vector passed as an argument to the dictinary. More...
 
AurynStateVectorfind_state_vector (std::string key)
 Returns existing state vector by name or NULL if it does not exist. More...
 
AurynStateVectorget_state_vector (std::string key)
 Creates a new or returns an existing state vector by name. More...
 
AurynStateVectorget_existing_state_vector (std::string key)
 Returns an existing state with the supplied name. More...
 
AurynStateVectorcreate_state_vector (std::string key)
 Creates a new state vector and throws an exception if a vector with the same name exists. More...
 
AurynStateget_state_variable (std::string key)
 Creates a new group-wide state variable or returns an existing group-wide variable by name then returns a pointer to it. More...
 
void randomize_state_vector_gauss (std::string state_vector_name, AurynState mean, AurynState sigma, int seed=12239)
 Randomizes the content of a state vector with Gaussian random numbers. Seeding is MPI save. More...
 
 SpikingGroup (NeuronID size, NodeDistributionMode mode=AUTO)
 Default constructor. More...
 
virtual ~SpikingGroup ()
 Default destructor. More...
 
virtual void evolve_traces ()
 Evolves traces. More...
 
void set_name (std::string s)
 Set connection name. More...
 
std::string get_name ()
 Retrieves the groups name. More...
 
std::string get_file_name ()
 Extracts the class name of the connection from the file name. More...
 
std::string get_log_name ()
 Returns a string which is the combination of file and connection name for logging. More...
 
void inc_num_spike_attributes (int x)
 Instructs SpikingGroup to increase the number of spike attributes by x. More...
 
int get_num_spike_attributes ()
 
void conditional_evolve ()
 Conditional evolve functino which is called by System. More...
 
unsigned int get_locked_rank ()
 Returns locked rank for SpikingGroups which are not distributed across all ranks. More...
 
unsigned int get_locked_range ()
 Returns locked range of ranks for SpikingGroups which are not distributed across all ranks. More...
 
SpikeContainerget_spikes ()
 Returns pointer to a spike container that contains spikes which arrive in this timestep from all neurons in this group. More...
 
SpikeContainerget_spikes_immediate ()
 Returns pointer to SpikeContainer of spikes generated during the last evolve() step. More...
 
AttributeContainerget_attributes ()
 Returns pointer to Attributecontainer for usage in propagating Connection objects. Same as get_spikes_immediate(), however might be overwritten to contain Spikes that have been delayed. More...
 
AttributeContainerget_attributes_immediate ()
 Returns pointer to Attributecontainer of spikes generated during the last evolve() step. More...
 
NeuronID get_size ()
 Returns the size of the group. More...
 
NeuronID get_pre_size ()
 Returns the size of the group. More...
 
NeuronID calculate_rank_size (int rank=-1)
 Determines rank size and stores it in local variable. More...
 
NeuronID get_rank_size ()
 Returns the size on this rank. More...
 
NeuronID get_post_size ()
 Returns the size on this rank. More...
 
void set_clock_ptr (AurynTime *clock)
 
bool evolve_locally ()
 Returns true if the calling instance has units which are integrated on the current rank. More...
 
NeuronID get_uid ()
 Get the unique ID of the class. More...
 
Traceget_pre_trace (AurynFloat x)
 Returns a pre trace with time constant x. More...
 
void add_pre_trace (Trace *tr)
 Adds trace to pretrace stack of a connection. More...
 
Traceget_post_trace (AurynFloat x)
 Returns a post trace with time constant x. More...
 
void add_post_trace (Trace *tr)
 Adds trace to posttrace stack of a connection. More...
 
void push_spike (NeuronID spike)
 Pushes a local NeuronID as spike into the axonal SpikeDelay buffer. More...
 
void push_attribute (AurynFloat attrib)
 Pushes a spike attribute into the axonal SpikeDelay buffer. More...
 
void clear_spikes ()
 Clears all spikes stored in the delays which is useful to reset a network during runtime. More...
 
Traceget_post_state_trace (std::string state_name="mem", AurynFloat tau=10e-3, AurynFloat b=0.0)
 Returns a post trace of a neuronal state variable e.g. the membrane potential with time constant tau. More...
 
Traceget_post_state_trace (AurynStateVector *state, AurynFloat tau=10e-3, AurynFloat b=0.0)
 Returns a post trace of a neuronal state variable specified by pointer. More...
 
void set_delay (int d)
 Sets axonal delay for this SpikingGroup. More...
 
virtual bool write_to_file (const char *filename)
 Writes current states of SpikingGroup to human-readible textfile if implemented in derived class. More...
 
virtual bool load_from_file (const char *filename)
 Reads current states of SpikingGroup to human-readible textfile if implemented in derived class. More...
 
NeuronID ranksize ()
 Returns size (num of neurons) on the current rank. More...
 
NeuronID global2rank (NeuronID i)
 Converts global NeuronID within the SpikingGroup to the local NeuronID on this rank. More...
 
NeuronID rank2global (NeuronID i)
 Converts local NeuronID from the local rank to a global NeuronID. More...
 
bool localrank (NeuronID i)
 Checks if the global NeuronID i is integrated on this MPI rank. More...
 
NeuronID get_vector_size ()
 Rank size but rounded up to multiples of 4 (or potentially some other and larger number in future versions) for SSE compatibility. More...
 

Public Attributes

AurynFloat dg_adapt2
 
- Public Attributes inherited from auryn::AIFGroup
AurynFloat dg_adapt1
 
- Public Attributes inherited from auryn::NeuronGroup
AurynStateVectormem
 
AurynStateVectorg_ampa
 
AurynStateVectorg_gaba
 
AurynStateVectorg_nmda
 
AurynStateVectorthr
 
- Public Attributes inherited from auryn::SpikingGroup
SpikeDelaydelay
 
bool active
 Toggles group active. More...
 
std::map< std::string, AurynStateVector * > state_vectors
 
std::map< std::string, AurynStatestate_variables
 

Protected Member Functions

void calculate_scale_constants ()
 
void integrate_linear_nmda_synapses ()
 
void check_thresholds ()
 
- Protected Member Functions inherited from auryn::AIFGroup
void init ()
 
void vector_scale (float mul, auryn_vector_float *v)
 
void integrate_linear_nmda_synapses ()
 
void integrate_membrane ()
 Integrate the internal state. More...
 
void check_thresholds ()
 
- Protected Member Functions inherited from auryn::NeuronGroup
void init ()
 
void free ()
 
- Protected Member Functions inherited from auryn::SpikingGroup
virtual void load_input_line (NeuronID i, const char *buf)
 
virtual std::string get_output_line (NeuronID i)
 
virtual void virtual_serialize (boost::archive::binary_oarchive &ar, const unsigned int version)
 Implementatinon of serialize function for writing. More...
 
virtual void virtual_serialize (boost::archive::binary_iarchive &ar, const unsigned int version)
 Implementatinon of serialize function for reading. More...
 
void free ()
 Frees potentially allocated memory. More...
 

Protected Attributes

auryn_vector_floatg_adapt2
 
- Protected Attributes inherited from auryn::AIFGroup
AurynStateVectordmem
 
AurynStateVectort_leak
 
AurynStateVectort_exc
 
AurynStateVectort_inh
 
AurynStateVectorg_adapt1
 
AurynFloat scale_ampa
 
AurynFloat scale_gaba
 
AurynFloat scale_thr
 
AurynFloat scale_adapt1
 
AurynFloat tau_adapt1
 
AurynFloat e_rest
 
AurynFloat e_rev
 
AurynFloat thr_rest
 
AurynFloat tau_mem
 
AurynFloat tau_thr
 
AurynFloat dthr
 
AurynFloat tau_ampa
 
AurynFloat tau_gaba
 
AurynFloat tau_nmda
 
AurynFloat A_ampa
 
AurynFloat A_nmda
 
- Protected Attributes inherited from auryn::NeuronGroup
AurynStateVectordefault_exc_target_state
 
AurynStateVectordefault_inh_target_state
 
- Protected Attributes inherited from auryn::SpikingGroup
std::vector< Trace * > pretraces
 Pretraces. More...
 
std::vector< Trace * > posttraces
 Posttraces. More...
 
std::vector< Trace * > post_state_traces
 Post state traces. More...
 
std::vector< AurynFloatpost_state_traces_spike_biases
 
std::vector< AurynStateVector * > post_state_traces_states
 
std::string group_name
 Identifying name for object. More...
 
NeuronID size
 Stores the size of the group. More...
 
NeuronID rank_size
 Stores the size of the group on this rank. More...
 
SpikeContainerspikes
 SpikeContainers to store spikes produced during one step of evolve. More...
 
AttributeContainerattribs
 

Additional Inherited Members

- Static Protected Attributes inherited from auryn::SpikingGroup
static AurynTimeclock_ptr = NULL
 

Detailed Description

An adaptive integrate and fire group comparable to AIFGroup but with two independent adaptation timescales.

Constructor & Destructor Documentation

◆ AIF2Group()

AIF2Group::AIF2Group ( NeuronID  size,
NodeDistributionMode  distmode = AUTO 
)
31  : AIFGroup(size, distmode)
32 {
33  // auryn::sys->register_spiking_group(this); // already registered in AIFGroup
34  if ( evolve_locally() ) init();
35 }
AIFGroup(NeuronID size, NodeDistributionMode distmode=AUTO)
Definition: AIFGroup.cpp:31
bool evolve_locally()
Returns true if the calling instance has units which are integrated on the current rank...
Definition: SpikingGroup.cpp:323
NeuronID size
Stores the size of the group.
Definition: SpikingGroup.h:119
Here is the call graph for this function:

◆ ~AIF2Group()

AIF2Group::~AIF2Group ( )
virtual
87 {
88  if ( evolve_locally() ) free();
89 }
bool evolve_locally()
Returns true if the calling instance has units which are integrated on the current rank...
Definition: SpikingGroup.cpp:323
Here is the call graph for this function:

Member Function Documentation

◆ calculate_scale_constants()

void AIF2Group::calculate_scale_constants ( )
protected
38 {
40  scale_adapt2 = exp(-auryn_timestep/tau_adapt2);
41 }
void calculate_scale_constants()
Definition: AIFGroup.cpp:37
double auryn_timestep
Simulation timestep in seconds.
Definition: auryn_definitions.cpp:31
Here is the call graph for this function:

◆ check_thresholds()

void AIF2Group::check_thresholds ( )
protected
121 {
123 
124  AurynState * thr_ptr = thr->data;
125  for ( AurynState * i = mem->data ; i != mem->data+get_rank_size() ; ++i ) { // it's important to use rank_size here otherwise there might be spikes from units that do not exist
126  if ( *i > ( thr_rest + *thr_ptr ) ) {
127  NeuronID unit = i-mem->data;
128  push_spike(unit);
129  mem->set( unit, e_rest); // reset
130  thr->set( unit, dthr); //refractory
133  }
134  thr_ptr++;
135  }
136 
137 }
NeuronID get_rank_size()
Returns the size on this rank.
Definition: SpikingGroup.h:450
AurynFloat dg_adapt1
Definition: AIFGroup.h:64
T * data
Pointer to the array housing the data.
Definition: AurynVector.h:154
void set(IndexType i, T value)
Sets element i in vector to value.
Definition: AurynVector.h:224
AurynStateVector * g_adapt1
Definition: AIFGroup.h:47
void auryn_vector_float_clip(auryn_vector_float *v, const float a, const float b)
Definition: auryn_definitions.cpp:99
AurynFloat AurynState
Type for Auryn state variables (default single precision since it needs to be compatible with auryn_v...
Definition: auryn_definitions.h:160
auryn_vector_float * g_adapt2
Definition: AIF2Group.h:52
AurynFloat e_rev
Definition: AIFGroup.h:54
AurynFloat dg_adapt2
Definition: AIF2Group.h:64
void push_spike(NeuronID spike)
Pushes a local NeuronID as spike into the axonal SpikeDelay buffer.
Definition: SpikingGroup.cpp:270
AurynFloat e_rest
Definition: AIFGroup.h:54
AurynFloat thr_rest
Definition: AIFGroup.h:54
void add_specific(const IndexType i, const T c)
Adds the value c to specific vector element i.
Definition: AurynVector.h:263
AurynStateVector * mem
Definition: NeuronGroup.h:64
AurynStateVector * thr
Definition: NeuronGroup.h:75
unsigned int NeuronID
NeuronID is an unsigned integeger type used to index neurons in Auryn.
Definition: auryn_definitions.h:151
AurynFloat dthr
Definition: AIFGroup.h:54
Here is the call graph for this function:

◆ clear()

void AIF2Group::clear ( )
virtual

Implements auryn::NeuronGroup.

55 {
57  for (NeuronID i = 0; i < get_rank_size(); i++) {
59  }
60 }
NeuronID get_rank_size()
Returns the size on this rank.
Definition: SpikingGroup.h:450
void clear()
Definition: AIFGroup.cpp:72
auryn_vector_float * g_adapt2
Definition: AIF2Group.h:52
unsigned int NeuronID
NeuronID is an unsigned integeger type used to index neurons in Auryn.
Definition: auryn_definitions.h:151
void auryn_vector_float_set(auryn_vector_float *v, const NeuronID i, AurynFloat x)
Definition: auryn_definitions.cpp:131
Here is the call graph for this function:

◆ evolve()

void AIF2Group::evolve ( )
virtual

Virtual pure evolve function which needs to be implemented by derived classes.

The evolve function is called during simulations in every timestep by the System class. It updates the internal state of the spiking group and pushes spikes which are generated in this timestep to the axonal output delay (SpikeDelay).

Implements auryn::SpikingGroup.

140 {
144 }
void check_thresholds()
Definition: AIF2Group.cpp:120
void integrate_linear_nmda_synapses()
Definition: AIF2Group.cpp:91
void integrate_membrane()
Integrate the internal state.
Definition: AIFGroup.cpp:139
Here is the call graph for this function:

◆ integrate_linear_nmda_synapses()

void AIF2Group::integrate_linear_nmda_synapses ( )
protected
92 {
93  // decay of ampa and gaba channel, i.e. multiply by exp(-auryn_timestep/tau)
97  auryn_vector_float_scale(scale_adapt2,g_adapt2);
98 
99  // compute dg_nmda = (g_ampa-g_nmda)*auryn_timestep/tau_nmda and add to g_nmda
103 
104  // excitatory
109 
110  // inhibitory
111  auryn_vector_float_copy(g_gaba,t_leak); // using t_leak as temp here
117 }
void auryn_vector_float_add_constant(auryn_vector_float *a, const float b)
Computes a := a + b.
Definition: auryn_definitions.cpp:69
void auryn_vector_float_mul(auryn_vector_float *a, auryn_vector_float *b)
Definition: auryn_definitions.cpp:64
AurynStateVector * t_exc
Definition: AIFGroup.h:45
AurynFloat scale_ampa
Definition: AIFGroup.h:49
void auryn_vector_float_scale(const float a, auryn_vector_float *b)
Definition: auryn_definitions.cpp:74
AurynFloat scale_gaba
Definition: AIFGroup.h:49
AurynFloat A_ampa
Definition: AIFGroup.h:56
AurynStateVector * g_ampa
Definition: NeuronGroup.h:66
AurynStateVector * g_adapt1
Definition: AIFGroup.h:47
void auryn_vector_float_saxpy(const float a, auryn_vector_float *x, auryn_vector_float *y)
Definition: auryn_definitions.cpp:79
auryn_vector_float * g_adapt2
Definition: AIF2Group.h:52
AurynFloat e_rev
Definition: AIFGroup.h:54
double auryn_timestep
Simulation timestep in seconds.
Definition: auryn_definitions.cpp:31
void auryn_vector_float_copy(auryn_vector_float *src, auryn_vector_float *dst)
Copies vector src to dst assuming they have the same size.
Definition: auryn_definitions.cpp:135
float AurynFloat
Low precision floating point datatype.
Definition: auryn_definitions.h:157
AurynFloat A_nmda
Definition: AIFGroup.h:56
AurynFloat tau_nmda
Definition: AIFGroup.h:55
AurynStateVector * t_inh
Definition: AIFGroup.h:46
AurynFloat scale_adapt1
Definition: AIFGroup.h:50
AurynStateVector * g_nmda
Definition: NeuronGroup.h:70
AurynStateVector * g_gaba
Definition: NeuronGroup.h:68
AurynStateVector * mem
Definition: NeuronGroup.h:64
AurynStateVector * t_leak
Definition: AIFGroup.h:44
Here is the call graph for this function:

◆ random_adapt()

void AIF2Group::random_adapt ( AurynState  mean,
AurynState  sigma 
)
64 {
65  boost::mt19937 ng_gen(42); // produces same series every time
66  boost::normal_distribution<> dist((double)mean, (double)sigma);
67  boost::variate_generator<boost::mt19937&, boost::normal_distribution<> > die(ng_gen, dist);
68  AurynState rv;
69 
70  for ( AurynLong i = 0 ; i<get_rank_size() ; ++i ) {
71  rv = die();
72  if ( rv>0 )
73  g_adapt1->set( i, rv );
74  rv = die();
75  if ( rv>0 )
76  g_adapt2->set( i, rv );
77  }
78 
79  init_state();
80 }
NeuronID get_rank_size()
Returns the size on this rank.
Definition: SpikingGroup.h:450
void set(IndexType i, T value)
Sets element i in vector to value.
Definition: AurynVector.h:224
AurynStateVector * g_adapt1
Definition: AIFGroup.h:47
unsigned long AurynLong
An unsigned long type used to count synapses or similar.
Definition: auryn_definitions.h:154
AurynFloat AurynState
Type for Auryn state variables (default single precision since it needs to be compatible with auryn_v...
Definition: auryn_definitions.h:160
auryn_vector_float * g_adapt2
Definition: AIF2Group.h:52
virtual void init_state()
Definition: NeuronGroup.cpp:93
Here is the call graph for this function:

Member Data Documentation

◆ dg_adapt2

AurynFloat auryn::AIF2Group::dg_adapt2

◆ g_adapt2

auryn_vector_float* auryn::AIF2Group::g_adapt2
protected

The documentation for this class was generated from the following files: