CARLsim  5.0.0
CARLsim: a GPU-accelerated SNN simulator
GroupMonitor Class Reference

Class GroupMonitor. More...

#include <group_monitor.h>

Public Member Functions

 GroupMonitor (GroupMonitorCore *groupMonitorCorePtr)
 GroupMonitor constructor. More...
 
virtual ~GroupMonitor ()
 GroupMonitor destructor. More...
 
std::vector< float > getDataVector ()
 return the group data vector More...
 
std::vector< int > getPeakTimeVector ()
 return a vector of the timestamps for peak values in group data More...
 
std::vector< float > getPeakValueVector ()
 return a vector of peak values in group data More...
 
bool getPersistentData ()
 Returns a flag that indicates whether PersistentMode is on (true) or off (false) More...
 
int getRecordingLastStartTime ()
 Returns the simulation time (ms) of the last call to startRecording() More...
 
int getRecordingStartTime ()
 Returns the simulation time (ms) of the first call to startRecording() More...
 
int getRecordingStopTime ()
 Returns the simulation time (ms) of the last call to stopRecording() More...
 
int getRecordingTotalTime ()
 Returns the total recording time (ms) More...
 
std::vector< int > getSortedPeakTimeVector ()
 return a vector of the timestamps for peak values in group data (sorted in decending order) More...
 
std::vector< float > getSortedPeakValueVector ()
 return a vector of peak values in group data (sorted in decending order) More...
 
std::vector< int > getTimeVector ()
 return a vector of the timestamps for group data More...
 
bool isRecording ()
 Recording status (true=recording, false=not recording) More...
 
void setPersistentData (bool persistentData)
 Sets PersistentMode either on (true) or off (false) More...
 
void startRecording ()
 Starts a new recording period. More...
 
void stopRecording ()
 Ends a recording period. More...
 

Detailed Description

The GroupMonitor class allows a user record group data (only support dopamine concentration for now) from a particular neuron group. First the method CARLsim::setGroupMonitor must be called with the group ID of the desired group as an argument. The setGroupMonitor call returns a pointer to a GroupMonitor object which can be queried for group data.

Group data will not be recorded until the GroupMonitor member function startRecording() is called. Before any metrics can be computed, the user must call stopRecording(). In general, a new recording period (the time period between startRecording and stopRecording calls) can be started at any point in time, and can last any number of milliseconds. The GroupMonitor has a PersistentMode, which is off by default. When PersistentMode is off, only the last recording period will be considered. When PersistentMode is on, all the recording periods will be considered. By default, PersistentMode can be switched on/off by calling setPersistentData(bool). The total time over which the metric is calculated can be retrieved by calling getRecordingTotalTime().

GroupMonitor objects should only be used after setupNetwork has been called. GroupMonitor objects will be deallocated automatically. The caller should not delete(free) GroupMonitor objects

Example usage:

// configure a network etc. ...
// create a GroupMonitor pointer to grab the pointer from setGroupMonitor.
GroupMonitor* daGroupMon;
// call setGroupMonitor with carlsim object, sim, with the group ID, daGrpId, as an argument.
daGroupMon=sim.setGroupMonitor(daGrpId);
// begin recording group data for DA group
daGroupMon->startRecording();
// run simulation that generates spikes for 20 seconds.
sim.runNetwork(20);
// stop recording group data for DA group so we can get spike statistics.
daGroupMon->stopRecording();
// print a summary of the group data information
daGroupMon->print();
// get the average value of group data (only support dopamine concentration for now) of DA group
float avgDAValue = daGroupMon->getMeanValue();
TODO:
finish documentation

Definition at line 104 of file group_monitor.h.

Constructor & Destructor Documentation

◆ GroupMonitor()

GroupMonitor ( GroupMonitorCore groupMonitorCorePtr)

Creates a new instance of the GroupMonitor class.

Definition at line 57 of file group_monitor.cpp.

◆ ~GroupMonitor()

~GroupMonitor ( )
virtual

Cleans up all the memory upon object deletion.

Definition at line 62 of file group_monitor.cpp.

Member Function Documentation

◆ getDataVector()

std::vector< float > getDataVector ( )

This function returns a vector containing all group data (only support dopamine concentration for now) If PersistentMode is off, only the last recording period will be considered for calculating metrics. If PersistentMode is on, all the recording periods will be considered. By default, PersistentMode is off, but can be switched on at any point in time by calling setPersistentData(bool).

Returns
1D vector of float values presenting dopamine concentration

Definition at line 122 of file group_monitor.cpp.

◆ getPeakTimeVector()

std::vector< int > getPeakTimeVector ( )

This function returns a vector containing all timestamps of peaks (local maximum value) in group data. If PersistentMode is off, only the last recording period will be considered for calculating metrics. If PersistentMode is on, all the recording periods will be considered. By default, PersistentMode is off, but can be switched on at any point in time by calling setPersistentData(bool).

Returns
1D vector of int values presenting the timestamps of peaks

Definition at line 136 of file group_monitor.cpp.

◆ getPeakValueVector()

std::vector< float > getPeakValueVector ( )

This function returns a vector containing all peak values for group data. If PersistentMode is off, only the last recording period will be considered for calculating metrics. If PersistentMode is on, all the recording periods will be considered. By default, PersistentMode is off, but can be switched on at any point in time by calling setPersistentData(bool).

Returns
1D vector of float values which are peaks (local maximum values) in group data

Definition at line 150 of file group_monitor.cpp.

◆ getPersistentData()

bool getPersistentData ( )

This function returns a flag that indicates whether PersistentMode is currently on (true) or off (false). If PersistentMode is off, only the last recording period will be considered for calculating metrics. If PersistentMode is on, all the recording periods will be considered. By default, PersistentMode is off, but can be switched on at any point in time by calling setPersistentData(bool).

