libpappsomspp
Library for mass spectrometry
|
uses Savitsky-Golay filter on trace More...
#include <savgolfilter.h>
Public Member Functions | |
FilterSavitzkyGolay (int nL, int nR, int m, int lD, bool convolveWithNr=false) | |
FilterSavitzkyGolay (const FilterSavitzkyGolay &other) | |
virtual | ~FilterSavitzkyGolay () |
FilterSavitzkyGolay & | operator= (const FilterSavitzkyGolay &other) |
Trace & | filter (Trace &data_points) const override |
SavGolParams | getParameters () const |
char | runFilter (double *y_data_p, double *y_filtered_data_p, int data_point_count) const |
Perform the Savitzky-Golay filtering process. More... | |
void | filteredData (std::vector< pappso_double > &data) |
Private Member Functions | |
int * | ivector (long nl, long nh) const |
pappso_double * | dvector (long nl, long nh) const |
pappso_double ** | dmatrix (long nrl, long nrh, long ncl, long nch) const |
void | free_ivector (int *v, long nl, long nh) const |
void | free_dvector (pappso_double *v, long nl, long nh) const |
void | free_dmatrix (pappso_double **m, long nrl, long nrh, long ncl, long nch) const |
void | lubksb (pappso_double **a, int n, int *indx, pappso_double b[]) const |
void | ludcmp (pappso_double **a, int n, int *indx, pappso_double *d) const |
void | four1 (pappso_double data[], unsigned long nn, int isign) |
void | twofft (pappso_double data1[], pappso_double data2[], pappso_double fft1[], pappso_double fft2[], unsigned long n) |
void | realft (pappso_double data[], unsigned long n, int isign) |
char | convlv (pappso_double data[], unsigned long n, pappso_double respns[], unsigned long m, int isign, pappso_double ans[]) |
char | sgcoeff (pappso_double c[], int np, int nl, int nr, int ld, int m) const |
QString | toString () const |
Return a string with the textual representation of the configuration data. More... | |
Private Attributes | |
int | m_nL = 15 |
number of data points on the left of the filtered point More... | |
int | m_nR = 15 |
number of data points on the right of the filtered point More... | |
int | m_m = 4 |
int | m_lD = 0 |
bool | m_convolveWithNr = false |
set to false for best results More... | |
pappso_double * | m_x |
C array of keys of the Trace. More... | |
pappso_double * | m_yr |
C array of raw values of the Trace. More... | |
pappso_double * | m_yf |
C array of filtered values after the computation has been performed. More... | |
uses Savitsky-Golay filter on trace
Definition at line 110 of file savgolfilter.h.
pappso::FilterSavitzkyGolay::FilterSavitzkyGolay | ( | int | nL, |
int | nR, | ||
int | m, | ||
int | lD, | ||
bool | convolveWithNr = false |
||
) |
Construct a FilterSavitzkyGolay instance using the Savitzky-Golay parameters
nL | number of data point left of the point being filtered |
nR | number of data point right of the point being filtered |
m | order of the polynomial to use in the regression analysis |
lD | order of the derivative to extract |
convolveWithNr | set to false |
Definition at line 54 of file savgolfilter.cpp.
References m_convolveWithNr, m_lD, m_m, m_nL, and m_nR.
pappso::FilterSavitzkyGolay::FilterSavitzkyGolay | ( | const FilterSavitzkyGolay & | other | ) |
Copy constructor
other | TODO |
Definition at line 65 of file savgolfilter.cpp.
References m_convolveWithNr, m_lD, m_m, m_nL, and m_nR.
|
virtual |
|
private |
Definition at line 485 of file savgolfilter.cpp.
References dvector(), free_dvector(), realft(), and twofft().
Referenced by runFilter().
|
private |
|
private |
Definition at line 175 of file savgolfilter.cpp.
Referenced by convlv(), filter(), ludcmp(), runFilter(), and sgcoeff().
Implements pappso::FilterInterface.
Definition at line 100 of file savgolfilter.cpp.
References dvector(), m_convolveWithNr, and runFilter().
void pappso::FilterSavitzkyGolay::filteredData | ( | std::vector< pappso_double > & | data | ) |
|
private |
|
private |
Definition at line 231 of file savgolfilter.cpp.
Referenced by sgcoeff().
|
private |
Definition at line 224 of file savgolfilter.cpp.
Referenced by convlv(), ludcmp(), runFilter(), and sgcoeff().
|
private |
Definition at line 217 of file savgolfilter.cpp.
Referenced by sgcoeff().
SavGolParams pappso::FilterSavitzkyGolay::getParameters | ( | ) | const |
Definition at line 140 of file savgolfilter.cpp.
References m_convolveWithNr, m_lD, m_m, m_nL, and m_nR.
|
private |
|
private |
Definition at line 240 of file savgolfilter.cpp.
References pappso::a, pappso::b, and pappso::sum.
Referenced by sgcoeff().
|
private |
Definition at line 271 of file savgolfilter.cpp.
References pappso::a, dvector(), free_dvector(), and pappso::sum.
Referenced by sgcoeff().
FilterSavitzkyGolay & pappso::FilterSavitzkyGolay::operator= | ( | const FilterSavitzkyGolay & | other | ) |
Definition at line 82 of file savgolfilter.cpp.
References m_convolveWithNr, m_lD, m_m, m_nL, and m_nR.
|
private |
char pappso::FilterSavitzkyGolay::runFilter | ( | double * | y_data_p, |
double * | y_filtered_data_p, | ||
int | data_point_count | ||
) | const |
|
private |
Definition at line 535 of file savgolfilter.cpp.
References pappso::a, pappso::b, pappso::c, dmatrix(), dvector(), free_dmatrix(), free_dvector(), free_ivector(), ivector(), lubksb(), ludcmp(), and pappso::sum.
Referenced by runFilter().
|
private |
Return a string with the textual representation of the configuration data.
Definition at line 148 of file savgolfilter.cpp.
References m_convolveWithNr, m_lD, m_m, m_nL, and m_nR.
|
private |
|
private |
set to false for best results
Definition at line 160 of file savgolfilter.h.
Referenced by filter(), FilterSavitzkyGolay(), getParameters(), operator=(), and toString().
|
private |
specifies the order of the derivative to extract from the Savitzky-Golay smoothing algorithm (for regular smoothing, use 0)
Definition at line 157 of file savgolfilter.h.
Referenced by FilterSavitzkyGolay(), getParameters(), operator=(), runFilter(), and toString().
|
private |
order of the polynomial to use in the regression analysis leading to the Savitzky-Golay coefficients (typically between 2 and 6)
Definition at line 154 of file savgolfilter.h.
Referenced by FilterSavitzkyGolay(), getParameters(), operator=(), runFilter(), and toString().
|
private |
number of data points on the left of the filtered point
Definition at line 150 of file savgolfilter.h.
Referenced by FilterSavitzkyGolay(), getParameters(), operator=(), runFilter(), and toString().
|
private |
number of data points on the right of the filtered point
Definition at line 152 of file savgolfilter.h.
Referenced by FilterSavitzkyGolay(), getParameters(), operator=(), runFilter(), and toString().
|
private |
C array of keys of the Trace.
Definition at line 166 of file savgolfilter.h.
|
private |
C array of filtered values after the computation has been performed.
Definition at line 172 of file savgolfilter.h.
|
private |
C array of raw values of the Trace.
Definition at line 169 of file savgolfilter.h.