ProteoWizard
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
pwiz::analysis::SavitzkyGolaySmoother< T > Struct Template Reference

#include <SavitzkyGolaySmoother.hpp>

Inheritance diagram for pwiz::analysis::SavitzkyGolaySmoother< T >:
pwiz::analysis::Smoother

Public Member Functions

 SavitzkyGolaySmoother (int polynomialOrder, int windowSize)
 
 ~SavitzkyGolaySmoother ()
 
virtual void smooth (const std::vector< double > &x, const std::vector< double > &y, std::vector< double > &xSmoothed, std::vector< double > &ySmoothed)
 smooth y values to existing vectors using Savitzky-Golay algorithm; preconditions:
 
virtual void smooth_copy (std::vector< double > &x, std::vector< double > &y)
 smooth y values and copy back to the input vectors using Savitzky-Golay algorithm; preconditions:
 
- Public Member Functions inherited from pwiz::analysis::Smoother
virtual ~Smoother ()
 

Static Public Member Functions

static std::vector< T > smooth_copy (const std::vector< T > &data)
 

Private Attributes

boost::shared_ptr< Impl > impl_
 

Detailed Description

template<typename T>
struct pwiz::analysis::SavitzkyGolaySmoother< T >

Definition at line 37 of file SavitzkyGolaySmoother.hpp.

Constructor & Destructor Documentation

◆ SavitzkyGolaySmoother()

template<typename T >
pwiz::analysis::SavitzkyGolaySmoother< T >::SavitzkyGolaySmoother ( int  polynomialOrder,
int  windowSize 
)

◆ ~SavitzkyGolaySmoother()

Member Function Documentation

◆ smooth_copy() [1/2]

template<typename T >
static std::vector< T > pwiz::analysis::SavitzkyGolaySmoother< T >::smooth_copy ( const std::vector< T > &  data)
inlinestatic

Definition at line 40 of file SavitzkyGolaySmoother.hpp.

41 {
42 if (data.size() < 9)
43 return data;
44 typename std::vector<T>::const_iterator start;
45 typename std::vector<T> smoothedData(data.begin(), data.begin()+4);
46 for (start = data.begin();
47 (start+8) != data.end();
48 ++start)
49 {
50 T sum = 59 * *(start+4) + 54 * (*(start+3) + *(start+5)) +
51 39 * (*(start+2) + *(start+6)) + 14 * (*(start+1) + *(start+7)) -
52 21 * (*start + *(start+8));
53 smoothedData.push_back(sum / 231);
54 }
55 smoothedData.insert(smoothedData.end(), data.end()-4, data.end());
56 return smoothedData;
57 }

Referenced by test().

◆ smooth()

template<typename T >
virtual void pwiz::analysis::SavitzkyGolaySmoother< T >::smooth ( const std::vector< double > &  x,
const std::vector< double > &  y,
std::vector< double > &  xSmoothed,
std::vector< double > &  ySmoothed 
)
virtual

smooth y values to existing vectors using Savitzky-Golay algorithm; preconditions:

  • samples within the window must be (approximately) equally spaced

Implements pwiz::analysis::Smoother.

Referenced by test().

◆ smooth_copy() [2/2]

template<typename T >
virtual void pwiz::analysis::SavitzkyGolaySmoother< T >::smooth_copy ( std::vector< double > &  x,
std::vector< double > &  y 
)
virtual

smooth y values and copy back to the input vectors using Savitzky-Golay algorithm; preconditions:

  • samples within the window must be (approximately) equally spaced

Implements pwiz::analysis::Smoother.

Member Data Documentation

◆ impl_

template<typename T >
boost::shared_ptr<Impl> pwiz::analysis::SavitzkyGolaySmoother< T >::impl_
private

Definition at line 54 of file SavitzkyGolaySmoother.hpp.


The documentation for this struct was generated from the following files: