Source code for spynnaker.pyNN.models.common.abstract_spike_recordable

# Copyright (c) 2017-2019 The University of Manchester
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <>.

from spinn_utilities.abstract_base import AbstractBase, abstractmethod
from spinn_utilities.require_subclass import require_subclass
from pacman.model.graphs.application import ApplicationVertex

[docs]@require_subclass(ApplicationVertex) class AbstractSpikeRecordable(object, metaclass=AbstractBase): """ Indicates that spikes can be recorded from this object. """ __slots__ = ()
[docs] @abstractmethod def is_recording_spikes(self): """ Determine if spikes are being recorded :return: True if spikes are being recorded, False otherwise :rtype: bool """
[docs] @abstractmethod def set_recording_spikes( self, new_state=True, sampling_interval=None, indexes=None): """ Set spikes to being recorded. \ If `new_state` is false all other parameters are ignored. :param bool new_state: Set if the spikes are recording or not :param sampling_interval: The interval at which spikes are recorded. Must be a whole multiple of the timestep. None will be taken as the timestep. :type sampling_interval: int or None :param indexes: The indexes of the neurons that will record spikes. If None the assumption is all neurons are recording :type indexes: list(int) or None """
[docs] @abstractmethod def clear_spike_recording(self, buffer_manager, placements): """ Clear the recorded data from the object :param buffer_manager: the buffer manager object :type buffer_manager: ~spinn_front_end_common.interface.buffer_management.BufferManager :param ~pacman.model.placements.Placements placements: the placements object :rtype: None """
[docs] @abstractmethod def get_spikes(self, placements, buffer_manager): """ Get the recorded spikes from the object :param ~pacman.model.placements.Placements placements: the placements object :param buffer_manager: the buffer manager object :type buffer_manager: ~spinn_front_end_common.interface.buffer_management.BufferManager :return: A numpy array of 2-element arrays of (neuron_id, time) ordered by time, one element per event :rtype: ~numpy.ndarray(tuple(int,int)) """
[docs] @abstractmethod def get_spikes_sampling_interval(self): """ Return the current sampling interval for spikes :return: Sampling interval in microseconds :rtype: float """