Filters back installed in RtAps

This commit is contained in:
Anne de Jong 2022-10-12 15:23:12 +02:00
parent ec689621b5
commit 20be897a17

View File

@ -1,4 +1,4 @@
#define DEBUGTRACE_ENABLED /* #define DEBUGTRACE_ENABLED */
#include "lasp_rtaps.h" #include "lasp_rtaps.h"
#include "debugtrace.hpp" #include "debugtrace.hpp"
#include <mutex> #include <mutex>
@ -13,9 +13,9 @@ RtAps::RtAps(StreamMgr &mgr, const Filter *freqWeightingFilter,
: ThreadedInDataHandler(mgr), : ThreadedInDataHandler(mgr),
_ps(nfft, w, overlap_percentage, time_constant) { _ps(nfft, w, overlap_percentage, time_constant) {
/* if (freqWeightingFilter != nullptr) { */ if (freqWeightingFilter != nullptr) {
/* _filterPrototype = freqWeightingFilter->clone(); */ _filterPrototype = freqWeightingFilter->clone();
/* } */ }
start(); start();
} }
@ -29,30 +29,29 @@ bool RtAps::inCallback_threaded(const DaqData &data) {
std::scoped_lock<std::mutex> lck(_mtx); std::scoped_lock<std::mutex> lck(_mtx);
dmat fltdata = data.toFloat(); dmat fltdata = data.toFloat();
data.print(); const us nchannels = fltdata.n_cols;
/* const us nchannels = fltdata.n_cols; */
/* if (_filterPrototype) { */ if (_filterPrototype) {
/* // Adjust number of filters, if necessary */ // Adjust number of filters, if necessary
/* if (nchannels > _freqWeightingFilter.size()) { */ if (nchannels > _freqWeightingFilter.size()) {
/* while (nchannels > _freqWeightingFilter.size()) { */ while (nchannels > _freqWeightingFilter.size()) {
/* _freqWeightingFilter.emplace_back(_filterPrototype->clone()); */ _freqWeightingFilter.emplace_back(_filterPrototype->clone());
/* } */ }
/* for (auto &filter : _freqWeightingFilter) { */ for (auto &filter : _freqWeightingFilter) {
/* filter->reset(); */ filter->reset();
/* } */ }
/* } */ }
/* // Apply filtering */ // Apply filtering
/* #pragma omp parallel for */ #pragma omp parallel for
/* for (us i = 0; i < nchannels; i++) { */ for (us i = 0; i < nchannels; i++) {
/* vd col = fltdata.col(i); */ vd col = fltdata.col(i);
/* _freqWeightingFilter.at(i)->filter(col); */ _freqWeightingFilter.at(i)->filter(col);
/* fltdata.col(i) = col; */ fltdata.col(i) = col;
/* } */ }
/* } // End of if(_filterPrototype) */ } // End of if(_filterPrototype)
_ps.compute(fltdata); _ps.compute(fltdata);
@ -75,9 +74,4 @@ std::unique_ptr<ccube> RtAps::getCurrentValue() {
auto est = _ps.get_est(); auto est = _ps.get_est();
return std::make_unique<ccube>(est.value_or(ccube())); return std::make_unique<ccube>(est.value_or(ccube()));
/* return std::move(_latest_est); */
/* if (_latest_est) { */
/* return std::make_unique<cube>(cube(*_latest_est)); */
/* } else */
/* return nullptr; */
} }