To retrieve outputs, a spike-monitoring callback mechanism is used.
This mechanism allows the user to calculate basic statistics, store spike trains, or
perform more complicated output monitoring. Spike monitors are registered for a group
and are called automatically by the simulator every second. Similar to an address event
representation (AER), the spike monitor indicates which neurons spiked by using the
neuron ID within a group (0-indexed) and the time of the spike. Only one spike monitor
is allowed per group.
For more information see Section
Interacting with the simulation: Spike
monitoring in the Tutorial.
In order to create a custom spike monitor one needs to create a new class that derives
from the SpikeMonitor class:
class MyMonitor: public SpikeMonitor { ...
One does then need to define an update method.
^SpikeMonitor::update CARLsim ≥ 2.0
virtual void update(CpuSNN* s, int grpId, unsigned int* Nids,
unsigned int* timeCnts)
Input arguments:
CpuSNN* s: pointer to a CpuSNN object
int grpId: neuron group ID for which the spike generator is called
Output arguments:
unsigned int* Nids: array of neuron IDs for which spikes are monitored
unsigned int* timeCnts: 1000-element strong array (for each millisecond
in a second) that contains the ID of neurons that spiked
CAUTION: The virtual method should never be called directly.
|