Falcon
Toggle main menu visibility
Loading...
Searching...
No Matches
ripplesource.hpp
1
// ---------------------------------------------------------------------
2
// This file is part of falcon-core.
3
//
4
// Copyright (C) 2015, 2016, 2017 Neuro-Electronics Research Flanders
5
//
6
// Falcon-server is free software: you can redistribute it and/or modify
7
// it under the terms of the GNU General Public License as published by
8
// the Free Software Foundation, either version 3 of the License, or
9
// (at your option) any later version.
10
//
11
// Falcon-server is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
15
//
16
// You should have received a copy of the GNU General Public License
17
// along with falcon-core. If not, see <http://www.gnu.org/licenses/>.
18
// ---------------------------------------------------------------------
19
20
#pragma once
21
22
#include <random>
23
24
#include "datasource.hpp"
25
26
class
RippleSource
:
public
DataSource
{
27
public
:
44
RippleSource
(
double
offset,
double
frequency,
double
sampling_rate, YAML::Node ripple_duration,
45
double
mean_amplitude,
double
noise_stdev,
bool
convert_byte_order,
46
unsigned
int
nchannels);
47
48
public
:
49
std::string string()
override
;
50
59
int64_t
Produce
(
char
** data)
override
;
60
YAML::Node to_yaml()
const override
;
61
static
RippleSource
* from_yaml(YAML::Node node);
62
63
private
:
64
struct
params_by_channel_t {
65
double
counter;
66
double
interval;
67
double
duration;
68
bool
ripple;
69
double
amplitude;
70
unsigned
int
channel_number;
71
};
72
73
double
generate_one_signal(params_by_channel_t* params);
74
75
protected
:
76
double
offset_;
77
double
frequency_;
78
double
sampling_rate_;
79
uint64_t delta_;
80
uint64_t timestamp_ = 0;
81
82
YAML::Node ripple_params_;
83
84
double
mean_amplitude_;
85
std::poisson_distribution<int> poisson_distribution_;
86
std::default_random_engine generator_;
87
88
double
noise_stdev_;
89
std::normal_distribution<double> distribution_;
90
91
bool
convert_byte_order_;
92
std::vector<char> buffer_;
93
94
unsigned
int
nchannels_;
95
std::vector<params_by_channel_t> params;
96
double
omega_;
97
};
DataSource
Definition
datasource.hpp:29
RippleSource::Produce
int64_t Produce(char **data) override
Definition
ripplesource.cpp:118
RippleSource::RippleSource
RippleSource(double offset, double frequency, double sampling_rate, YAML::Node ripple_duration, double mean_amplitude, double noise_stdev, bool convert_byte_order, unsigned int nchannels)
Definition
ripplesource.cpp:26
extensions
falcon-fklab-extensions
tools
nlxtestbench
ripplesource.hpp
Generated by
1.18.0