Definition at line 114 of file group_monitor.cpp.

◆ getRecordingLastStartTime()

int getRecordingLastStartTime ( )

This function returns the simulation time (timestamp) of the last call to startRecording(). If PersistentMode is off, this number is equivalent to getRecordingStartTime().

Returns
the simulation time (ms) of the last call to startRecording()

Definition at line 93 of file group_monitor.cpp.

◆ getRecordingStartTime()

int getRecordingStartTime ( )

This function returns the simulation time (timestamp) of the first call to startRecording(). If PersistentMode is off, this number is equivalent to getRecordingLastStartTime().

Returns
the simulation time (ms) of the first call to startRecording()

Definition at line 100 of file group_monitor.cpp.

◆ getRecordingStopTime()

int getRecordingStopTime ( )

This function returns the simulation time (timestamp) of the last call to stopRecording().

Returns
the simulation time (ms) of the last call to stopRecording()

Definition at line 107 of file group_monitor.cpp.

◆ getRecordingTotalTime()

int getRecordingTotalTime ( )

This function returns the total amount of recording time upon which the calculated metrics are based. If PersistentMode is off, this number is equivalent to getRecordingStopTime()-getRecordingStartTime(). If PersistentMode is on, this number is equivalent to the total time accumulated over all past recording periods. Note that this is not necessarily equivalent to getRecordingStopTime()-getRecordingStartTime(), as there might have been periods in between where recording was off.

Returns
the total recording time (ms)

Definition at line 86 of file group_monitor.cpp.

◆ getSortedPeakTimeVector()

std::vector< int > getSortedPeakTimeVector ( )

This function returns a vector containing all timestamps for sorted peak values (sorted in decending order) In other word, the first element in the vector is the timestamp of the highest peak in recording duration. If PersistentMode is off, only the last recording period will be considered for calculating metrics. If PersistentMode is on, all the recording periods will be considered. By default, PersistentMode is off, but can be switched on at any point in time by calling setPersistentData(bool).

Returns
1D vector of int values presenting the timestamps of sorted peaks

Definition at line 143 of file group_monitor.cpp.

◆ getSortedPeakValueVector()

std::vector< float > getSortedPeakValueVector ( )

This function returns a vector containing all sorted peak values in group data (sorted in decending order). In other word, the first element in the vector is the highest peak value in recording duration. If PersistentMode is off, only the last recording period will be considered for calculating metrics. If PersistentMode is on, all the recording periods will be considered. By default, PersistentMode is off, but can be switched on at any point in time by calling setPersistentData(bool).

Returns
1D vector of float values presenting sorted peaks

Definition at line 157 of file group_monitor.cpp.

◆ getTimeVector()

std::vector< int > getTimeVector ( )

This function returns a vector containing all timestamps for group data. If PersistentMode is off, only the last recording period will be considered for calculating metrics. If PersistentMode is on, all the recording periods will be considered. By default, PersistentMode is off, but can be switched on at any point in time by calling setPersistentData(bool).

Returns
1D vector of int values presenting the timestamps

Definition at line 129 of file group_monitor.cpp.

◆ isRecording()

bool isRecording ( )

Gets record status as a bool. True means it is recording, false means it is not recording.

Returns
bool that is true if object is recording, false otherwise.

Definition at line 68 of file group_monitor.cpp.

◆ setPersistentData()

void setPersistentData ( bool  persistentData)

This function sets PersistentMode either on (true) or off (false). If PersistentMode is off, only the last recording period will be considered for calculating metrics. If PersistentMode is on, all the recording periods will be considered. By default, PersistentMode is off, but can be switched on at any point in time. The current state of PersistentMode can be retrieved by calling getPersistentData().

Definition at line 118 of file group_monitor.cpp.

◆ startRecording()

void startRecording ( )

This function starts a new recording period. From that moment onward, the data vector will be populated with all the concentrations of enabled neuromodulators of the group. Before any metrics can be computed, the user must call stopRecording(). Recording periods must be ended with stopRecording(). In general, a new recording period can be started at any point in time, and can last any number of milliseconds. If PersistentMode is off, only the last recording period will be considered. If PersistentMode is on, all the recording periods will be considered. By default, PersistentMode is off, and can be switched on by calling setPersistentData(bool). The total time over which the metric is calculated can be retrieved by calling getRecordingTotalTime().

Definition at line 72 of file group_monitor.cpp.

◆ stopRecording()

void stopRecording ( )

This function ends a recording period, at which point the data vector will no longer be populated with new neuromodulator data. In general, a recording period can be ended at any point in time, and last any number of milliseconds.

Definition at line 79 of file group_monitor.cpp.


The documentation for this class was generated from the following files:
CARLsim::runNetwork
int runNetwork(int nSec, int nMsec=0, bool printRunSummary=true)
run the simulation for time=(nSec*seconds + nMsec*milliseconds)
Definition: carlsim.cpp:1910
CARLsim::setGroupMonitor
GroupMonitor * setGroupMonitor(int grpId, const std::string &fname)
Sets a group monitor for a group, custom GroupMonitor class.
Definition: carlsim.cpp:1963
CARLsim::setupNetwork
void setupNetwork()
build the network
Definition: carlsim.cpp:1915
GroupMonitor::startRecording
void startRecording()
Starts a new recording period.
Definition: group_monitor.cpp:72
GroupMonitor
Class GroupMonitor.
Definition: group_monitor.h:104
GroupMonitor::stopRecording
void stopRecording()
Ends a recording period.
Definition: group_monitor.cpp:79