SpikeData¶
General description¶
Data packets of the SpikeData type hold a list of the timestamp and the amplitude of each spike. The list has a maximum size, specified at initialization time, which cannot be overreached.
Payload details¶
name |
type |
description |
---|---|---|
n_detected_spikes |
unsigned int |
the number of spikes added in the datatype |
hw_ts_detected_spikes |
vector of unsigned int64 |
hardware timestamp of each spike |
zero_timestamps |
vector of 100 (maximum of spikes in the buffer) unsigned int64 |
|
amplitudes |
vector of double |
|
zero_amplitudes |
vector of 1600 (maximum of spikes in the buffer x maximum number of channels) double |
API¶
-
class Data : public Base::Data
Public Functions
-
void Initialize(unsigned int nchannels, size_t max_nspikes, double sample_rate)
-
inline void Initialize(const Parameters ¶meters)
-
void ClearData() override
-
unsigned int n_channels() const
-
double sample_rate() const
-
void add_spike(const std::vector<double> &litudes, uint64_t hw_timestamp)
-
void add_spike(double *amplitudes, uint64_t hw_timestamp)
-
unsigned int n_detected_spikes() const
-
std::vector<double> &litudes()
-
ChannelValidityMask &validity_mask()
-
const std::vector<uint64_t> &ts_detected_spikes() const
-
const uint64_t ts_detected_spikes(int index) const
-
std::vector<double>::const_iterator spike_amplitudes(std::size_t spike_index) const
-
void SerializeBinary(std::ostream &stream, Serialization::Format format = Serialization::Format::FULL) const final
-
void SerializeYAML(YAML::Node &node, Serialization::Format format = Serialization::Format::FULL) const final
-
void YAMLDescription(YAML::Node &node, Serialization::Format format = Serialization::Format::FULL) const final
-
void SerializeFlatBuffer(flexbuffers::Builder &flex_builder) final
Public Static Attributes
-
static constexpr unsigned int DEFAULT_MAX_NSPIKES = MAX_N_SPIKES_IN_BUFFER
-
void Initialize(unsigned int nchannels, size_t max_nspikes, double sample_rate)
Parameters¶
name |
type |
description |
validation |
---|---|---|---|
nchannels |
unsigned int |
number of channels |
needs to be larger than 0 |
sample_rate |
double |
needs to be larger than 0 |
|
max_nspikes |
size_t |
buffer size |
needs to be larger than 0 |
-
struct Parameters : public Base::Parameters
Public Functions
-
inline Parameters(double bufsize = 0., unsigned int nchan = 0, double rate = 0.)
Public Members
-
double buffer_size
-
unsigned int nchannels
-
double sample_rate
-
inline Parameters(double bufsize = 0., unsigned int nchan = 0, double rate = 0.)
Capabilities¶
-
class Capabilities : public Base::Capabilities
Public Functions
-
inline Capabilities(ChannelRange channel_range = ChannelRange(1, MAX_N_CHANNELS_SPIKE_DETECTION))
-
inline ChannelRange channel_range() const
-
inline virtual void VerifyCompatibility(const Capabilities &capabilities) const
-
inline virtual void Validate(const Parameters ¶meters) const
-
inline Capabilities(ChannelRange channel_range = ChannelRange(1, MAX_N_CHANNELS_SPIKE_DETECTION))
Binary Serialization¶
For serialization format FULL, the number of detected spikes, the hardware, zero timestamps, amplitudes of each spikes are serialized in a string format. For serialization format COMPACT, only the number of detected spikes and the amplitudes of each spikes are serialized in a string format.
YAML Serialization¶
For serialization formats FULL and COMPACT, the following YAML is emitted:
n_channels [channel number unsigned int] n_detected_spikes [ number of spikes unsigned int]
if the previous one is superior to zero : ts_detected_spikes [hardware timestamps] spike_amplitudes [amplitudes]