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

Records the membrane potential from one unit from the source neuron group to a file. More...

#include <VoltageMonitor.h>

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

Public Member Functions

 VoltageMonitor (NeuronGroup *source, NeuronID id, string filename, AurynDouble stepsize=auryn_timestep)
 
virtual ~VoltageMonitor ()
 
void execute ()
 
- Public Member Functions inherited from auryn::StateMonitor
 StateMonitor (SpikingGroup *source, NeuronID id, string statename, string filename, AurynDouble sampling_interval=auryn_timestep)
 Standard constructor. More...
 
 StateMonitor (AurynStateVector *state, NeuronID id, string filename, AurynDouble sampling_interval=auryn_timestep)
 Alternative constructor. More...
 
 StateMonitor (AurynSynStateVector *state, NeuronID id, string filename, AurynDouble sampling_interval=auryn_timestep)
 Alternative constructor for synaptic states. More...
 
 StateMonitor (Trace *trace, NeuronID id, string filename, AurynDouble sampling_interval=auryn_timestep)
 Trace constructor. More...
 
void record_for (AurynDouble time=10.0)
 Sets relative time at which to stop recording. More...
 
void set_stop_time (AurynDouble time=10.0)
 Set an absolute time when to stop recording. More...
 
void set_step_size (int step=1)
 Sets the step size. More...
 
virtual ~StateMonitor ()
 
- Public Member Functions inherited from auryn::Monitor
virtual void flush ()
 Flush to file. More...
 
 Monitor (std::string filename, std::string default_extension="dat")
 Standard constructor with file name. More...
 
 Monitor ()
 Constructor which does not open a text file for output. More...
 
std::string generate_filename (std::string name_hint="")
 Generates a default filename from the device ID. More...
 
virtual ~Monitor ()
 Standard destructor. More...
 
- Public Member Functions inherited from auryn::Device
 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 ~Device ()
 Standard destructor. More...
 
virtual void evolve ()
 

Public Attributes

AurynTime paste_spikes
 Paste spikes switch (default = true) More...
 
- Public Attributes inherited from auryn::StateMonitor
bool enable_compression
 Switch to enable/disable output compression. More...
 
- Public Attributes inherited from auryn::Monitor
bool active
 Standard active switch. More...
 
- Public Attributes inherited from auryn::Device
bool active
 Standard active switch. More...
 

Protected Member Functions

void init ()
 Standard initialization. More...
 
- Protected Member Functions inherited from auryn::StateMonitor
void init (string filename, AurynDouble stepsize)
 Standard initialization. More...
 
- Protected Member Functions inherited from auryn::Monitor
virtual void open_output_file (std::string filename)
 
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)
 
- Protected Member Functions inherited from auryn::Device
void init ()
 Standard initializer to be called by the constructor. More...
 

Additional Inherited Members

- Protected Attributes inherited from auryn::StateMonitor
SpikingGroupsrc
 The source SpikingGroup to record from. More...
 
AurynStatetarget_variable
 Target variable. More...
 
AurynState lastval
 Last value (used for compression) More...
 
AurynState lastder
 
NeuronID nid
 The source neuron id to record from. More...
 
AurynTime ssize
 The step size (sampling interval) in units of auryn_timestep. More...
 
AurynTime t_stop
 Defines the maximum recording time in AurynTime to save space. More...
 
- Protected Attributes inherited from auryn::Monitor
std::ofstream outfile
 
std::string fname
 
std::string default_file_extension
 
- Protected Attributes inherited from auryn::Device
std::string device_name
 Identifying name for device. More...
 

Detailed Description

Records the membrane potential from one unit from the source neuron group to a file.

The Monitor records the membrane potential of a single cell from a NeuronGroup. Per default the timestep is simulator precision and the Monitor pastes a spike of height VOLTAGEMONITOR_PASTED_SPIKE_HEIGHT by reading out the the current spikes. For performance it is adviced to use the StateMonitor which does not do any spike pasting.

Constructor & Destructor Documentation

