Spike
Loading...
Searching...
No Matches
SpikeTrain.h
1#ifndef SPIKE_SPIKETRAIN_H
2#define SPIKE_SPIKETRAIN_H
3
4#include <cstddef>
5#include <memory>
6#include <vector>
7
8#include "Spike/TimeFrame/TimeFrame.h"
9
10namespace Spike {
11
19private:
20 double dt;
21 std::vector<double> spikes;
22
23public:
28 explicit SpikeTrain(const TimeFrame &time_frame);
29
34 size_t spike_count();
35
39 void clear();
40
45 void add_spike(size_t i);
46
51 [[nodiscard]] double get_dt() const { return dt; };
52
57 [[nodiscard]] size_t get_size() const { return spikes.size(); };
58
64 [[nodiscard]] bool get_spike(size_t i) const { return (spikes[i] != 0); };
65
70 [[nodiscard]] const std::vector<double> &get_values() const {
71 return spikes;
72 };
73};
74
75} // namespace Spike
76
77#endif // SPIKE_SPIKETRAIN_H
A spike train for discretized times. For a given time discretization with time step dt,...
Definition SpikeTrain.h:18
void clear()
Clears the spike train, i.e. sets all values to zero.
Definition SpikeTrain.cpp:23
double get_dt() const
Returns time step.
Definition SpikeTrain.h:51
SpikeTrain(const TimeFrame &time_frame)
Constructs a spike train from a given time frame.
Definition SpikeTrain.cpp:5
bool get_spike(size_t i) const
Checks whether there is a spike at index i.
Definition SpikeTrain.h:64
size_t spike_count()
Counts the number of spikes in the spike train.
Definition SpikeTrain.cpp:11
size_t get_size() const
Returns size of spike train (length).
Definition SpikeTrain.h:57
const std::vector< double > & get_values() const
Returns the whole spike train (as a vector)
Definition SpikeTrain.h:70
void add_spike(size_t i)
Adds a spike at index i.
Definition SpikeTrain.cpp:28
A time frame with discrete time steps.
Definition TimeFrame.h:13