Updated PPM to give clip indices length same as number of channels. Grouped the real time components to group dsp/rt.

This commit is contained in:
Anne de Jong 2022-10-04 09:48:32 +02:00
parent 5f1a207104
commit e900a5ddad
5 changed files with 34 additions and 14 deletions

View File

@ -17,8 +17,9 @@
class Fft_impl; class Fft_impl;
/** /**
* Perform forward FFT's on real time data. Computes single-sided spectra, * @brief Perform forward FFT's on real time data. Computes single-sided spectra,
* equivalent to Numpy's rfft and irfft functions. * equivalent to Numpy's rfft and irfft functions. But then faster as it can
* use a fast FFT backend, such as FFTW.
*/ */
class Fft { class Fft {
std::unique_ptr<Fft_impl> _impl; std::unique_ptr<Fft_impl> _impl;

View File

@ -59,10 +59,10 @@ bool PPMHandler::inCallback_threaded(const DaqData &d) {
std::tuple<vd, arma::uvec> PPMHandler::getCurrentValue() const { std::tuple<vd, arma::uvec> PPMHandler::getCurrentValue() const {
std::scoped_lock<std::mutex> lck(_mtx); std::scoped_lock<std::mutex> lck(_mtx);
return {20 * arma::log10(_cur_max + arma::datum::eps).as_col(), arma::uvec clips(_clip_time.size(), arma::fill::zeros);
arma::find(_clip_time >= 1.0)}; clips.elem(arma::find(_clip_time >= 0)).fill(1);
/* return {(_cur_max + arma::datum::eps).as_col(), */
/* arma::find(_clip_time >= 1.0)}; */ return {20 * arma::log10(_cur_max + arma::datum::eps).as_col(), clips};
} }
void PPMHandler::reset(const Daq *daq) { void PPMHandler::reset(const Daq *daq) {

View File

@ -12,6 +12,9 @@
/** /**
* \addtogroup dsp * \addtogroup dsp
* @{ * @{
*
* \addtogroup rt
* @{
*/ */
@ -82,3 +85,4 @@ class PPMHandler: public ThreadedInDataHandler {
}; };
/** @} */ /** @} */
/** @} */

View File

@ -4,6 +4,16 @@
const us RINGBUFFER_SIZE = 1024; const us RINGBUFFER_SIZE = 1024;
/**
* \addtogroup dsp
* @{
*
* \defgroup rt Real time signal handlers
* @{
*/
/** /**
* @brief Threaded in data handler. Buffers inCallback data and calls a * @brief Threaded in data handler. Buffers inCallback data and calls a
* callback with the same signature on a different thread. * callback with the same signature on a different thread.
@ -46,3 +56,7 @@ class ThreadedInDataHandler: public InDataHandler {
virtual bool inCallback_threaded(const DaqData&) = 0; virtual bool inCallback_threaded(const DaqData&) = 0;
}; };
/** @} */
/** @} */

View File

@ -1,6 +1,6 @@
/* #define DEBUGTRACE_ENABLED */ /* #define DEBUGTRACE_ENABLED */
#include <carma>
#include "debugtrace.hpp" #include "debugtrace.hpp"
#include <carma>
#include "lasp_ppm.h" #include "lasp_ppm.h"
#include "lasp_streammgr.h" #include "lasp_streammgr.h"
#include "lasp_threadedindatahandler.h" #include "lasp_threadedindatahandler.h"
@ -149,6 +149,7 @@ void init_datahandler(py::module &m) {
ppm.def("getCurrentValue", [](const PPMHandler &ppm) { ppm.def("getCurrentValue", [](const PPMHandler &ppm) {
auto [level, clip] = ppm.getCurrentValue(); auto [level, clip] = ppm.getCurrentValue();
return py::make_tuple(carma::col_to_arr(level), carma::col_to_arr(clip)); return py::make_tuple(carma::col_to_arr(std::move(level)),
carma::col_to_arr(std::move(clip)));
}); });
} }