parser and handler of user input mbs-files More...
#include <fitmodel.h>
Public Slots | |
void | panel_input (int irun, int ipara) |
< parameter ipara of run irun was modified, recalc model | |
void | view_run (int i) |
add run i to the plot | |
void | view_run_only (int i) |
show only run i on the plot | |
void | hide_run (int i) |
set initial value from parameter declaration if fit, else set -1 More... | |
void | reset_error (int runi, int parai, bool fit) |
void | add_noise () |
statistical noise to current model | |
Signals | |
void | ready_to_plot () |
indicates that data is processed and can be viewed More... | |
void | all_fitting_finished () |
uses in fit_hidden_wait() to stop QEventLoop and proceed in code | |
Public Member Functions | |
fitmodel (QString filename) | |
void | plot (plot2D *plotter, plot2D *MEM) |
void | fit () |
creates fitthread instances to fit the whole data set More... | |
void | fit_hidden_wait () |
like fit, but without progressbar | |
void | errors () |
like fit, but error calculation | |
double | get_total_chi2 () |
sum of chi2 values of all runs | |
double | get_run_chi2 (int runi) |
chi2 value of the runi-th run | |
double | calc_changed_runs () |
int | get_affect (int i) |
returns, which run is affected by the i-th parameter More... | |
int | calc_run (int i) |
recalculates the i-th run | |
int | is_valid () |
returns fitmodel::isvalid | |
void | close_fmpa () |
void | generate_default (QStringList flds) |
generates default mbs-file working upon the flds files | |
short | from_fld (char *filename, double **xdata, double **ydata, int *count) |
fmPanel * | get_pannel () |
return pointer to fitmodel::fmpa, used by mainwindow to set up widget | |
Public Attributes | |
int | cpara |
count of fit parameters of model, size of fitmodel::fmp array | |
fmPara * | fmp |
fitparameters used in model, count saved in fitmodel::cpara | |
int | crun |
count of runs in the model, size of fitmodel::run array | |
RUN * | run |
runs used in model, count saved in fitmodel::crun | |
parser and handler of user input mbs-files
a mbs file if a well structured text file to handle a fitting task. It necessarily consists of a FITPARAMETER, a THEORY and RUN block. If read in succesfully the data construct is used to perform a fitting. Base entitiy of a fitodel is the fitmodel::run, a array of RUN struct to hold datasets to be fitted. The fitting function fitmodel::mbs is specified first independently and connect via the fitting parameters, being declared at once for all runs and later resolved to runspecific, global and constant parameters. Thus there exists a reference array fitmodel::rData which holds the current value of a fitting parameter concerning a specific run. It points to the fitmodel::pData, where these values are stored. Note, that in fitmodel::pData the elements are grouped together to run-bloccks allowing multithreaded calculation on this array if runspecific fitting task is executed. The inititial parsing is done in the fitmodel() constructor. Fitting itself is performed with the help of fitthread class. It requires the fitmodel::calc_run method calc the new chi2 to eveluate cahnged fitting parameters.
double fitmodel::calc_changed_runs | ( | ) |
based on pIsChanged information
void fitmodel::close_fmpa | ( | ) |
closes fitmodel::fmpa
void fitmodel::fit | ( | ) |
creates fitthread instances to fit the whole data set
The fitting is outsourced to the fitthread class. This class interacts with fitmodel by modifying fitmodel::pData, disposing the recalculation of the concerning runs and interrogating the new chi2 values. This is the basic organisation of multithreading in Moessfit for seriell fits. Every single run then has an individual fitthread. In case of global fits, the multithreading is applied when calculating the indivdual runs.
short fitmodel::from_fld | ( | char * | filename, |
double ** | xdata, | ||
double ** | ydata, | ||
int * | count | ||
) |
load data from file, overloaded
int fitmodel::get_affect | ( | int | i | ) |
returns, which run is affected by the i-th parameter
the fitparameters are stored in pdata, starting with global parameters if available and than run-wise the run specific parameter. affect and get_affect give the run-index, to which the i-th parameter corresponds. In case of a global parameter -1 will be returned
|
slot |
set initial value from parameter declaration if fit, else set -1
hide run i from the plot
|
signal |
indicates that data is processed and can be viewed
fitmodel does not hold its own plot2D instances, but it is capable to used a foreign plot2D to plot its own data. At the moment, mainwindow is master of the plot windows, and triggers fitmodel::plot() on ready_to_plot signal, using the main window plot2D childs.