Falcon
Toggle main menu visibility
Loading...
Searching...
No Matches
spikedetector.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 <memory>
23
#include <string>
24
25
#include "dsp/algorithms.hpp"
26
#include "eventdata/eventdata.hpp"
27
#include "iprocessor.hpp"
28
#include "options/options.hpp"
29
#include "spikedata/spikedata.hpp"
30
#include "timeseriesdata/timeseriesdata.hpp"
31
32
class
SpikeDetector :
public
IProcessor {
33
// CONSTRUCTOR and OVERLOADED METHODS
34
public
:
35
SpikeDetector();
36
void
CreatePorts()
override
;
37
void
CompleteStreamInfo()
override
;
38
void
Prepare(
GlobalContext
& context)
override
;
39
void
Process(
ProcessingContext
& context)
override
;
40
void
Postprocess(
ProcessingContext
& context)
override
;
41
42
// PORTS
43
protected
:
44
PortIn<TimeSeriesType<double>
>* data_in_port_;
45
PortOut<SpikeType>
* data_out_port_spikes_;
46
PortOut<EventType>
* data_out_port_events_;
47
48
// STATES
49
protected
:
50
StaticState<double>* threshold_;
51
StaticState<unsigned int>* peak_lifetime_;
52
53
// VARIABLES
54
protected
:
55
unsigned
int
n_channels_;
56
size_t
n_incoming_;
57
size_t
incoming_buffer_size_samples_;
58
uint64_t n_streamed_events_;
59
60
std::unique_ptr<dsp::algorithms::SpikeDetector> spike_detector_;
61
std::unique_ptr<TimeSeriesType<double>::Data> inverted_signals_;
62
63
// CONSTANTS
64
public
:
65
unsigned
int
MAX_N_CHANNELS = 8;
66
const
std::string PEAK_LIFETIME =
"peak_lifetime"
;
67
const
std::string THRESHOLD =
"threshold"
;
68
const
int
RINGBUFFER_SIZE = 1e5;
69
70
// OPTIONS
71
protected
:
72
options::Double initial_threshold_{60.};
73
options::Bool invert_signal_{
true
};
74
options::Measurement<double, false> buffer_size_{0.5,
"ms"
, options::positive<double>(
true
)};
75
options::Bool strict_time_bin_check_{
true
};
76
options::Measurement<unsigned int, false> initial_peak_lifetime_{8,
"sample"
};
77
};
GlobalContext
Definition
context.hpp:54
PortIn
Definition
streamports.hpp:256
PortOut
Definition
streamports.hpp:98
ProcessingContext
Definition
runinfo.hpp:248
extensions
falcon-fklab-extensions
processors
spikedetector
spikedetector.hpp
Generated by
1.18.0