Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef COMPATFunction_H
00029 #define COMPATFunction_H
00030
00031 #include <QGpCoreTools.h>
00032 #include "CompatDataPoint.h"
00033
00034 #include "QGpCompatibilityDLLExport.h"
00035
00036 namespace QGpCompatibility {
00037
00038 class QGPCOMPATIBILITY_EXPORT CompatFunctionPoint : public CompatDataPoint
00039 {
00040 public:
00041 CompatFunctionPoint(double x, double y, double yErr, double weight)
00042 : CompatDataPoint(y, yErr, weight), _x(x) {}
00043
00044 bool operator<(const CompatFunctionPoint& o) const {return _x<o._x;}
00045 bool operator==(const CompatFunctionPoint& o) const {return _x==o._x;}
00046
00047 double& x() {return _x;}
00048 const double& x() const {return _x;}
00049 private:
00050 double _x;
00051 };
00052
00053 class QGPCOMPATIBILITY_EXPORT CompatFunction
00054 {
00055 TRANSLATIONS("CompatFunction");
00056 public:
00057 CompatFunction();
00058 CompatFunction(QVector<double> * x, QVector<double> * y, QVector<double> * dy);
00059 CompatFunction(QVector<Point>& f);
00060 ~CompatFunction();
00061
00062 void line(double x1, double y1, double x2, double y2);
00063 int size() {return _x ? _x->size() : 0;}
00064 void setX(QVector<double> * x);
00065 void setY(QVector<double> * y);
00066 void setYErr(QVector<double> * dy);
00067 void setWeight(QVector<double> * w);
00068 void set(QVector<Point>& f);
00069 void addPoint(int atIndex, double x, double y, double z);
00070 QVector<double> * x() {return _x;}
00071 QVector<double> * y() {return _y;}
00072 QVector<double> * yErr() {return _yErr;}
00073 QVector<double> * weight() {return _weight;}
00074 double y(double x) {return interpole(x, find(x, _x), _x, _y);}
00075 void sort();
00076 void deleteVectors();
00077 void resample_ds(int n, double min, double max, bool isLog, bool isInv,
00078 double valX, double valY);
00079 void resample(int n, double min, double max, bool isLog, bool isInv, double invalid_value=0);
00080 void resample(QVector<double> * xModel, double invalid_value, bool doInterpole);
00081 void resample(QVector<Point>& xModel, double invalid_value, bool doInterpole);
00082 void cut (double min, double max, bool isInv);
00083 void removeInvalidValues(double invalidValue);
00084 double minX();
00085 double maxX();
00086 int minYAt();
00087 int maxYAt();
00088 double minY();
00089 double maxY();
00090 void resize(int n, bool removeLast=true);
00091
00092 void log10();
00093 void exp10();
00094 void inverseX();
00095 void inverseY(double invalidValue);
00096 void inverseYErr();
00097 void log10Y(double invalidValue);
00098 void log10YErr();
00099 double fitFactor(double x, double val);
00100 double fitFactor(int index, double val);
00101 void getModes(QVector<double>& mean, QVector<double>& stddev);
00102 int closestMax(int starti);
00103 void multiplyX(double value);
00104 void multiplyXbyY();
00105
00106 double average();
00107 double stddev(double average);
00108 protected:
00109 QVector<double> * _x;
00110 QVector<double> * _y;
00111 QVector<double> * _yErr;
00112 QVector<double> * _weight;
00113
00114
00115
00116
00117
00118 bool _isSorted;
00119
00120 int _n2;
00121 int find(double val, QVector<double> * inVector);
00122 double interpole(double val, int indexInVector,
00123 QVector<double> * inVector,
00124 QVector<double> * outVector);
00125 };
00126
00127 }
00128
00129 #endif // COMPATFUNCTION_H