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

A PoissonGroup with multiple subpopulations that co-modulate their firing rate according to an Ornstein Uhlenbeck process. More...

#include <InputChannelGroup.h>

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

Public Member Functions

 InputChannelGroup (NeuronID n, AurynDouble rate=5., NeuronID chsize=100)
 
virtual ~InputChannelGroup ()
 
virtual void evolve ()
 Virtual pure evolve function which needs to be implemented by derived classes. More...
 
void set_rate (AurynDouble rate)
 
void set_timescale (AurynDouble scale)
 
void set_offset (int off)
 
void set_means (AurynDouble m)
 
void set_mean (NeuronID channel, AurynDouble m)
 
void set_amplitudes (AurynDouble amp)
 
void set_amplitude (NeuronID channel, AurynDouble amp)
 
void set_stoptime (AurynDouble stoptime)
 
AurynDouble get_rate ()
 
void seed ()
 
- 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

AurynDoubleamplitudes
 Array for OU process amplitudes. More...
 
AurynDoublemeans
 Array for OU process means. More...
 
- 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 Attributes

AurynDouble lambda
 
AurynTime tstop
 
NeuronID channelsize
 
NeuronID nb_channels
 
AurynDouble timescale
 
int offset
 
AurynTime delay
 
AurynDoubleo
 
NeuronIDx
 
- 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

- 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...
 
- Static Protected Attributes inherited from auryn::SpikingGroup
static AurynTimeclock_ptr = NULL
 

Detailed Description

A PoissonGroup with multiple subpopulations that co-modulate their firing rate according to an Ornstein Uhlenbeck process.

The group can be used to provide a stimulus for Hebbian learning in networks. When defined a given number of groups of given size are defined, as well as a correlation time.

Constructor & Destructor Documentation

◆ InputChannelGroup()

InputChannelGroup::InputChannelGroup ( NeuronID  n,
AurynDouble  rate = 5.,
NeuronID  chsize = 100 
)

Default constructor.

Parameters
nthe size of the group which will be devided by the size of one subgroup to give the number of groups.
ratethe mean firing rate of all cells.
chsizethe size of one subgroup.
85  : SpikingGroup( n )
86 {
87  init(rate, chsize);
88 }
SpikingGroup(NeuronID size, NodeDistributionMode mode=AUTO)
Default constructor.
Definition: SpikingGroup.cpp:38
int n
Definition: mkpat.py:5

◆ ~InputChannelGroup()

InputChannelGroup::~InputChannelGroup ( )
virtual
91 {
92  if ( evolve_locally() ) {
93  // delete dist;
94  delete shared_noise;
95  delete rank_noise;
96  delete [] x;
97  delete [] o;
98  delete [] means;
99  delete [] amplitudes;
100  }
101 }
AurynDouble * o
Definition: InputChannelGroup.h:74
AurynDouble * means
Array for OU process means.
Definition: InputChannelGroup.h:83
bool evolve_locally()
Returns true if the calling instance has units which are integrated on the current rank...
Definition: SpikingGroup.cpp:323
NeuronID * x
Definition: InputChannelGroup.h:77
AurynDouble * amplitudes
Array for OU process amplitudes.
Definition: InputChannelGroup.h:81
Here is the call graph for this function:

Member Function Documentation

◆ evolve()

void InputChannelGroup::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.

115 {
116  // check if the group has timed out
117  if ( tstop && auryn::sys->get_clock() > tstop ) return;
118 
119  for ( unsigned int g = 0 ; g < nb_channels ; ++g ) { // loop over channels
120  // integrate Ornstein Uhlenbeck process
121  o[g] += ( means[g] - o[g] )*auryn_timestep/timescale;
122 
123  // noise increment
124  o[g] += 2.0*((AurynDouble)(*shared_noise)()-0.5)*std::sqrt(auryn_timestep/timescale);
125 
126  // group rate
127  AurynDouble grouprate = amplitudes[g]*o[g];
128  if ( grouprate <= 0 ) grouprate = 0.0;
129 
130  const AurynFloat epsilon = 1e-3;
131  AurynDouble r = (*rank_noise)()/(auryn_timestep*(grouprate+epsilon)); // think before tempering with this!
132  // I already broke the code here once!
133  x[g] = (NeuronID)(r);
134  while ( x[g] < channelsize ) {
135  push_spike ( g*channelsize + x[g] );
136  r = (*rank_noise)()/(auryn_timestep*(grouprate+epsilon));
137  x[g] += (NeuronID)(r);
138  }
139  }
140 }
AurynTime tstop
Definition: InputChannelGroup.h:64
AurynDouble * o
Definition: InputChannelGroup.h:74
r
Definition: mkpat.py:9
NeuronID nb_channels
Definition: InputChannelGroup.h:67
double AurynDouble
Higher precision floating point datatype.
Definition: auryn_definitions.h:158
NeuronID channelsize
Definition: InputChannelGroup.h:66
AurynDouble * means
Array for OU process means.
Definition: InputChannelGroup.h:83
NeuronID * x
Definition: InputChannelGroup.h:77
double auryn_timestep
Simulation timestep in seconds.
Definition: auryn_definitions.cpp:31
AurynDouble * amplitudes
Array for OU process amplitudes.
Definition: InputChannelGroup.h:81
System * sys
Global pointer to instance of System which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:37
float AurynFloat
Low precision floating point datatype.
Definition: auryn_definitions.h:157
void push_spike(NeuronID spike)
Pushes a local NeuronID as spike into the axonal SpikeDelay buffer.
Definition: SpikingGroup.cpp:270
AurynDouble timescale
Definition: InputChannelGroup.h:69
unsigned int NeuronID
NeuronID is an unsigned integeger type used to index neurons in Auryn.
Definition: auryn_definitions.h:151
Here is the call graph for this function:

