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

Provides a poisson stimulus at random intervals in one or more predefined subsets of the group that are read from a file. More...

#include <StimulusGroup.h>

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

Public Member Functions

virtual unsigned int get_num_stimuli ()
 Returns number of stimuli. More...
 
 StimulusGroup (NeuronID n, string filename, string stimfile, StimulusGroupModeType stimulusmode=RANDOM, AurynFloat baserate=1.0)
 Default constructor. More...
 
 StimulusGroup (NeuronID n, string stimfile, StimulusGroupModeType stimulusmode=RANDOM, AurynFloat baserate=1.0)
 Constructor without pattern file. Patterns can be loaded afterwards using the load_patterns method. More...
 
virtual ~StimulusGroup ()
 
virtual void evolve ()
 Standard virtual evolve function. More...
 
void set_baserate (AurynFloat baserate)
 Sets the baserate that is the rate at 1 activity. More...
 
void set_maxrate (AurynFloat baserate)
 TODO. More...
 
void set_stimulation_mode (StimulusGroupModeType mode)
 Sets the stimulation mode. Can be any of StimulusGroupModeType (MANUAL,RANDOM,SEQUENTIAL,SEQUENTIAL_REV). More...
 
void set_all (AurynFloat val=0.0)
 Sets sets the activity of all units. More...
 
void seed (int rndseed)
 Seeds the random number generator for all stimulus groups of the simulation. More...
 
AurynFloat get_activity (NeuronID i)
 Gets the activity of unit i. More...
 
virtual void load_patterns (string filename)
 Loads stimulus patterns from a designated pat file given. More...
 
virtual void clear_patterns ()
 Clear stimulus patterns. More...
 
void set_mean_off_period (AurynFloat period)
 Set mean quiet interval between consecutive stimuli. More...
 
void set_mean_on_period (AurynFloat period)
 Set mean on period. More...
 
void set_pattern_activity (unsigned int i)
 Function that loops over the stimulus/pattern vector and sets the activity verctor to the gamma values given with the pattern. More...
 
void set_pattern_activity (unsigned int i, AurynFloat setval)
 Function that loops over the stimulus/pattern vector and sets the activity verctor to the given value. More...
 
virtual void set_active_pattern (unsigned int i)
 This function is called internally and sets the activity level to a given active stimulus. More...
 
void set_active_pattern (unsigned int i, AurynFloat default_value)
 This function is called internally and sets the activity level to a given active stimulus. More...
 
void set_next_action_time (double time)
 
void set_distribution (std::vector< double > probs)
 Setter for pattern probability distribution. More...
 
std::vector< double > get_distribution ()
 Getter for pattern probability distribution. More...
 
double get_distribution (int i)
 Getter for pattern i of the probability distribution. More...
 
unsigned int get_stim_count ()
 Returns number of stimuli shown. More...
 
AurynTime get_last_action_time ()
 returns the last action (stim on/off) time in units of AurynTime More...
 
AurynTime get_last_onset_time ()
 returns the last stimulus onset time in units of AurynTime More...
 
AurynTime get_last_offset_time ()
 returns the last stimulus offset time in units of AurynTime More...
 
AurynTime get_next_action_time ()
 returns the next action (stim on/off) time in units of AurynTime More...
 
unsigned int get_cur_stim ()
 returns the index of the current (or last – if not active anymore) active stimulus More...
 
bool get_stim_active ()
 Returns true if currently a stimulus is active and false otherwise. More...
 
void flat_distribution ()
 
void normalize_distribution ()
 
std::vector< type_pattern > * get_patterns ()
 
- 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

int cur_stim_index
 Current stimulus index. More...
 
bool stimulus_active
 Current stimulus active. More...
 
std::vector< type_patternstimuli
 Vector containing all the stimuli. More...
 
AurynFloat scale
 This is by how much the pattern gamma value is multiplied. The resulting value gives the x-times baseline activation. More...
 
bool binary_patterns
 Switches to more efficient algorithm which ignores the gamma value. More...
 
