Time Series data¶
General description¶
Data packet of the time series data type contains a generic nsamples-by-ncolumn array of data. It inherits from the column data type and it replaced the multichannel data from previous falcon-fklab-extension version.
Each column has a label which by default will be the channel number. It has also a timestamps associated to the samples.
Payload details¶
name |
type |
description |
|---|---|---|
labels |
vector of ncolumn strings |
a string name for each column |
timestamp |
uint64 |
|
signal |
vector of any datatype |
API¶
-
template<typename T>
class Data : public IData<Data<T>, Base<T>> -
Public Functions
-
inline Data(const std::vector<std::string> &labels, size_t nsamples, double sample_rate)
Data constructor with the label of the columns, the number of samples and the sample rate.
- Parameters
columns_label – give a label for each column in the data / set also the number of columns in the dataset
nsamples – give the number of samples by column
sample_rate –
-
inline Data(size_t ncolumns, size_t nsamples, double sample_rate)
Data constructor with only the number of columns, the number of samples and the sample rate.
The label of column is generated from the column number (“0”, “1”…,)
- Parameters
ncolumns –
nsamples –
sample_rate –
-
inline Data(const Parameters ¶meters)
Data constructor based on the parameters object.
- Parameters
parameters – - contains already the column labels either automatically generated based on the number of columns or set directly.
-
inline void ClearData() override
ClearData - clear the timestamps and the data (done in the columndatatype::Data)
-
inline Parameters parameters() const
-
inline double sample_rate() const
-
inline uint64_t sample_timestamp(size_t sample = 0) const
sample_timestamp - give the timestamp corresponding to a sample number
- Parameters
sample –
- Returns
one timestamp
-
inline const std::vector<uint64_t> &sample_timestamps() const
sample_timestamps - give all the timestamps in the packet
- Returns
all timestamps
-
inline std::vector<uint64_t> &sample_timestamps()
-
inline void set_sample_timestamp(size_t sample, uint64_t t)
set_sample_timestamp - set one timestamp for a given sample number
- Parameters
sample –
t –
-
inline void set_sample_timestamps(const std::vector<uint64_t> &t)
set_sample_timestamps - set all timestamps for all sample
- Parameters
t –
-
inline void SerializeFlatBuffer(flexbuffers::Builder &flex_builder) override
FlatbufferDescription - This datatype add in the flexbuffer stream the timestamps and the type name.
Note
the columndata is already taking care of adding the data itself.
- Parameters
flex_builder –
-
inline void SerializeBinary(std::ostream &stream, Serialization::Format format = Serialization::Format::FULL) const override
SerializeBinary - This datatype add in the binary stream the timestamps.
Note
the columndata is taking care of adding the data in the stream.
- Parameters
stream –
format –
-
inline void SerializeYAML(YAML::Node &node, Serialization::Format format = Serialization::Format::FULL) const override
SerializeYAML - This datatype add as a yaml node the timestamps.
Note
the columndata is taking care of adding the data in the upper node.
- Parameters
node –
format –
-
inline void YAMLDescription(YAML::Node &node, Serialization::Format format = Serialization::Format::FULL) const override
YAMLDescription - this datatype add to the metadata describing the data format the timestamp format.
- Parameters
node –
format –
Public Static Functions
-
static inline const std::string static_datatype()
-
static inline const std::string static_dataname()
-
inline Data(const std::vector<std::string> &labels, size_t nsamples, double sample_rate)
Parameters¶
name |
type |
description |
validation |
|---|---|---|---|
nsamples |
unsigned int |
0 |
Number of samples cannot be zero and needs to be in range |
nchannels |
unsigned int |
0 |
Number of channels cannot be zero and needs to be in range |
sample_rate |
double |
1.0 |
Sample rate needs to be larger than 0 |
-
struct Parameters : public nsColumn::Parameters
Public Functions
-
inline Parameters(size_t nchan = 0, size_t nsamp = 0, double rate = 1.0)
-
inline Parameters(const std::vector<std::string> &labels, size_t nsamp = 0, double rate = 1.0)
Public Members
-
double sample_rate
-
inline Parameters(size_t nchan = 0, size_t nsamp = 0, double rate = 1.0)
Capabilities¶
see :ref:columndata type capabilities
Binary Serialization¶
For serialization formats FULL and COMPACT, The timestamps and the data are serialized.
YAML Serialization¶
For serialization formats FULL and COMPACT,
the following YAML is emitted:
timestamps: [timestamps (unsigned int)] signal: [data] label: [label]