diff --git a/src/lasp/dsp/lasp_rtaps.cpp b/src/lasp/dsp/lasp_rtaps.cpp index 1675afe..d7d2de1 100644 --- a/src/lasp/dsp/lasp_rtaps.cpp +++ b/src/lasp/dsp/lasp_rtaps.cpp @@ -1,4 +1,4 @@ -#define DEBUGTRACE_ENABLED +/* #define DEBUGTRACE_ENABLED */ #include "lasp_rtaps.h" #include "debugtrace.hpp" #include @@ -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 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 RtAps::getCurrentValue() { auto est = _ps.get_est(); return std::make_unique(est.value_or(ccube())); - /* return std::move(_latest_est); */ - /* if (_latest_est) { */ - /* return std::make_unique(cube(*_latest_est)); */ - /* } else */ - /* return nullptr; */ }