AurynTime refractory_period
 Enables a finite refractory time specified in AurynTime (only works for non-binary-pattern mode. More...
 
bool randomintervals
 Determines if the Group is using random activation intervals. More...
 
bool randomintensities
 Determines if the Group is using random activation intensities. More...
 
AurynDouble background_rate
 Play random Poisson noise with this rate on all channels when no stim is active. More...
 
bool background_during_stimulus
 Switch for background firing during stimulus. 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 Member Functions

void init (StimulusGroupModeType stimulusmode, string stimfile, AurynFloat baserate)
 
virtual void redraw ()
 
void write_stimulus_file (AurynDouble time)
 
void read_next_stimulus_from_file (AurynDouble &time, int &active, int &stimulusid)
 
void set_activity (NeuronID i, AurynFloat val=0.0)
 
- 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

AurynTimettl
 
AurynFloatactivity
 
StimulusGroupModeType stimulus_order
 
unsigned int stimulation_count
 Counter variable for number of stimuli shown. More...
 
NeuronID fgx
 
NeuronID bgx
 
std::vector< double > probabilities
 
AurynTime next_action_time
 next stimulus time requiring change in rates More...
 
AurynTime last_action_time
 last stimulus time requiring change in rates More...
 
AurynTime last_stim_onset_time
 last stimulus onset time More...
 
AurynTime last_stim_offset_time
 last stimulus offset time More...
 
AurynFloat mean_off_period
 
AurynFloat mean_on_period
 
AurynFloat curscale
 
- 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
 

Static Protected Attributes

static boost::mt19937 poisson_gen = boost::mt19937()
 
static boost::mt19937 order_gen = boost::mt19937()
 
static boost::uniform_01< boost::mt19937 > order_die = boost::uniform_01<boost::mt19937> (order_gen)
 
- Static Protected Attributes inherited from auryn::SpikingGroup
static AurynTimeclock_ptr = NULL
 

Detailed Description

Provides a poisson stimulus at random intervals in one or more predefined subsets of the group that are read from a file.

Constructor & Destructor Documentation

◆ StimulusGroup() [1/2]

StimulusGroup::StimulusGroup ( NeuronID  n,
std::string  filename,
std::string  stimfile,
StimulusGroupModeType  stimulusmode = RANDOM,
AurynFloat  baserate = 1.0 
)

Default constructor.

Parameters
nSize of the group
filenameThe path and filename of the pat file.
stimfileThe path and filename of the output file used to record the stimulus timing.
stimulusmodeStimulus mode specifies in which order patterns are presented
baserateThe base firing rate with which all activity is multiplied.
110  : SpikingGroup( n )
111 {
112  init(stimulusmode, stimfile, baserate);
113  load_patterns(filename);
114 }
virtual void load_patterns(string filename)
Loads stimulus patterns from a designated pat file given.
Definition: StimulusGroup.cpp:378
SpikingGroup(NeuronID size, NodeDistributionMode mode=AUTO)
Default constructor.
Definition: SpikingGroup.cpp:38
int n
Definition: mkpat.py:5
void init(StimulusGroupModeType stimulusmode, string stimfile, AurynFloat baserate)
Definition: StimulusGroup.cpp:34
Here is the call graph for this function:

◆ StimulusGroup() [2/2]

StimulusGroup::StimulusGroup ( NeuronID  n,
std::string  stimfile,
StimulusGroupModeType  stimulusmode = RANDOM,
AurynFloat  baserate = 1.0 
)

Constructor without pattern file. Patterns can be loaded afterwards using the load_patterns method.

Like the default constructor only that no patterns are specified. They have to be loaded afterwards using the load_patterns function.

Parameters
nSize of the group
stimfileThe path and filename of the output file used to record the stimulus timing.
stimulusmodeStimulus mode specifies in which order patterns are presented
baserateThe base firing rate with which all activity is multiplied.
116  : SpikingGroup( n ) // Load multiplier is an empirical value
117 {
118  init(stimulusmode, stimfile, baserate);
119 }
SpikingGroup(NeuronID size, NodeDistributionMode mode=AUTO)
Default constructor.
Definition: SpikingGroup.cpp:38
int n
Definition: mkpat.py:5
void init(StimulusGroupModeType stimulusmode, string stimfile, AurynFloat baserate)
Definition: StimulusGroup.cpp:34
Here is the call graph for this function:

◆ ~StimulusGroup()

StimulusGroup::~StimulusGroup ( )
virtual
122 {
123  delete [] ttl;
124  tiserfile.close();
125 }
AurynTime * ttl
Definition: StimulusGroup.h:65

Member Function Documentation

◆ clear_patterns()

void StimulusGroup::clear_patterns ( )
virtual

Clear stimulus patterns.

373 {
374  stimuli.clear();
375  stimulus_active = false ;
376 }
bool stimulus_active
Current stimulus active.
Definition: StimulusGroup.h:138
std::vector< type_pattern > stimuli
Vector containing all the stimuli.
Definition: StimulusGroup.h:142

◆ evolve()

void StimulusGroup::evolve ( )
virtual

Standard virtual evolve function.

Implements auryn::SpikingGroup.

Reimplemented in auryn::SpikeTimingStimGroup.

186 {
187  if ( !active ) return;
188 
189 
190  if ( stimulus_active ) { // during active stimulation
191 
192  if ( binary_patterns ) { // binary patterns
193  // detect and push spikes
194 
195  boost::exponential_distribution<> dist(curscale);
196  boost::variate_generator<boost::mt19937&, boost::exponential_distribution<> > die(poisson_gen, dist);
197 
199 
201  bgx = get_rank_size();
202 
203  while ( bgx < get_rank_size() || fgx < current.size() ) {
204  if ( fgx < current.size() && current.at(fgx).i < bgx ) {
205  push_spike ( current.at(fgx).i );
206  AurynDouble r = die();
207  fgx += 1+(NeuronID)(r/auryn_timestep);
208  } else {
209  push_spike ( bgx );
210 
211  boost::exponential_distribution<> bg_dist(background_rate);
212  boost::variate_generator<boost::mt19937&, boost::exponential_distribution<> > bg_die(poisson_gen, bg_dist);
213  AurynDouble r = bg_die();
214  bgx += 1+(NeuronID)(r/auryn_timestep);
215  }
216  }
218  bgx -= get_rank_size();
219 
220  if ( fgx >= current.size() )
221  fgx -= current.size();
222 
223  } else { // non-binary patterns --- using time-to-live TTL mechanism
224  boost::exponential_distribution<> dist(1.0);
225  boost::variate_generator<boost::mt19937&, boost::exponential_distribution<> > die(poisson_gen, dist);
226 
227  for ( NeuronID i = 0 ; i < get_rank_size() ; ++i )
228  {
229  if ( ttl[i] < auryn::sys->get_clock() && activity[i]>0.0 )
230  {
231  push_spike ( i );
233  }
234  }
235  }
236  } else { // while stimulation is off
237  if ( background_rate ) {
238  boost::exponential_distribution<> dist(background_rate);
239  boost::variate_generator<boost::mt19937&, boost::exponential_distribution<> > die(poisson_gen, dist);
240 
241  while ( bgx < get_rank_size() ) {
242  push_spike ( bgx );
243  AurynDouble r = die();
244  bgx += 1+(NeuronID)(r/auryn_timestep);
245  }
246  bgx -= get_rank_size();
247  }
248  }
249 
250  // update stimulus properties
251  if ( auryn::sys->get_clock() >= next_action_time ) { // action required
252  last_action_time = next_action_time; // store last time before updating next_action_time
253 
254  if ( get_num_stimuli() == 0 ) {
255  set_next_action_time(10); // TODO make this a bit smarter at some point -- i.e. could send this to the end of time
256  return;
257  }
258 
260 
261  // if we have variable rate stimuli update curscale otherwise set to scale
262  // this is only needed for binary stimuli -- otherwise the change is done in
263  // set_pattern_activity
266  } else {
267  curscale = scale;
268  }
269 
270  if ( stimulus_order == STIMFILE ) {
271  AurynDouble t = 0.0;
272  int a,i;
273  while ( t <= auryn::sys->get_time() ) {
276  if (a==0) stimulus_active = true;
277  else stimulus_active = false;
278  cur_stim_index = i;
279  // std::cout << auryn::sys->get_time() << " " << t << " " << a << " " << i << std::endl;
280  }
281  } else { // we have to generate stimulus times
282 
283  if ( stimulus_active ) { // stimulus was active and going inactive now
284 
285  if ( !binary_patterns )
286  set_all( 0.0 ); // turns off currently active stimulus
287  stimulus_active = false ;
289 
290  if ( randomintervals && mean_off_period>0.0 ) {
291  boost::exponential_distribution<> dist(1./mean_off_period);
292  boost::variate_generator<boost::mt19937&, boost::exponential_distribution<> > die(order_gen, dist);
293  next_action_time = auryn::sys->get_clock() + (AurynTime)(std::max(0.0,die())/auryn_timestep);
294  } else {
296  }
297  } else { // stimulus was not active and is going active now
298  if ( active && get_num_stimuli() ) { // the group is active and there are stimuli in the array
299 
300  // chooses stimulus according to schema specified in stimulusmode
301  double draw, cummulative;
302  switch ( stimulus_order ) {
303  case RANDOM:
304  // TODO make this less greedy
305  // and do not compute this every draw
306  draw = order_die();
307  cummulative = 0;
308  cur_stim_index = 0;
309  // std::cout.precision(5);
310  // std::cout << " draw " << draw << std::endl;
311  for ( unsigned int i = 0 ; i < probabilities.size() ; ++i ) {
312  cummulative += probabilities[i];
313  // std::cout << cummulative << std::endl;
314  if ( draw <= cummulative ) {
315  cur_stim_index = i;
316  break;
317  }
318  }
319  break;
320  case SEQUENTIAL:
322  break;
323  case SEQUENTIAL_REV:
324  --cur_stim_index;
325  if ( cur_stim_index <= 0 )
327  break;
328  case MANUAL:
329  default:
330  break;
331  }
332 
333  if ( !binary_patterns )
335  stimulus_active = true;
338 
340  boost::normal_distribution<> dist(mean_on_period,mean_on_period/3);
341  boost::variate_generator<boost::mt19937&, boost::normal_distribution<> > die(order_gen, dist);
342  next_action_time = auryn::sys->get_clock() + (AurynTime)(std::max(0.0,die())/auryn_timestep);
343  } else {
345  }
346  }
347  }
349  }
350  }
351 }
NeuronID get_rank_size()
Returns the size on this rank.
Definition: SpikingGroup.h:450
void write_stimulus_file(AurynDouble time)
Definition: StimulusGroup.cpp:162
r
Definition: mkpat.py:9
NeuronID bgx
Definition: StimulusGroup.h:80
int cur_stim_index
Current stimulus index.
Definition: StimulusGroup.h:133
AurynTime next_action_time
next stimulus time requiring change in rates
Definition: StimulusGroup.h:95
Definition: auryn_definitions.h:148
AurynFloat * activity
Definition: StimulusGroup.h:67
static boost::mt19937 order_gen
Definition: StimulusGroup.h:89
virtual unsigned int get_num_stimuli()
Returns number of stimuli.
Definition: StimulusGroup.cpp:618
static boost::uniform_01< boost::mt19937 > order_die
Definition: StimulusGroup.h:90
AurynFloat mean_on_period
Definition: StimulusGroup.h:125
AurynTime last_stim_offset_time
last stimulus offset time
Definition: StimulusGroup.h:104
AurynTime refractory_period
Enables a finite refractory time specified in AurynTime (only works for non-binary-pattern mode...
Definition: StimulusGroup.h:154
double AurynDouble
Higher precision floating point datatype.
Definition: auryn_definitions.h:158
StimulusGroupModeType stimulus_order
Definition: StimulusGroup.h:70
Definition: auryn_definitions.h:148
Definition: auryn_definitions.h:148
static boost::mt19937 poisson_gen
Definition: StimulusGroup.h:86
bool stimulus_active
Current stimulus active.
Definition: StimulusGroup.h:138
std::vector< pattern_member > type_pattern
Definition: auryn_definitions.h:177
AurynTime * ttl
Definition: StimulusGroup.h:65
bool active
Toggles group active.
Definition: SpikingGroup.h:149
bool randomintensities
Determines if the Group is using random activation intensities.
Definition: StimulusGroup.h:160
void set_next_action_time(double time)
Definition: StimulusGroup.cpp:559
AurynFloat mean_off_period
Definition: StimulusGroup.h:122
double auryn_timestep
Simulation timestep in seconds.
Definition: auryn_definitions.cpp:31
Definition: auryn_definitions.h:148
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
AurynTime last_stim_onset_time
last stimulus onset time
Definition: StimulusGroup.h:101
std::vector< double > probabilities
Definition: StimulusGroup.h:83
virtual void set_active_pattern(unsigned int i)
This function is called internally and sets the activity level to a given active stimulus.
Definition: StimulusGroup.cpp:495
void read_next_stimulus_from_file(AurynDouble &time, int &active, int &stimulusid)
Definition: StimulusGroup.cpp:174
std::vector< type_pattern > stimuli
Vector containing all the stimuli.
Definition: StimulusGroup.h:142
NeuronID fgx
Definition: StimulusGroup.h:77
AurynTime last_action_time
last stimulus time requiring change in rates
Definition: StimulusGroup.h:98
void set_all(AurynFloat val=0.0)
Sets sets the activity of all units.
Definition: StimulusGroup.cpp:358
AurynTime get_clock()
Gets the current clock value in AurynTime.
Definition: System.cpp:231
bool binary_patterns
Switches to more efficient algorithm which ignores the gamma value.
Definition: StimulusGroup.h:151
bool randomintervals
Determines if the Group is using random activation intervals.
Definition: StimulusGroup.h:157
AurynDouble background_rate
Play random Poisson noise with this rate on all channels when no stim is active.
Definition: StimulusGroup.h:164
Definition: auryn_definitions.h:148
unsigned int stimulation_count
Counter variable for number of stimuli shown.
Definition: StimulusGroup.h:74
bool background_during_stimulus
Switch for background firing during stimulus.
Definition: StimulusGroup.h:167
NeuronID AurynTime
Defines Auryns discrete time unit of the System clock. Change to AurynLong if 120h of simtime are not...
Definition: auryn_definitions.h:155
AurynFloat curscale
Definition: StimulusGroup.h:127
unsigned int NeuronID
NeuronID is an unsigned integeger type used to index neurons in Auryn.
Definition: auryn_definitions.h:151
AurynFloat scale
This is by how much the pattern gamma value is multiplied. The resulting value gives the x-times base...
Definition: StimulusGroup.h:148
Here is the call graph for this function:

◆ flat_distribution()

void StimulusGroup::flat_distribution ( )

Initialized distribution to be flat

529 {
530  for ( unsigned int i = 0 ; i < get_num_stimuli() ; ++i ) {
531  probabilities.push_back(1./((double)get_num_stimuli()));
532  }
533 }
virtual unsigned int get_num_stimuli()
Returns number of stimuli.
Definition: StimulusGroup.cpp:618
std::vector< double > probabilities
Definition: StimulusGroup.h:83
Here is the call graph for this function:

◆ get_activity()

AurynFloat StimulusGroup::get_activity ( NeuronID  i)

Gets the activity of unit i.

365 {
366  if ( localrank(i) )
367  return activity[global2rank(i)];
368  else
369  return 0;
370 }
bool localrank(NeuronID i)
Checks if the global NeuronID i is integrated on this MPI rank.
Definition: SpikingGroup.cpp:531
NeuronID global2rank(NeuronID i)
Converts global NeuronID within the SpikingGroup to the local NeuronID on this rank.
Definition: SpikingGroup.h:446
AurynFloat * activity
Definition: StimulusGroup.h:67
Here is the call graph for this function:

◆ get_cur_stim()

unsigned int StimulusGroup::get_cur_stim ( )

returns the index of the current (or last – if not active anymore) active stimulus

614 {
615  return cur_stim_index;
616 }
int cur_stim_index
Current stimulus index.
Definition: StimulusGroup.h:133

◆ get_distribution() [1/2]

std::vector< double > StimulusGroup::get_distribution ( )

Getter for pattern probability distribution.

519 {
520  return probabilities;
521 }
std::vector< double > probabilities
Definition: StimulusGroup.h:83

◆ get_distribution() [2/2]

double StimulusGroup::get_distribution ( int  i)

Getter for pattern i of the probability distribution.

524 {
525  return probabilities[i];
526 }
std::vector< double > probabilities
Definition: StimulusGroup.h:83

◆ get_last_action_time()

AurynTime StimulusGroup::get_last_action_time ( )

returns the last action (stim on/off) time in units of AurynTime

589 {
590  return last_action_time;
591 }
AurynTime last_action_time
last stimulus time requiring change in rates
Definition: StimulusGroup.h:98

◆ get_last_offset_time()

AurynTime StimulusGroup::get_last_offset_time ( )

returns the last stimulus offset time in units of AurynTime

604 {
605  return last_stim_offset_time;
606 }
AurynTime last_stim_offset_time
last stimulus offset time
Definition: StimulusGroup.h:104

◆ get_last_onset_time()

AurynTime StimulusGroup::get_last_onset_time ( )

returns the last stimulus onset time in units of AurynTime

599 {
600  return last_stim_onset_time;
601 }
AurynTime last_stim_onset_time
last stimulus onset time
Definition: StimulusGroup.h:101

◆ get_next_action_time()

AurynTime StimulusGroup::get_next_action_time ( )

returns the next action (stim on/off) time in units of AurynTime

594 {
595  return next_action_time;
596 }
AurynTime next_action_time
next stimulus time requiring change in rates
Definition: StimulusGroup.h:95

◆ get_num_stimuli()

unsigned int StimulusGroup::get_num_stimuli ( )
virtual

Returns number of stimuli.

619 {
620  return stimuli.size();
621 }
std::vector< type_pattern > stimuli
Vector containing all the stimuli.
Definition: StimulusGroup.h:142

◆ get_patterns()

std::vector< type_pattern > * StimulusGroup::get_patterns ( )
555 {
556  return &stimuli;
557 }
std::vector< type_pattern > stimuli
Vector containing all the stimuli.
Definition: StimulusGroup.h:142

◆ get_stim_active()

bool StimulusGroup::get_stim_active ( )

Returns true if currently a stimulus is active and false otherwise.

609 {
610  return stimulus_active;
611 }
bool stimulus_active
Current stimulus active.
Definition: StimulusGroup.h:138

◆ get_stim_count()

unsigned int StimulusGroup::get_stim_count ( )

Returns number of stimuli shown.

624 {
625  return stimulation_count;
626 }
unsigned int stimulation_count
Counter variable for number of stimuli shown.
Definition: StimulusGroup.h:74

◆ init()

void StimulusGroup::init ( StimulusGroupModeType  stimulusmode,
std::string  stimfile,
AurynFloat  baserate 
)
protected

Standard initialization

35 {
37  ttl = new AurynTime [get_rank_size()];
38 
39  refractory_period = 1; // initialize with a default of one timestep (avoids two spikes in same time bin)
40 
42  for ( NeuronID i = 0 ; i < get_rank_size() ; ++i ) activity[i] = 0.0;
43  set_baserate(baserate);
44 
45  seed(2351301);
46 
47 
48  set_stimulation_mode(stimulusmode);
49 
51  stimulus_active = false ;
52  set_all( 0.0 );
53 
54  randomintervals = true;
55  mean_off_period = 1.0 ;
56  mean_on_period = 0.2 ;
57 
58  randomintensities = false;
59  scale = 1.0; // TODO does this need to be initialized at 2 ?
60  curscale = scale;
61 
63 
64  background_rate = 0.0;
65  bgx = 0 ;
66 
67  fgx = 0 ;
68 
69 
70  binary_patterns = false;
71 
72  // if a filename was supplied and we are
73  // not supposed to be reading from it.
74  if ( !stimfile.empty() && stimulus_order != STIMFILE )
75  {
76  tiserfile.open(stimfile.c_str(),std::ios::out);
77  tiserfile.setf(std::ios::fixed);
78  } else {
79  if (stimulus_order==STIMFILE) {
80  tiserfile.open(stimfile.c_str(),std::ios::in);
81  }
82  }
83 
84  if (!tiserfile) {
85  std::stringstream oss;
86  oss << "StimulusGroup:: Cannot open stimulus file "
87  << stimfile
88  << " for ";
89  if (stimulus_order==STIMFILE) oss << "reading.";
90  else oss << "writing.";
91 
92  auryn::logger->msg(oss.str(),ERROR);
93  throw AurynOpenFileException();
94  }
95 
96  std::stringstream oss;
97  oss << "StimulusGroup:: "
98  << "size " << get_size() << " "
99  << "(mode " << stimulus_order << ") ";
100  auryn::logger->msg(oss.str(),INFO);
101 
102  cur_stim_index = 0;
103  next_action_time = 0;
104  last_action_time = 0;
105  active = true;
106  off_pattern = -1;
107 
108 }
void set_stimulation_mode(StimulusGroupModeType mode)
Sets the stimulation mode. Can be any of StimulusGroupModeType (MANUAL,RANDOM,SEQUENTIAL,SEQUENTIAL_REV).
Definition: StimulusGroup.cpp:563
NeuronID get_rank_size()
Returns the size on this rank.
Definition: SpikingGroup.h:450
NeuronID bgx
Definition: StimulusGroup.h:80
int cur_stim_index
Current stimulus index.
Definition: StimulusGroup.h:133
AurynTime next_action_time
next stimulus time requiring change in rates
Definition: StimulusGroup.h:95
void set_baserate(AurynFloat baserate)
Sets the baserate that is the rate at 1 activity.
Definition: StimulusGroup.cpp:138
AurynFloat * activity
Definition: StimulusGroup.h:67
void seed(int rndseed)
Seeds the random number generator for all stimulus groups of the simulation.
Definition: StimulusGroup.cpp:567
AurynFloat mean_on_period
Definition: StimulusGroup.h:125
AurynTime refractory_period
Enables a finite refractory time specified in AurynTime (only works for non-binary-pattern mode...
Definition: StimulusGroup.h:154
StimulusGroupModeType stimulus_order
Definition: StimulusGroup.h:70
bool stimulus_active
Current stimulus active.
Definition: StimulusGroup.h:138
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
Definition: auryn_definitions.h:208
AurynTime * ttl
Definition: StimulusGroup.h:65
bool active
Toggles group active.
Definition: SpikingGroup.h:149
bool randomintensities
Determines if the Group is using random activation intensities.
Definition: StimulusGroup.h:160
AurynFloat mean_off_period
Definition: StimulusGroup.h:122
Definition: auryn_definitions.h:148
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
Definition: Logger.h:41
NeuronID fgx
Definition: StimulusGroup.h:77
void register_spiking_group(SpikingGroup *spiking_group)
Registers an instance of SpikingGroup to the spiking_groups vector.
Definition: System.cpp:261
AurynTime last_action_time
last stimulus time requiring change in rates
Definition: StimulusGroup.h:98
NeuronID get_size()
Returns the size of the group.
Definition: SpikingGroup.cpp:304
void set_all(AurynFloat val=0.0)
Sets sets the activity of all units.
Definition: StimulusGroup.cpp:358
void msg(std::string text, LogMessageType type=NOTIFICATION, bool global=false, int line=-1, std::string srcfile="")
Definition: Logger.cpp:74
Definition: Logger.h:41
bool binary_patterns
Switches to more efficient algorithm which ignores the gamma value.
Definition: StimulusGroup.h:151
bool randomintervals
Determines if the Group is using random activation intervals.
Definition: StimulusGroup.h:157
AurynDouble background_rate
Play random Poisson noise with this rate on all channels when no stim is active.
Definition: StimulusGroup.h:164
unsigned int stimulation_count
Counter variable for number of stimuli shown.
Definition: StimulusGroup.h:74
bool background_during_stimulus
Switch for background firing during stimulus.
Definition: StimulusGroup.h:167
NeuronID AurynTime
Defines Auryns discrete time unit of the System clock. Change to AurynLong if 120h of simtime are not...
Definition: auryn_definitions.h:155
AurynFloat curscale
Definition: StimulusGroup.h:127
unsigned int NeuronID
NeuronID is an unsigned integeger type used to index neurons in Auryn.
Definition: auryn_definitions.h:151
AurynFloat scale
This is by how much the pattern gamma value is multiplied. The resulting value gives the x-times base...
Definition: StimulusGroup.h:148
Here is the call graph for this function:

◆ load_patterns()

void StimulusGroup::load_patterns ( std::string  filename)
virtual

Loads stimulus patterns from a designated pat file given.

Parameters
filenameThe path and filename of the pat file to laod.
379 {
380  std::ifstream fin (filename.c_str());
381  if (!fin) {
382  std::stringstream oss;
383  oss << "StimulusGroup:: "
384  << "There was a problem opening file "
385  << filename
386  << " for reading."
387  << std::endl;
388  auryn::logger->msg(oss.str(),ERROR);
389  throw AurynOpenFileException();
390  }
391 
392  char buffer[256];
393  std::string line;
394 
395  clear_patterns();
396 
397  type_pattern pattern;
398  int total_pattern_size = 0;
399  while(!fin.eof()) {
400 
401  line.clear();
402  fin.getline (buffer,255);
403  line = buffer;
404 
405  if (line[0] == '#') continue;
406  if (line == "") {
407  if ( total_pattern_size > 0 ) {
408  std::stringstream oss;
409  oss << "StimulusGroup:: Read pattern "
410  << get_num_stimuli()
411  << " with pattern size "
412  << total_pattern_size
413  << " ( "
414  << pattern.size()
415  << " on rank )";
416  auryn::logger->msg(oss.str(),VERBOSE);
417 
418  stimuli.push_back(pattern);
419  pattern.clear();
420  total_pattern_size = 0;
421  }
422  continue;
423  }
424 
425  std::stringstream iss (line);
426  NeuronID i ;
427  iss >> i ;
428  if ( localrank( i ) ) {
429  pattern_member pm;
430  pm.gamma = 1.0 ;
431  iss >> pm.gamma ;
432  pm.i = global2rank( i ) ;
433  pattern.push_back( pm ) ;
434  }
435  total_pattern_size++;
436  }
437 
438  fin.close();
439 
440  // initializing all probabilities as a flat distribution
442 
443  std::stringstream oss;
444  oss << "StimulusGroup:: Finished loading " << get_num_stimuli() << " patterns";
445  auryn::logger->msg(oss.str(),NOTIFICATION);
446 }
NeuronID i
Definition: auryn_definitions.h:173
bool localrank(NeuronID i)
Checks if the global NeuronID i is integrated on this MPI rank.
Definition: SpikingGroup.cpp:531
NeuronID global2rank(NeuronID i)
Converts global NeuronID within the SpikingGroup to the local NeuronID on this rank.
Definition: SpikingGroup.h:446
virtual unsigned int get_num_stimuli()
Returns number of stimuli.
Definition: StimulusGroup.cpp:618
Definition: Logger.h:41
std::vector< pattern_member > type_pattern
Definition: auryn_definitions.h:177
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
Definition: auryn_definitions.h:208
void flat_distribution()
Definition: StimulusGroup.cpp:528
virtual void clear_patterns()
Clear stimulus patterns.
Definition: StimulusGroup.cpp:372
AurynDouble gamma
Definition: auryn_definitions.h:174
Definition: Logger.h:41
std::vector< type_pattern > stimuli
Vector containing all the stimuli.
Definition: StimulusGroup.h:142
Definition: Logger.h:41
void msg(std::string text, LogMessageType type=NOTIFICATION, bool global=false, int line=-1, std::string srcfile="")
Definition: Logger.cpp:74
Struct used to define neuronal assembly patterns in SparseConnection.
Definition: auryn_definitions.h:172
std::string string
Standard library string type which is imported into Auryn namespace.
Definition: auryn_definitions.h:156
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:

◆ normalize_distribution()

void StimulusGroup::normalize_distribution ( )

Normalizes the distribution

536 {
537  std::stringstream oss;
538  oss << "StimulusGroup: Normalizing distribution [";
539  double sum = 0 ;
540  for ( unsigned int i = 0 ; i < get_num_stimuli() ; ++i ) {
541  sum += probabilities[i];
542  }
543 
544  // normalize vector
545  for ( unsigned int i = 0 ; i < get_num_stimuli() ; ++i ) {
546  probabilities[i] /= sum;
547  oss << " " << probabilities[i];
548  }
549 
550  oss << " ]";
551  auryn::logger->msg(oss.str(),VERBOSE);
552 }
virtual unsigned int get_num_stimuli()
Returns number of stimuli.
Definition: StimulusGroup.cpp:618
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
std::vector< double > probabilities
Definition: StimulusGroup.h:83
Definition: Logger.h:41
void msg(std::string text, LogMessageType type=NOTIFICATION, bool global=false, int line=-1, std::string srcfile="")
Definition: Logger.cpp:74
Here is the call graph for this function:

◆ read_next_stimulus_from_file()

void StimulusGroup::read_next_stimulus_from_file ( AurynDouble time,
int &  active,
int &  stimulusid 
)
protected

Read current stimulus status from stimfile

174  {
175  char buffer[256];
176  if ( tiserfile.getline (buffer,256) ) {
177  sscanf (buffer,"%lf %i %i",&time,&active,&stimulusid);
178  } else {
179  time = auryn::sys->get_time()+1000; // TODO this is a bit weird as a condition but should do the job
180  active = 0;
181  stimulusid = 0;
182  }
183 }
bool active
Toggles group active.
Definition: SpikingGroup.h:149
System * sys
Global pointer to instance of System which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:37
AurynDouble get_time()
Gets the current system time in [s].
Definition: System.cpp:226
Here is the call graph for this function:

◆ redraw()

void StimulusGroup::redraw ( )
protectedvirtual

Draw all Time-To-Live (ttls) typically after changing the any of the activiteis

Reimplemented in auryn::SpikeTimingStimGroup.

128 {
129  boost::exponential_distribution<> dist(1.0);
130  boost::variate_generator<boost::mt19937&, boost::exponential_distribution<> > die(poisson_gen, dist);
131  for ( NeuronID i = 0 ; i < get_rank_size() ; ++i )
132  {
133  if (activity[i]>0)
135  }
136 }
NeuronID get_rank_size()
Returns the size on this rank.
Definition: SpikingGroup.h:450
AurynFloat * activity
Definition: StimulusGroup.h:67
static boost::mt19937 poisson_gen
Definition: StimulusGroup.h:86
AurynTime * ttl
Definition: StimulusGroup.h:65
double auryn_timestep
Simulation timestep in seconds.
Definition: auryn_definitions.cpp:31
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
AurynTime get_clock()
Gets the current clock value in AurynTime.
Definition: System.cpp:231
NeuronID AurynTime
Defines Auryns discrete time unit of the System clock. Change to AurynLong if 120h of simtime are not...
Definition: auryn_definitions.h:155
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:

◆ seed()

void StimulusGroup::seed ( int  rndseed)

Seeds the random number generator for all stimulus groups of the simulation.

568 {
569  unsigned int rnd = rndseed + sys->get_synced_seed(); // most be same on all ranks
570  order_gen.seed(rnd);
571 
572  // this is here because the seeding above alone does not seem to do anything
573  // also need to overwrite the dist operator because it makes of copy of the
574  // generator
575  // see http://www.bnikolic.co.uk/blog/cpp-boost-uniform01.html
576  order_die = boost::uniform_01<boost::mt19937> (order_gen);
577 
578  rnd = rndseed + sys->get_seed(); // adds salt to make it different across ranks
579  std::stringstream oss;
580  oss << "StimulusGroup:: "
581  << "seeding Poisson generator with "
582  << rnd;
583  auryn::logger->msg(oss.str(),VERBOSE);
584 
585  poisson_gen.seed(rnd); // is now drawn differently but reproducibly so for each rank
586 }
unsigned int get_seed()
Returns a random seed which is different on each rank.
Definition: System.cpp:1030
static boost::mt19937 order_gen
Definition: StimulusGroup.h:89
static boost::uniform_01< boost::mt19937 > order_die
Definition: StimulusGroup.h:90
static boost::mt19937 poisson_gen
Definition: StimulusGroup.h:86
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
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
Definition: Logger.h:41
void msg(std::string text, LogMessageType type=NOTIFICATION, bool global=false, int line=-1, std::string srcfile="")
Definition: Logger.cpp:74
Here is the call graph for this function:

◆ set_active_pattern() [1/2]

void StimulusGroup::set_active_pattern ( unsigned int  i)
virtual

This function is called internally and sets the activity level to a given active stimulus.

Parameters
ithe index of the pattern to set the activity to
496 {
498 }
virtual void set_active_pattern(unsigned int i)
This function is called internally and sets the activity level to a given active stimulus.
Definition: StimulusGroup.cpp:495
AurynDouble background_rate
Play random Poisson noise with this rate on all channels when no stim is active.
Definition: StimulusGroup.h:164

◆ set_active_pattern() [2/2]

void StimulusGroup::set_active_pattern ( unsigned int  i,
AurynFloat  default_value 
)

This function is called internally and sets the activity level to a given active stimulus.

Parameters
iThe index of the pattern to set the activity to
default_valueThe value to assign to the activity values which are not specified in the pattern file. Typically this corresponds to some background value.
483 {
484  std::stringstream oss;
485  oss << "StimulusGroup:: Setting active pattern " << i ;
486  auryn::logger->msg(oss.str(),VERBOSE);
487 
488  set_all( default_value );
489  if ( i < get_num_stimuli() ) {
491  }
492  redraw();
493 }
void set_pattern_activity(unsigned int i)
Function that loops over the stimulus/pattern vector and sets the activity verctor to the gamma value...
Definition: StimulusGroup.cpp:448
virtual unsigned int get_num_stimuli()
Returns number of stimuli.
Definition: StimulusGroup.cpp:618
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
void set_all(AurynFloat val=0.0)
Sets sets the activity of all units.
Definition: StimulusGroup.cpp:358
Definition: Logger.h:41
void msg(std::string text, LogMessageType type=NOTIFICATION, bool global=false, int line=-1, std::string srcfile="")
Definition: Logger.cpp:74
virtual void redraw()
Definition: StimulusGroup.cpp:127
Here is the call graph for this function:

◆ set_activity()

void StimulusGroup::set_activity ( NeuronID  i,
AurynFloat  val = 0.0 
)
protected

Sets the activity for a given unit on the local rank. Activity determines the freq as baserate*activity

354 {
355  activity[i] = val;
356 }
AurynFloat * activity
Definition: StimulusGroup.h:67

◆ set_all()

void StimulusGroup::set_all ( AurynFloat  val = 0.0)

Sets sets the activity of all units.

359 {
360  for ( NeuronID i = 0 ; i < get_rank_size() ; ++i )
361  set_activity(i,val);
362 }
NeuronID get_rank_size()
Returns the size on this rank.
Definition: SpikingGroup.h:450
void set_activity(NeuronID i, AurynFloat val=0.0)
Definition: StimulusGroup.cpp:353
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:

◆ set_baserate()

void StimulusGroup::set_baserate ( AurynFloat  baserate)

Sets the baserate that is the rate at 1 activity.

139 {
140  base_rate = baserate;
141  redraw();
142  auryn::logger->parameter("StimulusGroup:: baserate",baserate);
143 }
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
virtual void redraw()
Definition: StimulusGroup.cpp:127
Here is the call graph for this function:

◆ set_distribution()

void StimulusGroup::set_distribution ( std::vector< double >  probs)

Setter for pattern probability distribution.

502 {
503  for ( unsigned int i = 0 ; i < get_num_stimuli() ; ++i ) {
504  probabilities[i] = probs[i];
505  }
506 
508 
509  std::stringstream oss;
510  oss << "StimulusGroup: Set distribution [";
511  for ( unsigned int i = 0 ; i < get_num_stimuli() ; ++i ) {
512  oss << " " << probabilities[i];
513  }
514  oss << " ]";
515  auryn::logger->msg(oss.str(),NOTIFICATION);
516 }
virtual unsigned int get_num_stimuli()
Returns number of stimuli.
Definition: StimulusGroup.cpp:618
Definition: Logger.h:41
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
void normalize_distribution()
Definition: StimulusGroup.cpp:535
std::vector< double > probabilities
Definition: StimulusGroup.h:83
void msg(std::string text, LogMessageType type=NOTIFICATION, bool global=false, int line=-1, std::string srcfile="")
Definition: Logger.cpp:74
Here is the call graph for this function:

◆ set_maxrate()

void StimulusGroup::set_maxrate ( AurynFloat  baserate)

TODO.

Todo:
Deprecated:
remove this function since it's deprecated
146 {
147  set_baserate(baserate);
148 }
void set_baserate(AurynFloat baserate)
Sets the baserate that is the rate at 1 activity.
Definition: StimulusGroup.cpp:138
Here is the call graph for this function:

◆ set_mean_off_period()

void StimulusGroup::set_mean_off_period ( AurynFloat  period)

Set mean quiet interval between consecutive stimuli.

151 {
152  mean_off_period = period;
153  auryn::logger->parameter("StimulusGroup:: mean_off_period",mean_off_period);
154 }
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
AurynFloat mean_off_period
Definition: StimulusGroup.h:122
Here is the call graph for this function:

◆ set_mean_on_period()

void StimulusGroup::set_mean_on_period ( AurynFloat  period)

Set mean on period.

157 {
158  mean_on_period = period;
159  auryn::logger->parameter("StimulusGroup:: mean_on_period",mean_on_period);
160 }
void parameter(std::string name, T value)
Definition: Logger.h:90
AurynFloat mean_on_period
Definition: StimulusGroup.h:125
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
Here is the call graph for this function:

◆ set_next_action_time()

void StimulusGroup::set_next_action_time ( double  time)
559  {
561 }
AurynTime next_action_time
next stimulus time requiring change in rates
Definition: StimulusGroup.h:95
double auryn_timestep
Simulation timestep in seconds.
Definition: auryn_definitions.cpp:31
System * sys
Global pointer to instance of System which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:37
AurynTime get_clock()
Gets the current clock value in AurynTime.
Definition: System.cpp:231
Here is the call graph for this function:

◆ set_pattern_activity() [1/2]

void StimulusGroup::set_pattern_activity ( unsigned int  i)

Function that loops over the stimulus/pattern vector and sets the activity verctor to the gamma values given with the pattern.

449 {
450  type_pattern current = stimuli[i];
451  type_pattern::iterator iter;
452 
453  AurynFloat addrate = 0.0;
455  addrate = background_rate;
456 
458  if ( randomintensities ) {
459  boost::exponential_distribution<> dist(1.);
460  boost::variate_generator<boost::mt19937&, boost::exponential_distribution<> > die(order_gen, dist);
461  curscale *= (AurynFloat)die();
462  }
463 
464  for ( iter = current.begin() ; iter != current.end() ; ++iter )
465  {
466  set_activity(iter->i,curscale*iter->gamma+addrate);
467  }
468 }
static boost::mt19937 order_gen
Definition: StimulusGroup.h:89
std::vector< pattern_member > type_pattern
Definition: auryn_definitions.h:177
bool randomintensities
Determines if the Group is using random activation intensities.
Definition: StimulusGroup.h:160
void set_activity(NeuronID i, AurynFloat val=0.0)
Definition: StimulusGroup.cpp:353
float AurynFloat
Low precision floating point datatype.
Definition: auryn_definitions.h:157
std::vector< type_pattern > stimuli
Vector containing all the stimuli.
Definition: StimulusGroup.h:142
AurynDouble background_rate
Play random Poisson noise with this rate on all channels when no stim is active.
Definition: StimulusGroup.h:164
bool background_during_stimulus
Switch for background firing during stimulus.
Definition: StimulusGroup.h:167
AurynFloat curscale
Definition: StimulusGroup.h:127
AurynFloat scale
This is by how much the pattern gamma value is multiplied. The resulting value gives the x-times base...
Definition: StimulusGroup.h:148
Here is the call graph for this function:

◆ set_pattern_activity() [2/2]

void StimulusGroup::set_pattern_activity ( unsigned int  i,
AurynFloat  setval 
)

Function that loops over the stimulus/pattern vector and sets the activity verctor to the given value.

471 {
472  type_pattern current = stimuli[i];
473  type_pattern::iterator iter;
474 
475  for ( iter = current.begin() ; iter != current.end() ; ++iter )
476  {
477  set_activity(iter->i,setrate);
478  }
479 }
std::vector< pattern_member > type_pattern
Definition: auryn_definitions.h:177
void set_activity(NeuronID i, AurynFloat val=0.0)
Definition: StimulusGroup.cpp:353
std::vector< type_pattern > stimuli
Vector containing all the stimuli.
Definition: StimulusGroup.h:142
Here is the call graph for this function:

◆ set_stimulation_mode()

void StimulusGroup::set_stimulation_mode ( StimulusGroupModeType  mode)

Sets the stimulation mode. Can be any of StimulusGroupModeType (MANUAL,RANDOM,SEQUENTIAL,SEQUENTIAL_REV).

563  {
564  stimulus_order = mode ;
565 }
StimulusGroupModeType stimulus_order
Definition: StimulusGroup.h:70

◆ write_stimulus_file()

void StimulusGroup::write_stimulus_file ( AurynDouble  time)
protected

write current stimulus to stimfile

162  {
163  if ( tiserfile && stimulus_order != STIMFILE ) {
164  tiserfile
165  << time
166  << " ";
167  if ( stimulus_active || off_pattern > -1 ) tiserfile << "1 "; else tiserfile << "0 ";
168  tiserfile
169  << cur_stim_index
170  << std::endl;
171  }
172 }
int cur_stim_index
Current stimulus index.
Definition: StimulusGroup.h:133
StimulusGroupModeType stimulus_order
Definition: StimulusGroup.h:70
bool stimulus_active
Current stimulus active.
Definition: StimulusGroup.h:138
Definition: auryn_definitions.h:148

Member Data Documentation

◆ activity

AurynFloat* auryn::StimulusGroup::activity
protected

◆ background_during_stimulus

bool auryn::StimulusGroup::background_during_stimulus

Switch for background firing during stimulus.

◆ background_rate

AurynDouble auryn::StimulusGroup::background_rate

Play random Poisson noise with this rate on all channels when no stim is active.

◆ bgx

NeuronID auryn::StimulusGroup::bgx
protected

Background Poisson field pointer

◆ binary_patterns

bool auryn::StimulusGroup::binary_patterns

Switches to more efficient algorithm which ignores the gamma value.

◆ cur_stim_index

int auryn::StimulusGroup::cur_stim_index

Current stimulus index.

Do not write this variable.

◆ curscale

AurynFloat auryn::StimulusGroup::curscale
protected

◆ fgx

NeuronID auryn::StimulusGroup::fgx
protected

Foreground Poisson field pointer

◆ last_action_time

AurynTime auryn::StimulusGroup::last_action_time
protected

last stimulus time requiring change in rates

◆ last_stim_offset_time

AurynTime auryn::StimulusGroup::last_stim_offset_time
protected

last stimulus offset time

◆ last_stim_onset_time

AurynTime auryn::StimulusGroup::last_stim_onset_time
protected

last stimulus onset time

◆ mean_off_period

AurynFloat auryn::StimulusGroup::mean_off_period
protected

allow silence/background activity periods

◆ mean_on_period

AurynFloat auryn::StimulusGroup::mean_on_period
protected

mean presentation time

◆ next_action_time

AurynTime auryn::StimulusGroup::next_action_time
protected

next stimulus time requiring change in rates

◆ order_die

boost::uniform_01< boost::mt19937 > StimulusGroup::order_die = boost::uniform_01<boost::mt19937> (order_gen)
staticprotected

◆ order_gen

boost::mt19937 StimulusGroup::order_gen = boost::mt19937()
staticprotected

generates info for what stimulus is active. Is supposed to give the same result on all nodes (hence same seed required)

◆ poisson_gen

boost::mt19937 StimulusGroup::poisson_gen = boost::mt19937()
staticprotected

pseudo random number generators

◆ probabilities

std::vector<double> auryn::StimulusGroup::probabilities
protected

stimulus probabilities

◆ randomintensities

bool auryn::StimulusGroup::randomintensities

Determines if the Group is using random activation intensities.

◆ randomintervals

bool auryn::StimulusGroup::randomintervals

Determines if the Group is using random activation intervals.

◆ refractory_period

AurynTime auryn::StimulusGroup::refractory_period

Enables a finite refractory time specified in AurynTime (only works for non-binary-pattern mode.

◆ scale

AurynFloat auryn::StimulusGroup::scale

This is by how much the pattern gamma value is multiplied. The resulting value gives the x-times baseline activation.

◆ stimulation_count

unsigned int auryn::StimulusGroup::stimulation_count
protected

Counter variable for number of stimuli shown.

◆ stimuli

std::vector<type_pattern> auryn::StimulusGroup::stimuli

Vector containing all the stimuli.

◆ stimulus_active

bool auryn::StimulusGroup::stimulus_active

Current stimulus active.

Only read this state.

◆ stimulus_order

StimulusGroupModeType auryn::StimulusGroup::stimulus_order
protected

Stimulus order

◆ ttl

AurynTime* auryn::StimulusGroup::ttl
protected

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