5#include "dsp/algorithms.hpp"
6#include "eventdata/eventdata.hpp"
7#include "iprocessor.hpp"
8#include "options/options.hpp"
9#include "options/units.hpp"
10#include "timeseriesdata/timeseriesdata.hpp"
12class RippleDetector :
public IProcessor {
15 void CreatePorts()
override;
16 void CompleteStreamInfo()
override;
27 double compute_value(TimeSeriesType<double>::Data* data_in,
unsigned int sample);
39 ProducerState<double>* threshold_;
40 ProducerState<double>* signal_mean_;
41 ProducerState<double>* signal_dev_;
42 BroadcasterState<bool>* ripple_;
43 StaticState<double>* threshold_dev_;
44 StaticState<double>* detection_lockout_time_;
45 FollowerState<bool>* detection_enabled_;
46 StaticState<bool>* stream_events_;
47 StaticState<double>* smooth_time_;
48 StaticState<bool>* stats_out_;
50 bool stats_out_enabled_;
51 std::uint64_t stats_nsamples_;
53 std::uint64_t burn_in_;
56 std::unique_ptr<dsp::algorithms::RunningMeanMAD> running_statistics_;
57 std::unique_ptr<dsp::algorithms::ThresholdCrosser> threshold_detector_;
60 const std::vector<std::string> STATS_LABEL = {
"statistics",
"threshold",
"deviation"};
61 const std::string THRESHOLD_DEV =
"threshold_dev";
62 const std::string SMOOTH_TIME =
"smooth_time";
63 const std::string DETECTION_LOCKOUT_TIME =
"analysis_lockout_time";
64 const std::string STREAM_EVENTS =
"stream_events";
65 const std::string STREAM_STATISTICS =
"stream_statistics";
74 options::positive<double>(
true)};
78 30.,
"ms", options::positive<double>(
true)};
89 options::positive<double>(
true)};
93 1, options::positive<unsigned int>(
true)};
Definition streamports.hpp:256
Definition streamports.hpp:98
Definition runinfo.hpp:248
options::Bool default_stream_events_
Boolean option toggling automatic event packet routing on startup.
Definition rippledetector.hpp:82
PortOut< TimeSeriesType< double > > * stats_out_port_
High-throughput telemetry pipeline for baseline tracking analysis.
Definition rippledetector.hpp:37
options::Value< unsigned int, false > stats_downsample_factor_
Downsampling selection defining telemetry output bandwidth scaling.
Definition rippledetector.hpp:92
double compute_value(TimeSeriesType< double >::Data *data_in, unsigned int sample)
Extracts or transforms a single data point from the input pipeline for threshold analysis.
Definition rippledetector.cpp:201
options::Double initial_threshold_dev_
Configurable baseline multiplier defining default SWR detection sensitivity.
Definition rippledetector.hpp:70
PortOut< EventType > * event_out_port_
Zero-latency output channel for discrete SWR event timestamps.
Definition rippledetector.hpp:34
options::Bool initial_stats_out_
Boolean option toggling diagnostic tracking streams on startup.
Definition rippledetector.hpp:85
options::Bool use_power_
Boolean option tracking whether evaluation uses root-mean or raw metrics.
Definition rippledetector.hpp:96
void Process(ProcessingContext &context) override
Primary execution loop processing streaming samples, updating tracking metrics, and broadcasting dete...
Definition rippledetector.cpp:91
options::Measurement< double, false > initial_detection_lockout_time_
Measurement option managing the post-trigger deadtime window.
Definition rippledetector.hpp:77
PortIn< TimeSeriesType< double > > * data_in_port_
High-density LFP input stream (1 to 256 channels).
Definition rippledetector.hpp:31
options::Measurement< double, false > initial_smooth_time_
Measurement option managing baseline initialization window duration.
Definition rippledetector.hpp:73
options::Measurement< double, false > stats_buffer_size_
Measurement option allocating continuous data memory capacity thresholds.
Definition rippledetector.hpp:88