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

Stimulator class to add values in each timestep to arbitrary neuronal states. More...

#include <CurrentInjector.h>

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

Public Member Functions

 CurrentInjector (NeuronGroup *target, std::string neuron_state_name="mem", AurynFloat initial_current=0.0)
 Default Constructor. More...
 
void set_target_state (std::string state_name="mem")
 Sets the state to add the "current" in every timestep to. More...
 
virtual ~CurrentInjector ()
 Default Destructor. More...
 
void set_current (NeuronID i, AurynFloat current)
 Sets current strengh for neuron i. More...
 
void set_all_currents (AurynFloat current)
 Sets current strength for all neurons. More...
 
void execute ()
 

Protected Attributes

NeuronGroupdst
 
- Protected Attributes inherited from auryn::Device
std::string device_name
 Identifying name for device. More...
 
bool active
 Standard active switch. More...
 

Additional Inherited Members

- Protected Member Functions inherited from auryn::Device
void init ()
 Standard initializer to be called by the constructor. More...
 
virtual void virtual_serialize (boost::archive::binary_oarchive &ar, const unsigned int version)
 
virtual void virtual_serialize (boost::archive::binary_iarchive &ar, const unsigned int version)
 
 Device ()
 Standard constructor. More...
 
void set_name (std::string s)
 Set device name. More...
 
std::string get_name ()
 Get device name. More...
 
int get_id ()
 Get numeric device id. More...
 
virtual void flush ()
 Flush to file. More...
 
virtual ~Device ()
 Standard destructor. More...
 
virtual void evolve ()
 

Detailed Description

Stimulator class to add values in each timestep to arbitrary neuronal states.

Most commonly used to inject "currents" to arbitraty neuronal states. Maintains an internal vector with numbers which are added (times auryn_timestep) in each timestep to the neuronal target vector (per default that is the membrane voltage and hence the operation corresponds to injecting a current). Note that because of this current units of CurrentInjector are in a sense arbitrary because they depend on the neuron model.

Constructor & Destructor Documentation

◆ CurrentInjector()

CurrentInjector::CurrentInjector ( NeuronGroup target,
std::string  neuron_state_name = "mem",
AurynFloat  initial_current = 0.0 
)

Default Constructor.

Parameters
30  : Device( )
31 {
33  dst = target;
34 
35  set_target_state(neuron_state_name);
36  currents = new AurynVectorFloat(dst->get_vector_size());
37 
38  currents->set_all( initial_current );
39  alpha = auryn_timestep;
40 }
void set_target_state(std::string state_name="mem")
Sets the state to add the "current" in every timestep to.
Definition: CurrentInjector.cpp:70
NeuronGroup * dst
Definition: CurrentInjector.h:70
void set_all(const T v)
Set all elements to value v.
Definition: AurynVector.h:232
Device()
Standard constructor.
Definition: Device.cpp:41
void register_device(Device *device)
Registers an instance of Device to the devices vector.
Definition: System.cpp:272
NeuronID get_vector_size()
Rank size but rounded up to multiples of 4 (or potentially some other and larger number in future ver...
Definition: SpikingGroup.cpp:901
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
Default AurynVectorFloat class for performance computation.
Definition: AurynVector.h:796
Here is the call graph for this function:

◆ ~CurrentInjector()

CurrentInjector::~CurrentInjector ( )
virtual

Default Destructor.

51 {
52  free();
53 }

Member Function Documentation

◆ execute()

void CurrentInjector::execute ( )
virtual

Implementation of necessary propagate() function.

Reimplemented from auryn::Device.

56 {
57  if ( dst->evolve_locally() ) {
58  target_vector->saxpy(alpha, currents);
59  }
60 }
NeuronGroup * dst
Definition: CurrentInjector.h:70
bool evolve_locally()
Returns true if the calling instance has units which are integrated on the current rank...
Definition: SpikingGroup.cpp:323
void saxpy(const float a, AurynVectorFloat *x)
Definition: AurynVector.cpp:96
Here is the call graph for this function:

◆ set_all_currents()

void CurrentInjector::set_all_currents ( AurynFloat  current)

Sets current strength for all neurons.

This must be a valid state vector name (default = mem)

Parameters
currentCurrent value to set
66  {
67  currents->set_all(current);
68 }
void set_all(const T v)
Set all elements to value v.
Definition: AurynVector.h:232
Here is the call graph for this function:

◆ set_current()

void CurrentInjector::set_current ( NeuronID  i,
AurynFloat  current 
)

Sets current strengh for neuron i.

This must be a valid state vector name (default = mem)

Parameters
iIndex of neuron
currentCurrent value to set
62  {
63  currents->set(i, current);
64 }
void set(IndexType i, T value)
Sets element i in vector to value.
Definition: AurynVector.h:224
Here is the call graph for this function:

◆ set_target_state()

void CurrentInjector::set_target_state ( std::string  state_name = "mem")

Sets the state to add the "current" in every timestep to.

70  {
71  target_vector = dst->get_state_vector(state_name);
72 }
NeuronGroup * dst
Definition: CurrentInjector.h:70
AurynStateVector * get_state_vector(std::string key)
Creates a new or returns an existing state vector by name.
Definition: SpikingGroup.cpp:781
Here is the call graph for this function:

Member Data Documentation

◆ dst

NeuronGroup* auryn::CurrentInjector::dst
protected

The target NeuronGroup


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