Electric Tiger DAQ  1.0.0
Data Acquisition Software for the Electric Tiger Experiment
modetrack.h
1 #ifndef MODETRACK_H
2 #define MODETRACK_H
3 
4 //C System-Headers
5 //
6 //C++ System headers
7 #include <tuple>
8 #include <vector>
9 #include <map>
10 //Qt Headers
11 //
12 //OpenCV Headers
13 //
14 //Boost Headers
15 //
16 //Project specific headers
17 #include "../Generics/generics.h"
18 #include "mode_track_failure.h"
19 
26 class ModeTrack {
27  public:
28  ModeTrack();
29  ~ModeTrack();
30 
37  void SetBackground( const std::vector< data_triple< double > >& background_list );
38 
58  double GetPeaksGauss( const std::vector< data_triple< double > >& power_list, int mod_number );
59 
81  double GetPeaksBiLat( const std::vector< data_triple< double > >& power_list, int mod_number );
82 
97  double GetMaxPeak( const std::vector< data_triple< double > >& power_list );
98  //
99  void SetLowerBound( double frequency );
100  //
101  void SetUpperBound( double frequency );
102 
103  private:
104  //
105  enum Method { Gauss, BiLat };
106  //
107  double lower_bound = 0.0, upper_bound = 0.0;
108  //
109  double max_search_radius = 436.344;
110 
114  std::vector< double > background;
115 
116  //quadratic best-fit coeffecients for each of the four modes.
117  //format is a*x^2+b*x+c and tuple is populated with (a,b,c)
118  //first entry in vector corresponds to the first mode, etc.
119 
127  std::vector<std::tuple<double,double,double>> estimated_paths;
128 
138  std::vector<double> Derivative( const std::vector<double>& data_list );
139 
140 
146  void PopulateBestFitCurves();
147 
148  //Compute the standard deviation of a list
158  double StdDev( const std::vector<double>& data_list );
159 
169  std::vector<double> Normalize(const std::vector<double> &data_list);
170 
180  std::vector<double> Convolve(const std::vector<double> &signal, const std::vector<double> &kernel);
181 
182  //convolve list with a gaussian vector
183 
192  std::vector<double> GaussBlur(const std::vector<double> &data_list);
193 
201  std::vector<double> FindPeaks( const std::vector<double>& data_list, const ModeTrack::Method method );
202 
203  //Check to see if all identified peaks are close to an estimated peak
204  //If an identified peak is not "close" to an estimated peak, fill value from estimation
205 
226  std::map<uint,double> CompareAndFill(const std::vector<double> &peak_list, const std::vector<data_triple<double> > &comparison_list);
227 
228  //Generate estimated peak position from best fit parameters
229 
236  double GenerateSpline(int mode_number, double length);
237 
238  //generate a gaussian kernel
239  //used by 'GaussBlur' function
248  std::vector<double> GaussKernel(int r);
249 
264  std::vector<double> BilateralFilter( const std::vector<double>& data_list, double sigma_s, double sigma_r );
265  //
266  uint FindMaxima( const std::vector<double>& data_list);
267  //
268  double GetPeaks( const std::vector<data_triple<double> > &data_str, int mode_number, Method filter_method);
269  //
270  bool CheckBounds(double frequency);
271 
272  std::vector< double > data_triples_to_power(const std::vector<data_triple<double> > &data_list );
273 };
274 
275 #endif /* MODETRACK_H */
276 
double GetPeaksGauss(const std::vector< data_triple< double > > &power_list, int mod_number)
Identify minima peaks in a list of power data using Gaussian filtering.
Definition: modetrack.cpp:91
double GetMaxPeak(const std::vector< data_triple< double > > &power_list)
Find a local maximum in a list of data.
Definition: modetrack.cpp:121
void SetBackground(const std::vector< data_triple< double > > &background_list)
Set background data which will be subtracted from each measurement.
Definition: modetrack.cpp:138
double GetPeaksBiLat(const std::vector< data_triple< double > > &power_list, int mod_number)
Identify minima peaks in a list of power data using Bilateral filtering.
Definition: modetrack.cpp:101
Base Class for mode tracking algorithims; designed to be wrapped with Swig and called from Python mod...
Definition: modetrack.h:26
Definition: generics.h:48