2020-08-31 04:03:41 +08:00
|
|
|
#ifndef AVERAGING_H
|
|
|
|
#define AVERAGING_H
|
|
|
|
|
|
|
|
#include "Device/device.h"
|
2021-10-21 19:00:34 +08:00
|
|
|
|
2021-02-05 23:41:16 +08:00
|
|
|
#include <array>
|
2020-08-31 04:03:41 +08:00
|
|
|
#include <deque>
|
|
|
|
#include <complex>
|
|
|
|
|
|
|
|
class Averaging
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Averaging();
|
2020-10-30 02:27:04 +08:00
|
|
|
void reset(unsigned int points);
|
2020-08-31 04:03:41 +08:00
|
|
|
void setAverages(unsigned int a);
|
|
|
|
Protocol::Datapoint process(Protocol::Datapoint d);
|
2020-09-17 21:51:20 +08:00
|
|
|
Protocol::SpectrumAnalyzerResult process(Protocol::SpectrumAnalyzerResult d);
|
2020-10-30 02:27:04 +08:00
|
|
|
// Returns the number of averaged sweeps. Value is incremented whenever the last point of the sweep is added.
|
|
|
|
// Returned values are in range 0 to averages
|
2020-08-31 04:03:41 +08:00
|
|
|
unsigned int getLevel();
|
2020-10-30 02:27:04 +08:00
|
|
|
// Returns the number of the currently active sweep. Value is incremented whenever the the first point of the sweep is added
|
|
|
|
// Returned values are in range 0 (when no data has been added yet) to averages
|
|
|
|
unsigned int currentSweep();
|
2020-08-31 04:03:41 +08:00
|
|
|
private:
|
|
|
|
std::vector<std::deque<std::array<std::complex<double>, 4>>> avg;
|
|
|
|
int maxPoints;
|
|
|
|
unsigned int averages;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // AVERAGING_H
|