Program Listing for File spikefeatures.hpp¶
↰ Return to documentation for file (processors/spikefeatures/spikefeatures.hpp
)
// ---------------------------------------------------------------------
// This file is part of falcon-core.
//
// Copyright (C) 2021-now Neuro-Electronics Research Flanders
//
// Falcon-server is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Falcon-server is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with falcon-core. If not, see <http://www.gnu.org/licenses/>.
// ---------------------------------------------------------------------
#pragma once
#include "dsp/algorithms.hpp"
#include "iprocessor.hpp"
#include "columnsdata/columnsdata.hpp"
#include "timeseriesdata/timeseriesdata.hpp"
class SpikeFeatures : public IProcessor {
// CONSTRUCTOR and OVERLOADED METHODS
public:
SpikeFeatures();
void Configure(const GlobalContext &context) override;
void CreatePorts() override;
void CompleteStreamInfo() override;
void Prepare(GlobalContext &context) override;
void Process(ProcessingContext &context) override;
// DATA PORTS
protected:
PortIn<TimeSeriesType<double>> *data_in_port_;
PortOut<ColumnsType<double>> *decoding_out_port_;
protected:
std::vector<std::unique_ptr<dsp::algorithms::SpikeDetector>> spike_detectors_;
// STATES
protected:
StaticState<double> *threshold_;
StaticState<unsigned int> *peak_lifetime_;
// CONSTANTS
public:
const uint32_t MAX_NCHANNELS=384;
const uint32_t MAX_NSPIKES=100;
const std::string PEAK_LIFETIME = "peak lifetime";
const std::string THRESHOLD = "threshold";
std::vector<std::string> features_labels_;
YAML::Node default_features_;
int slot_ = 0;
private:
options::Double initial_threshold_{70.};
options::Measurement<unsigned int, false> initial_peak_lifetime_{1, "sample"};
options::Value<std::vector<std::string>, false> features_{};
options::Value<std::map<std::string, double>, false> channel_pos_{};
options::Bool invert_signal_{true};
};