◆ VoltageMonitor()

VoltageMonitor::VoltageMonitor ( NeuronGroup source,
NeuronID  id,
std::string  filename,
AurynDouble  stepsize = auryn_timestep 
)
30  : StateMonitor(source, id, "mem", filename, stepsize)
31 {
32  if ( !source->localrank(id) ) return; // do not anything if the neuron is not on the local rank
33  gid = id; // we also need the global id to scan for spikes, but StateMonitor only sets the rank id (nid)
34  init();
35 }
void init()
Standard initialization.
Definition: VoltageMonitor.cpp:41
bool localrank(NeuronID i)
Checks if the global NeuronID i is integrated on this MPI rank.
Definition: SpikingGroup.cpp:531
StateMonitor(SpikingGroup *source, NeuronID id, string statename, string filename, AurynDouble sampling_interval=auryn_timestep)
Standard constructor.
Definition: StateMonitor.cpp:31
Here is the call graph for this function:

◆ ~VoltageMonitor()

VoltageMonitor::~VoltageMonitor ( )
virtual
38 {
39 }

Member Function Documentation

◆ execute()

void VoltageMonitor::execute ( )
virtual

Virtual execute function to be called at the end of central simulation loop in System

Reimplemented from auryn::StateMonitor.

48 {
49  if ( auryn::sys->get_clock() < t_stop ) {
50  // we output spikes irrespectively of the sampling interval, because
51  // the membrane potential isn't a smooth function for most IF models when
52  // they spike, so it's easy to "miss" a spike otherwise
53  double voltage = *target_variable;
54  if ( paste_spikes ) {
56  for ( int i = 0 ; i < spikes->size() ; ++i ) {
57  if ( spikes->at(i) == gid ) {
59  outfile << (auryn::sys->get_time()) << " " << voltage << "\n";
60  return;
61  }
62  }
63  }
64  if ( (auryn::sys->get_clock())%ssize==0 )
65  outfile << (auryn::sys->get_time()) << " " << voltage << "\n";
66  }
67 }
std::vector< NeuronID > SpikeContainer
Spike container type. Used for storing spikes.
Definition: auryn_definitions.h:161
#define VOLTAGEMONITOR_PASTED_SPIKE_HEIGHT
Definition: VoltageClampMonitor.h:29
SpikingGroup * src
The source SpikingGroup to record from.
Definition: StateMonitor.h:44
std::ofstream outfile
Definition: Monitor.h:58
AurynTime ssize
The step size (sampling interval) in units of auryn_timestep.
Definition: StateMonitor.h:57
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
AurynState * target_variable
Target variable.
Definition: StateMonitor.h:47
SpikeContainer * get_spikes_immediate()
Returns pointer to SpikeContainer of spikes generated during the last evolve() step.
Definition: SpikingGroup.cpp:250
AurynTime paste_spikes
Paste spikes switch (default = true)
Definition: VoltageMonitor.h:59
AurynTime t_stop
Defines the maximum recording time in AurynTime to save space.
Definition: StateMonitor.h:60
Here is the call graph for this function:

◆ init()

void VoltageMonitor::init ( )
protected

Standard initialization.

42 {
43  paste_spikes = true;
45 }
AurynStateVector * get_state_vector(std::string key)
Creates a new or returns an existing state vector by name.
Definition: SpikingGroup.cpp:781
SpikingGroup * src
The source SpikingGroup to record from.
Definition: StateMonitor.h:44
NeuronID nid
The source neuron id to record from.
Definition: StateMonitor.h:54
T * ptr(IndexType i=0)
Gets pointer to element i from vector.
Definition: AurynVector.h:217
AurynState * target_variable
Target variable.
Definition: StateMonitor.h:47
AurynTime paste_spikes
Paste spikes switch (default = true)
Definition: VoltageMonitor.h:59
Here is the call graph for this function:

Member Data Documentation

◆ paste_spikes

AurynTime auryn::VoltageMonitor::paste_spikes

Paste spikes switch (default = true)


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