00001
00002
00003 #ifndef FITLISTDIALOG_H
00004 #define FITLISTDIALOG_H
00005
00006 #include <qtextedit.h>
00007 #include "ListDialog.h"
00008
00009 #ifdef HAVE_GSL
00010 #include <gsl/gsl_multifit_nlin.h>
00011 int fun_f(const gsl_vector *x, void *params, gsl_vector *f);
00012 int fun_df(const gsl_vector *x, void *params, gsl_matrix *J);
00013 int fun_fdf(const gsl_vector *x, void *params, gsl_vector *f,gsl_matrix *J);
00014 #endif
00015
00016 #define NR_PARS 9
00017
00018 class FitListDialog : public ListDialog
00019 {
00020 Q_OBJECT
00021 public:
00022 FitListDialog(MainWin *mw=0, const char *name=0);
00023 private slots:
00024 void updateModel(int model);
00025 void updateParameter();
00026 void weightChanged();
00027 void saveSettings();
00028 int apply_clicked();
00029 public slots:
00030 void setFunction(QString fun);
00031 void setNrParameter(int par);
00032 void setInitialValue(int par, double v);
00033 double initialValue(int par);
00034 void showResult(bool b=true) { resultcb->setChecked(b); }
00035 void showLabel(bool b=true) { labelcb->setChecked(b); }
00036 void setSteps(int v) { stepsni->setValue(v); }
00037 void setTolerance(double t) { tolle->setText(QString::number(t)); }
00038 void setWeight(int w) { weightcb->setCurrentItem(w); }
00039 void setWeightFunction(QString w);
00040 void setRegion(double a, double b);
00041 void setNegateRegion(bool b=true)
00042 { regioncb->setChecked(b); negate_regioncb->setChecked(b); }
00043 void setBaseline(double b);
00044 void setNrPoints(int v) { numberni->setValue(v); }
00045 void setRange(double a, double b);
00046 void showResiduals(bool b=true) { rescb->setChecked(b); }
00047 int Apply() { return apply_clicked(); }
00048 private:
00049 #ifdef HAVE_GSL
00050 void print_state(int iter, gsl_multifit_fdfsolver * s);
00051 #endif
00052 void saveFunction();
00053 QTextEdit *infote;
00054 KComboBox *modelcb, *weightcb;
00055 QCheckBox *regioncb, *negate_regioncb, *baselinecb, *resultcb, *labelcb, *rescb;
00056 KIntNumInput *parni, *stepsni, *numberni;
00057 KLineEdit *funle, *tolle, *weightle;
00058 KLineEdit *parNle[NR_PARS];
00059 KLineEdit *regionminle, *regionmaxle, *baselinele;
00060 KLineEdit *minle, *maxle;
00061 };
00062
00063 #endif // FITLISTDIALOG_H
00064