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