SmoothFilter.h
Go to the documentation of this file.
/***************************************************************************
File : SmoothFilter.h
Project : QtiPlot
--------------------------------------------------------------------
Copyright : (C) 2007 by Ion Vasilief
Email (use @ for *) : ion_vasilief*yahoo.fr
Description : Numerical smoothing of data sets
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef SMOOTHFILTER_H
#define SMOOTHFILTER_H
#include "Filter.h"
#include <gsl/gsl_matrix_double.h>
class SmoothFilter : public Filter
{
Q_OBJECT
public:
SmoothFilter(ApplicationWindow *parent, QwtPlotCurve *c, int m = 3);
SmoothFilter(ApplicationWindow *parent, QwtPlotCurve *c, double start, double end, int m = 3);
SmoothFilter(ApplicationWindow *parent, Graph *g, const QString& curveTitle, int m = 3);
SmoothFilter(ApplicationWindow *parent, Graph *g, const QString& curveTitle, double start, double end, int m = 3);
SmoothFilter(ApplicationWindow *parent, Table *t, const QString& xCol, const QString& yCol, int start = 0, int end = -1, int m = 3);
enum SmoothMethod{SavitzkyGolay = 1, FFT = 2, Average = 3, Lowess = 4};
int method(){return (int)d_method;};
void setMethod(int m);
void setSmoothPoints(int points, int left_points = 0);
void setPolynomOrder(int order);
void setLowessParameter(double f, int iterations);
private:
void init(int m);
void calculateOutputData(double *x, double *y);
void smoothFFT(double *x, double *y);
void smoothAverage(double *x, double *y);
void smoothSavGol(double *x, double *y);
void smoothLowess(double *x, double *y);
static int savitzkyGolayCoefficients(int points, int polynom_order, gsl_matrix *h);
SmoothMethod d_method;
int d_smooth_points;
int d_sav_gol_points;
int d_polynom_order;
double d_f;
int d_iterations;
};
#endif
SmoothFilter::Lowess
Definition: SmoothFilter.h:46
SmoothFilter::d_method
SmoothMethod d_method
The smooth method.
Definition: SmoothFilter.h:66
SmoothFilter::smoothFFT
void smoothFFT(double *x, double *y)
Definition: SmoothFilter.cpp:127
SmoothFilter::method
int method()
Definition: SmoothFilter.h:48
Graph
A 2D-plotting widget.
Definition: Graph.h:123
SmoothFilter::savitzkyGolayCoefficients
static int savitzkyGolayCoefficients(int points, int polynom_order, gsl_matrix *h)
Compute Savitzky-Golay coefficients and store them into #h.
Definition: SmoothFilter.cpp:200
SmoothFilter::d_f
double d_f
Parameter f for the Lowess algorithm.
Definition: SmoothFilter.h:78
SmoothFilter::setSmoothPoints
void setSmoothPoints(int points, int left_points=0)
Definition: SmoothFilter.cpp:333
SmoothFilter::setPolynomOrder
void setPolynomOrder(int order)
Sets the polynomial order in the Savitky-Golay algorithm.
Definition: SmoothFilter.cpp:351
Filter
Abstract base class for data analysis operations.
Definition: Filter.h:43
Filter.h
SmoothFilter::SmoothMethod
SmoothMethod
Definition: SmoothFilter.h:46
SmoothFilter::calculateOutputData
void calculateOutputData(double *x, double *y)
Calculates the data for the output curve and store it in the X an Y vectors.
Definition: SmoothFilter.cpp:99
SmoothFilter::Average
Definition: SmoothFilter.h:46
SmoothFilter::smoothAverage
void smoothAverage(double *x, double *y)
Definition: SmoothFilter.cpp:149
Filter::init
void init()
Definition: Filter.cpp:79
SmoothFilter::setLowessParameter
void setLowessParameter(double f, int iterations)
Definition: SmoothFilter.cpp:368
SmoothFilter::d_polynom_order
int d_polynom_order
Polynomial order in the Savitky-Golay algorithm (see Numerical Receipes in C for details).
Definition: SmoothFilter.h:75
ApplicationWindow
QtiPlot's main window.
Definition: ApplicationWindow.h:133
FFT
Definition: FFT.h:34
SmoothFilter::setMethod
void setMethod(int m)
Definition: SmoothFilter.cpp:88
SmoothFilter
Definition: SmoothFilter.h:35
SmoothFilter::d_sav_gol_points
int d_sav_gol_points
The number of left adjacents points used by the Savitky-Golay algorithm.
Definition: SmoothFilter.h:72
SmoothFilter::d_smooth_points
int d_smooth_points
The number of adjacents points used to smooth the data set.
Definition: SmoothFilter.h:69
SmoothFilter::SavitzkyGolay
Definition: SmoothFilter.h:46
SmoothFilter::SmoothFilter
SmoothFilter(ApplicationWindow *parent, QwtPlotCurve *c, int m=3)
Definition: SmoothFilter.cpp:41
Filter::x
double * x()
Returns the x values of the input data set.
Definition: Filter.h:98
Filter::y
double * y()
Returns the y values of the input data set.
Definition: Filter.h:100
SmoothFilter::smoothSavGol
void smoothSavGol(double *x, double *y)
Savitzky-Golay smoothing of (uniformly distributed) data.
Definition: SmoothFilter.cpp:261
Table
MDI window providing a spreadsheet table with column logic.
Definition: Table.h:57
SmoothFilter::d_iterations
int d_iterations
Number of iterations for the Lowess algorithm.
Definition: SmoothFilter.h:81
SmoothFilter::smoothLowess
void smoothLowess(double *x, double *y)
Definition: SmoothFilter.cpp:393