2022-10-06 19:13:21 +00:00
|
|
|
// lasp_threadedaps.h
|
|
|
|
//
|
|
|
|
// Author: J.A. de Jong - ASCEE
|
|
|
|
//
|
|
|
|
// Description: Real Time Spectrum Viewer
|
|
|
|
#pragma once
|
|
|
|
#include "lasp_avpowerspectra.h"
|
|
|
|
#include "lasp_filter.h"
|
|
|
|
#include "lasp_mathtypes.h"
|
|
|
|
#include "lasp_threadedindatahandler.h"
|
|
|
|
#include <memory>
|
|
|
|
#include <mutex>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \addtogroup dsp
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* \addtogroup rt
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
class RtAps : public ThreadedInDataHandler {
|
|
|
|
|
|
|
|
std::unique_ptr<Filter> _filterPrototype;
|
2022-10-16 16:39:13 +00:00
|
|
|
std::vector<std::unique_ptr<Filter>> _freqWeightingFilters;
|
2022-10-06 19:13:21 +00:00
|
|
|
|
2022-10-16 19:26:06 +00:00
|
|
|
/**
|
|
|
|
* @brief Mutex only for _ps. Other members are only accessed in thread.
|
|
|
|
*/
|
|
|
|
mutable std::mutex _ps_mtx;
|
2022-10-06 19:13:21 +00:00
|
|
|
AvPowerSpectra _ps;
|
|
|
|
|
2022-10-06 19:48:57 +00:00
|
|
|
public:
|
2022-10-06 19:13:21 +00:00
|
|
|
/**
|
|
|
|
* @brief Initialize RtAps.
|
|
|
|
*
|
|
|
|
* @param mgr StreamMgr singleton reference
|
|
|
|
* @param freqWeightingFilter Optionally: the frequency weighting filter.
|
|
|
|
* Nullptr should be given for Z-weighting.
|
|
|
|
* @param For all other arguments, see constructor of AvPowerSpectra
|
|
|
|
*/
|
|
|
|
RtAps(StreamMgr &mgr, const Filter *freqWeightingFilter, const us nfft = 2048,
|
2022-10-06 19:48:57 +00:00
|
|
|
const Window::WindowType w = Window::WindowType::Hann,
|
2022-10-11 12:50:44 +00:00
|
|
|
const d overlap_percentage = 50., const d time_constant = -1);
|
|
|
|
~RtAps();
|
2022-10-06 19:13:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Get the latest estimate of the power spectra
|
|
|
|
*
|
2022-10-16 19:26:06 +00:00
|
|
|
* @return If available, the latest estimate. If no estimate available, an
|
|
|
|
* empty ccube().
|
2022-10-06 19:13:21 +00:00
|
|
|
*/
|
2022-10-16 19:26:06 +00:00
|
|
|
ccube getCurrentValue() const;
|
2022-10-06 19:13:21 +00:00
|
|
|
|
|
|
|
bool inCallback_threaded(const DaqData &) override final;
|
|
|
|
void reset(const Daq *) override final;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** @} */
|
|
|
|
/** @} */
|