qavrg 0.0.28
|
00001 #ifndef QAVRGFITTER_H 00002 #define QAVRGFITTER_H 00003 00004 #include <QObject> 00005 #include <QMutex> 00006 #include <QVector> 00007 #include "qcepproperty.h" 00008 00009 class QavrgAcquisition; 00010 00011 class QavrgFitter : public QObject 00012 { 00013 Q_OBJECT; 00014 00015 public: 00016 QavrgFitter(QavrgAcquisition *acq, int chan); 00017 ~QavrgFitter(); 00018 00019 public slots: 00020 void performCalculation(); 00021 00022 QVector<double> readResult(int parm, int start, int nbins); 00023 QVector<double> readResult(int parm); 00024 double readResult(int parm, int bin); 00025 double readResultAverage(int parm, int start, int nbins); 00026 double readResultBunchAverage(int parm, int bunch, int norbits); 00027 00028 QVector<double> get_RawData(int start, int nbins); 00029 QVector<double> get_RawData(); 00030 double get_RawData(int bin); 00031 00032 QVector<double> get_ReferenceData(int start, int nbins); 00033 QVector<double> get_ReferenceData(); 00034 double get_ReferenceData(int bin); 00035 00036 QVector<double> get_DarkData(int start, int nbins); 00037 QVector<double> get_DarkData(); 00038 double get_DarkData(int bin); 00039 00040 QVector<double> get_FitData(int start, int nbins); 00041 QVector<double> get_FitData(); 00042 double get_FitData(int bin); 00043 00044 public: 00045 void resize(int nsamples); 00046 00047 void setReferenceData(); 00048 void saveReferenceData(); 00049 void loadReferenceData(); 00050 00051 void setDarkData(); 00052 void saveDarkData(); 00053 void loadDarkData(); 00054 00055 QMutex *mutex(); 00056 double *rawDataPtr(); 00057 double *referenceDataPtr(); 00058 double *darkDataPtr(); 00059 00060 int resultSize(); 00061 00062 // QList<double> calculateFittedValues(double startpos, double endpos); 00063 // QList<double> calculateBackground(double startpos, double edgepos); 00064 00065 void prepareCalculation(); 00066 void readSettings(QSettings *settings); 00067 void writeSettings(QSettings *settings); 00068 00069 double inputFullScale(int index) const; 00070 double get_InputFullScale() const; 00071 void set_InputFullScale(double val); 00072 00073 enum { 00074 Background, 00075 Slope, 00076 PeakHeight 00077 }; 00078 00079 private: 00080 QString referenceDataPath(); 00081 QString darkDataPath(); 00082 00083 private: 00084 /*mutable*/ QMutex m_Mutex; 00085 QavrgAcquisition *m_Acquisition; 00086 int m_Channel; 00087 00088 int m_NSamples; 00089 QVector<double> m_RawData; 00090 QVector<double> m_DarkData; 00091 QVector<double> m_ReferenceData; 00092 QVector<double> m_FitData; 00093 00094 QVector< QVector<double> > m_Results; 00095 int m_ResultSize; 00096 00097 public: 00098 Q_PROPERTY(double inputFullScale READ get_InputFullScale WRITE set_InputFullScale STORED false); 00099 Q_PROPERTY(int inputGain READ get_InputGain WRITE set_InputGain); 00100 QCEP_INTEGER_PROPERTY(InputGain); 00101 Q_PROPERTY(double inputOffset READ get_InputOffset WRITE set_InputOffset); 00102 QCEP_DOUBLE_PROPERTY(InputOffset); 00103 Q_PROPERTY(int inputBandwidth READ get_InputBandwidth WRITE set_InputBandwidth); 00104 QCEP_INTEGER_PROPERTY(InputBandwidth); 00105 Q_PROPERTY(int inputCoupling READ get_InputCoupling WRITE set_InputCoupling); 00106 QCEP_INTEGER_PROPERTY(InputCoupling); 00107 00108 Q_PROPERTY(double fittingOffset READ get_FittingOffset WRITE set_FittingOffset); 00109 QCEP_DOUBLE_PROPERTY(FittingOffset); 00110 Q_PROPERTY(int fittingStart READ get_FittingStart WRITE set_FittingStart); 00111 QCEP_INTEGER_PROPERTY(FittingStart); 00112 Q_PROPERTY(int fittingEnd READ get_FittingEnd WRITE set_FittingEnd); 00113 QCEP_INTEGER_PROPERTY(FittingEnd); 00114 00115 Q_PROPERTY(bool displayData READ get_DisplayData WRITE set_DisplayData); 00116 QCEP_BOOLEAN_PROPERTY(DisplayData); 00117 Q_PROPERTY(bool displayRaw READ get_DisplayRaw WRITE set_DisplayRaw); 00118 QCEP_BOOLEAN_PROPERTY(DisplayRaw); 00119 Q_PROPERTY(bool displayReference READ get_DisplayReference WRITE set_DisplayReference); 00120 QCEP_BOOLEAN_PROPERTY(DisplayReference); 00121 Q_PROPERTY(bool displayDark READ get_DisplayDark WRITE set_DisplayDark); 00122 QCEP_BOOLEAN_PROPERTY(DisplayDark); 00123 Q_PROPERTY(bool displayFit READ get_DisplayFit WRITE set_DisplayFit); 00124 QCEP_BOOLEAN_PROPERTY(DisplayFit); 00125 00126 Q_PROPERTY(bool darkAvailable READ get_DarkAvailable WRITE set_DarkAvailable STORED false); 00127 QCEP_BOOLEAN_PROPERTY(DarkAvailable); 00128 Q_PROPERTY(bool referenceAvailable READ get_ReferenceAvailable WRITE set_ReferenceAvailable STORED false); 00129 QCEP_BOOLEAN_PROPERTY(ReferenceAvailable); 00130 // Q_PROPERTY(bool darkChanged READ get_DarkChanged WRITE set_DarkChanged STORED false); 00131 // QCEP_BOOLEAN_PROPERTY(DarkChanged); 00132 // Q_PROPERTY(bool referenceChanged READ get_ReferenceChanged WRITE set_ReferenceChanged STORED false); 00133 // QCEP_BOOLEAN_PROPERTY(ReferenceChanged); 00134 }; 00135 00136 #endif