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;
/**
* Perform forward FFT's on real time data. Computes single-sided spectra,
* equivalent to Numpy's rfft and irfft functions.
* @brief Perform forward FFT's on real time data. Computes single-sided spectra,
* equivalent to Numpy's rfft and irfft functions. But then faster as it can
* use a fast FFT backend, such as FFTW.
*/
class Fft {
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::scoped_lock<std::mutex> lck(_mtx);
return {20 * arma::log10(_cur_max + arma::datum::eps).as_col(),
arma::find(_clip_time >= 1.0)};
/* return {(_cur_max + arma::datum::eps).as_col(), */
/* arma::find(_clip_time >= 1.0)}; */
arma::uvec clips(_clip_time.size(), arma::fill::zeros);
clips.elem(arma::find(_clip_time >= 0)).fill(1);
return {20 * arma::log10(_cur_max + arma::datum::eps).as_col(), clips};
}
void PPMHandler::reset(const Daq *daq) {

View File

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

View File

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

View File

@ -1,6 +1,6 @@
/* #define DEBUGTRACE_ENABLED */
#include <carma>
#include "debugtrace.hpp"
#include <carma>
#include "lasp_ppm.h"
#include "lasp_streammgr.h"
#include "lasp_threadedindatahandler.h"
@ -149,6 +149,7 @@ void init_datahandler(py::module &m) {
ppm.def("getCurrentValue", [](const PPMHandler &ppm) {
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)));
});
}