◆ get_rate()

AurynDouble InputChannelGroup::get_rate ( )
109 {
110  return lambda;
111 }
AurynDouble lambda
Definition: InputChannelGroup.h:62

◆ seed()

void InputChannelGroup::seed ( )
143 {
144  shared_noise_gen.seed(sys->get_synced_seed());
145  rank_noise_gen.seed(sys->get_seed());
146 }
unsigned int get_seed()
Returns a random seed which is different on each rank.
Definition: System.cpp:1030
System * sys
Global pointer to instance of System which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:37
unsigned int get_synced_seed()
Returns a random seed which is the same on each rank.
Definition: System.cpp:1035
Here is the call graph for this function:

◆ set_amplitude()

void InputChannelGroup::set_amplitude ( NeuronID  channel,
AurynDouble  amp 
)
159 {
160  amplitudes[channel] = amp;
161 }
AurynDouble * amplitudes
Array for OU process amplitudes.
Definition: InputChannelGroup.h:81

◆ set_amplitudes()

void InputChannelGroup::set_amplitudes ( AurynDouble  amp)
164 {
165  for ( unsigned int i = 0 ; i < nb_channels ; ++i ) set_amplitude(i,amp);
166 }
NeuronID nb_channels
Definition: InputChannelGroup.h:67
void set_amplitude(NeuronID channel, AurynDouble amp)
Definition: InputChannelGroup.cpp:158
Here is the call graph for this function:

◆ set_mean()

void InputChannelGroup::set_mean ( NeuronID  channel,
AurynDouble  m 
)
149 {
150  means[channel] = m;
151 }
AurynDouble * means
Array for OU process means.
Definition: InputChannelGroup.h:83

◆ set_means()

void InputChannelGroup::set_means ( AurynDouble  m)
154 {
155  for ( unsigned int i = 0 ; i < nb_channels ; ++i ) set_mean(i,m);
156 }
NeuronID nb_channels
Definition: InputChannelGroup.h:67
void set_mean(NeuronID channel, AurynDouble m)
Definition: InputChannelGroup.cpp:148
Here is the call graph for this function:

◆ set_offset()

void InputChannelGroup::set_offset ( int  off)
175 {
176  offset = off;
177  auryn::logger->parameter("offset",offset);
178 }
void parameter(std::string name, T value)
Definition: Logger.h:90
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
int offset
Definition: InputChannelGroup.h:70
Here is the call graph for this function:

◆ set_rate()

void InputChannelGroup::set_rate ( AurynDouble  rate)
104 {
105  lambda = rate;
106 }
AurynDouble lambda
Definition: InputChannelGroup.h:62

◆ set_stoptime()

void InputChannelGroup::set_stoptime ( AurynDouble  stoptime)
181 {
182  tstop = stoptime*auryn_timestep;
183  auryn::logger->parameter("stoptime",stoptime);
184 }
AurynTime tstop
Definition: InputChannelGroup.h:64
void parameter(std::string name, T value)
Definition: Logger.h:90
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
double auryn_timestep
Simulation timestep in seconds.
Definition: auryn_definitions.cpp:31
Here is the call graph for this function:

◆ set_timescale()

void InputChannelGroup::set_timescale ( AurynDouble  scale)
169 {
170  timescale = scale;
171  auryn::logger->parameter("timescale",timescale);
172 }
void parameter(std::string name, T value)
Definition: Logger.h:90
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
AurynDouble timescale
Definition: InputChannelGroup.h:69
Here is the call graph for this function:

Member Data Documentation

◆ amplitudes

AurynDouble* auryn::InputChannelGroup::amplitudes

Array for OU process amplitudes.

◆ channelsize

NeuronID auryn::InputChannelGroup::channelsize
protected

◆ delay

AurynTime auryn::InputChannelGroup::delay
protected

◆ lambda

AurynDouble auryn::InputChannelGroup::lambda
protected

◆ means

AurynDouble* auryn::InputChannelGroup::means

Array for OU process means.

◆ nb_channels

NeuronID auryn::InputChannelGroup::nb_channels
protected

◆ o

AurynDouble* auryn::InputChannelGroup::o
protected

Stores Ornstein Uhlenbeck state

◆ offset

int auryn::InputChannelGroup::offset
protected

◆ timescale

AurynDouble auryn::InputChannelGroup::timescale
protected

◆ tstop

AurynTime auryn::InputChannelGroup::tstop
protected

◆ x

NeuronID* auryn::InputChannelGroup::x
protected

Stores the hopping state


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