// ========================================================================= // @author Leonardo Florez Valencia // @email florez-l@javeriana.edu.co // ========================================================================= #ifndef __fpa__Common__PeakDetector__h__ #define __fpa__Common__PeakDetector__h__ #include #include #include namespace fpa { namespace Common { /** */ /** * https://stackoverflow.com/questions/22583391/peak-signal-detection-in-realtime-timeseries-data */ class FPA_EXPORT PeakDetector { public: typedef PeakDetector Self; enum TPeak { NoPeak = 0, PosPeak, NegPeak }; public: PeakDetector( ); virtual ~PeakDetector( ); unsigned long GetKernelSize( ) const; double GetThreshold( ) const; double GetInfluence( ) const; void SetKernelSize( unsigned long k ); void SetThreshold( double t ); void SetInfluence( double i ); const std::vector< double >& GetXValues( ) const; const std::vector< double >& GetYValues( ) const; const std::vector< double >& GetFilteredYValues( ) const; const std::vector< double >& GetAverages( ) const; const std::vector< double >& GetDeviations( ) const; const std::vector< TPeak >& GetPeaks( ) const; void Clear( ); unsigned long GetNumberOfSamples( ) const; TPeak AddValue( double x, double y ); protected: unsigned long m_K; double m_T; double m_I; std::vector< double > m_X; std::vector< double > m_Y; std::vector< double > m_YF; std::vector< double > m_Avg; std::vector< double > m_STD; std::vector< TPeak > m_Peaks; fpa::Common::IncrementalMeanAndVariance m_MeanAndVar; }; } // ecapseman } // ecapseman #endif // __fpa__Common__PeakDetector__h__ // eof - $RCSfile$