Git commit 5e5779ea8b14a01782b134ecb980489c716f3280 by Stefan Gerlach. Committed on 31/12/2016 at 22:31. Pushed by sgerlach into branch 'master'. updated Maxwell-Boltzmann, Sech, Levy and Frechet distribution fit model M +6 -6 src/backend/nsl/nsl_fit.c M +4 -9 src/backend/nsl/nsl_fit.h M +7 -12 src/backend/nsl/nsl_sf_stats.c M +3 -3 src/backend/nsl/nsl_sf_stats.h M +17 -48 src/backend/worksheet/plots/cartesian/XYFitCurve.cpp M +26 -28 src/kdefrontend/dockwidgets/XYFitCurveDock.cpp A +- -- src/pics/gsl_distributions/frechet.jpg A +- -- src/pics/gsl_distributions/levy.jpg A +- -- src/pics/gsl_distributions/maxwell_boltzmann.jpg A +- -- src/pics/gsl_distributions/sech.jpg https://commits.kde.org/labplot/5e5779ea8b14a01782b134ecb980489c716f3280 diff --git a/src/backend/nsl/nsl_fit.c b/src/backend/nsl/nsl_fit.c index a46956c8..6b26eb34 100644 --- a/src/backend/nsl/nsl_fit.c +++ b/src/backend/nsl/nsl_fit.c @@ -389,17 +389,17 @@ double nsl_fit_model_weibull_param_deriv(int param, d= ouble x, double k, double l return k/l/sigma * z/y * efactor; return 0; } -double nsl_fit_model_frechet_param_deriv(int param, double x, double a, do= uble mu, double s, double c, double sigma) { - double y =3D (x-mu)/s, efactor =3D exp(-pow(y, -a)); +double nsl_fit_model_frechet_param_deriv(int param, double x, double g, do= uble mu, double s, double a, double sigma) { + double y =3D (x-mu)/s, efactor =3D exp(-pow(y, -g)); = if (param =3D=3D 0) - return c/s/sigma * pow(y, -2.*a-1.) * (a*log(y)*(1.-pow(y, a))+pow(y, a)= ) * efactor; + return a/s/sigma * pow(y, -2.*g-1.) * (g*log(y)*(1.-pow(y, g))+pow(y, g)= ) * efactor; if (param =3D=3D 1) - return c/sigma * a/(s*s)*pow(y, -a-2.) * (a+1.-a*pow(y, -a)) * efactor; + return a/sigma * g/(s*s)*pow(y, -g-2.) * (g+1.-g*pow(y, -g)) * efactor; if (param =3D=3D 2) - return c/sigma * gsl_pow_2(a/s)*pow(y, -2.*a-1.) * (pow(y, a)-1.) * efac= tor; + return a/sigma * gsl_pow_2(g/s)*pow(y, -2.*g-1.) * (pow(y, g)-1.) * efac= tor; if (param =3D=3D 3) - return a/sigma/s * pow(y, -a-1.) * efactor; + return g/sigma/s * pow(y, -g-1.) * efactor; return 0; } double nsl_fit_model_gumbel1_param_deriv(int param, double x, double s, do= uble b, double mu, double a, double sigma) { diff --git a/src/backend/nsl/nsl_fit.h b/src/backend/nsl/nsl_fit.h index ddbee7e8..633ea06e 100644 --- a/src/backend/nsl/nsl_fit.h +++ b/src/backend/nsl/nsl_fit.h @@ -41,12 +41,6 @@ typedef enum {nsl_fit_model_gaussian, nsl_fit_model_lore= ntz, nsl_fit_model_sech, #define NSL_FIT_MODEL_GROWTH_COUNT 8 typedef enum {nsl_fit_model_atan, nsl_fit_model_tanh, nsl_fit_model_algebr= aic_sigmoid, nsl_fit_model_sigmoid, nsl_fit_model_erf, = nsl_fit_model_hill, nsl_fit_model_gompertz, nsl_fit_model_gudermann} nsl_= fit_model_type_growth; -/*TODO: remove later */ -#define NSL_FIT_MODEL_DISTRIBUTION_COUNT 15 -typedef enum { - nsl_fit_model_normal, nsl_fit_model_cauchy_lorentz, nsl_fit_model_maxwell= , nsl_fit_model_poisson, nsl_fit_model_logistic_dist, - nsl_fit_model_lognormal, nsl_fit_model_gamma, nsl_fit_model_laplace, nsl_= fit_model_rayleigh, nsl_fit_model_levy, - nsl_fit_model_chi_square, nsl_fit_model_weibull, nsl_fit_model_frechet, n= sl_fit_model_gumbel, nsl_fit_model_sech_dist} nsl_fit_model_type_distributi= on; = extern const char* nsl_fit_model_category_name[]; extern const char* nsl_fit_model_basic_name[]; @@ -88,17 +82,18 @@ double nsl_fit_model_hill_param_deriv(int param, double= x, double s, double n, d double nsl_fit_model_gompertz_param_deriv(int param, double x, double a, d= ouble b, double c, double sigma); double nsl_fit_model_gudermann_param_deriv(int param, double x, double s, = double mu, double a, double sigma); /* distributions */ -double nsl_fit_model_maxwell_param_deriv(int param, double x, double a, do= uble c, double sigma); double nsl_fit_model_poisson_param_deriv(int param, double x, double l, do= uble a, double sigma); double nsl_fit_model_lognormal_param_deriv(int param, double x, double b, = double mu, double a, double sigma); double nsl_fit_model_gamma_param_deriv(int param, double x, double t, doub= le k, double a, double sigma); double nsl_fit_model_laplace_param_deriv(int param, double x, double s, do= uble mu, double a, double sigma); double nsl_fit_model_rayleigh_param_deriv(int param, double x, double s, d= ouble a, double sigma); -double nsl_fit_model_levy_param_deriv(int param, double x, double g, doubl= e mu, double a, double sigma); double nsl_fit_model_chi_square_param_deriv(int param, double x, double n,= double a, double sigma); double nsl_fit_model_weibull_param_deriv(int param, double x, double k, do= uble l, double mu, double a, double sigma); -double nsl_fit_model_frechet_param_deriv(int param, double x, double a, do= uble mu, double s, double c, double sigma); double nsl_fit_model_gumbel1_param_deriv(int param, double x, double s, do= uble b, double mu, double a, double sigma); + +double nsl_fit_model_maxwell_param_deriv(int param, double x, double a, do= uble c, double sigma); double nsl_fit_model_sech_dist_param_deriv(int param, double x, double s, = double mu, double a, double sigma); +double nsl_fit_model_levy_param_deriv(int param, double x, double g, doubl= e mu, double a, double sigma); +double nsl_fit_model_frechet_param_deriv(int param, double x, double a, do= uble mu, double s, double c, double sigma); = #endif /* NSL_FIT_H */ diff --git a/src/backend/nsl/nsl_sf_stats.c b/src/backend/nsl/nsl_sf_stats.c index d71b7721..75c33d27 100644 --- a/src/backend/nsl/nsl_sf_stats.c +++ b/src/backend/nsl/nsl_sf_stats.c @@ -34,13 +34,12 @@ const char* nsl_sf_stats_distribution_name[] =3D {i18n(= "Gaussian (Normal)"), i18n( i18n("Levy skew alpha-stable"), i18n("Gamma"), i18n("Flat (uniform)"), i1= 8n("Log-normal (Galton)"), i18n("Chi-squared"), i18n("F (Fisher-Snedecor)"), i18n("Student's t"), i18n("Beta"), i18n("Logistic (sech-squared)"), i18n(= "Pareto"), i18n("Weibull"), i18n("Gumbel Type-1 (maximum value; log-Weibull= )"), i18n("Type-2 Gumbel"), i18n("Poisson"), i18n("Bernoulli"), i18n("Binomial= "), i18n("Negative binomial"), i18n("Pascal"), i18n("Geometric"), - i18n("Hypergeometric"), i18n("Logarithmic")}; + i18n("Hypergeometric"), i18n("Logarithmic"), i18n("Maxwell-Boltzmann"), i= 18n("Hyperbolic secant (sech)"), i18n("Levy"), i18n("Frechet (inverse Weibu= ll)")}; const char* nsl_sf_stats_distribution_pic_name[] =3D { - "gaussian", "gaussian_tail", "exponential", "laplace", "exponential_power= ", "cauchy_lorentz", "rayleigh", - "rayleigh_tail", "landau","levy_alpha_stable", "levy_skew_alpha_stable","= gamma", "flat", - "lognormal", "chi_squared", "F", "t", "beta", "logistic", - "pareto", "weibull", "gumbel1", "gumbel2", "poisson", "bernoulli", - "binomial", "binomial_negative", "pascal", "geometric", "hypergeometric",= "logarithmic"}; + "gaussian", "gaussian_tail", "exponential", "laplace", "exponential_power= ", "cauchy_lorentz", "rayleigh", "rayleigh_tail", "landau", + "levy_alpha_stable", "levy_skew_alpha_stable","gamma", "flat", "lognormal= ", "chi_squared", "F", "t", "beta", "logistic", + "pareto", "weibull", "gumbel1", "gumbel2", "poisson", "bernoulli", "binom= ial", "binomial_negative", "pascal", "geometric", + "hypergeometric", "logarithmic", "maxwell_boltzmann", "sech", "levy", "fr= echet"}; const char* nsl_sf_stats_distribution_equation[] =3D { "a/sqrt(2*pi)/s * exp(-((x-mu)/s)^2/2)", "Gaussian tail", "Exponential", "a/(2*s) * exp(-fabs((x-mu)/s))", "Exp power", "a/pi * g/(g^2 + (x-mu)^2)= ", @@ -52,10 +51,6 @@ const char* nsl_sf_stats_distribution_equation[] =3D { "a/s * exp(-(x-mu)/s - b*exp(-(x-mu)/s))", "Gumbel2", "a * l^x/gamma(x+1)= * exp(-l)", "Bernoulli", "Binomial", "Negative binomial", "Pascal", "Geometric", "Hypergeometric", - "Logarithmic"}; + "Logarithmic", "a*sqrt(2/pi) * x^2/s^3 * exp(-(x/s)^2/2)", "a/2/s * sech(= pi/2*(x-mu)/s)", + "a * sqrt(g/(2*pi))/pow(x-mu, 1.5) * exp(-g/2./(x-mu))", "a * g/s*((x-mu)= /s)^(-g-1) * exp(-((x-mu)/s)^(-g))"}; = -/*TODO: "c*sqrt(2/pi) * x^2/a^3 * exp(-(x/a)^2/2)", Maxwell-Boltzmann -"a * sqrt(g/(2*pi))/pow(x-mu, 1.5) * exp(-g/2./(x-mu))" Levy -"c * a/s*((x-mu)/s)^(-a-1) * exp(-((x-mu)/s)^(-a))", Frechet (inverse We= ibull) -"a/2/s * sech(pi/2*(x-mu)/s)"}; Hyperbolic secant (sech) -*/ diff --git a/src/backend/nsl/nsl_sf_stats.h b/src/backend/nsl/nsl_sf_stats.h index 7307c757..cd9bf9fe 100644 --- a/src/backend/nsl/nsl_sf_stats.h +++ b/src/backend/nsl/nsl_sf_stats.h @@ -29,7 +29,7 @@ #ifndef NSL_SF_STATS_H #define NSL_SF_STATS_H = -#define NSL_SF_STATS_DISTRIBUTION_COUNT 31 +#define NSL_SF_STATS_DISTRIBUTION_COUNT 35 #define NSL_SF_STATS_DISTRIBUTION_RNG_COUNT 31 /* GSL RNG distributions */ /* ordered as defined in GSL random number distributions */ typedef enum {nsl_sf_stats_gaussian, nsl_sf_stats_gaussian_tail, nsl_sf_st= ats_exponential, nsl_sf_stats_laplace, nsl_sf_stats_exponential_power, @@ -37,8 +37,8 @@ typedef enum {nsl_sf_stats_gaussian, nsl_sf_stats_gaussia= n_tail, nsl_sf_stats_ex nsl_sf_stats_levy_skew_alpha_stable, nsl_sf_stats_gamma, nsl_sf_stats_fla= t, nsl_sf_stats_lognormal, nsl_sf_stats_chi_squared, nsl_sf_stats_fdist, nsl_sf_stats_tdist, nsl_sf_stats_beta, nsl_sf_stats_l= ogistic, nsl_sf_stats_pareto, nsl_sf_stats_weibull, nsl_sf_stats_gumbel1, nsl_sf_stats_gumbel2, nsl_sf_stats_poisson, nsl_sf_= stats_bernoulli, nsl_sf_stats_binomial, nsl_sf_stats_negative_bionomial, - nsl_sf_stats_pascal, nsl_sf_stats_geometric, nsl_sf_stats_hypergeometric,= nsl_sf_stats_logarithmic} nsl_sf_stats_distribution; -/*TODO: maxwell_boltzmann, inverse_weibull/frechet, sech */ + nsl_sf_stats_pascal, nsl_sf_stats_geometric, nsl_sf_stats_hypergeometric,= nsl_sf_stats_logarithmic, + nsl_sf_stats_maxwell_boltzmann, nsl_sf_stats_sech, nsl_sf_stats_levy, nsl= _sf_stats_frechet} nsl_sf_stats_distribution; /*TODO: CDF, SF, ... */ = extern const char* nsl_sf_stats_distribution_name[]; diff --git a/src/backend/worksheet/plots/cartesian/XYFitCurve.cpp b/src/bac= kend/worksheet/plots/cartesian/XYFitCurve.cpp index bef4abf6..fda7d525 100644 --- a/src/backend/worksheet/plots/cartesian/XYFitCurve.cpp +++ b/src/backend/worksheet/plots/cartesian/XYFitCurve.cpp @@ -239,7 +239,7 @@ int func_f(const gsl_vector* paramValues, void* params,= gsl_vector* f) { = // checks for allowed values of x for different models // TODO: more to check - if (modelCategory =3D=3D nsl_fit_model_distribution && modelType =3D=3D = nsl_fit_model_lognormal) { + if (modelCategory =3D=3D nsl_fit_model_distribution && modelType =3D=3D = nsl_sf_stats_lognormal) { if (x[i] < 0) x[i] =3D 0; } @@ -531,7 +531,9 @@ int func_df(const gsl_vector* paramValues, void* params= , gsl_matrix* J) { case nsl_sf_stats_laplace: case nsl_sf_stats_cauchy_lorentz: case nsl_sf_stats_lognormal: - case nsl_sf_stats_logistic: { + case nsl_sf_stats_logistic: + case nsl_sf_stats_sech: + case nsl_sf_stats_levy: { double s =3D nsl_fit_map_bound(gsl_vector_get(paramValues, 0), min[0], = max[0]); double mu =3D nsl_fit_map_bound(gsl_vector_get(paramValues, 1), min[1],= max[1]); double a =3D nsl_fit_map_bound(gsl_vector_get(paramValues, 2), min[2], = max[2]); @@ -562,6 +564,12 @@ int func_df(const gsl_vector* paramValues, void* param= s, gsl_matrix* J) { case nsl_sf_stats_logistic: gsl_matrix_set(J, i, j, nsl_fit_model_logistic_param_deriv(j, x, s,= mu, a, sigma)); break; + case nsl_sf_stats_sech: + gsl_matrix_set(J, i, j, nsl_fit_model_sech_dist_param_deriv(j, x, s= , mu, a, sigma)); + break; + case nsl_sf_stats_levy: + gsl_matrix_set(J, i, j, nsl_fit_model_levy_param_deriv(j, x, s, mu,= a, sigma)); + break; } } } @@ -673,10 +681,9 @@ int func_df(const gsl_vector* paramValues, void* param= s, gsl_matrix* J) { } break; } - // TODO: nsl_sf_stats -/* case nsl_fit_model_maxwell: { // Y(x) =3D c*sqrt(2/pi) * x^2/a^3 * exp= (-(x/a)^2/2) - double a =3D nsl_fit_map_bound(gsl_vector_get(paramValues, 0), min[0], = max[0]); - double c =3D nsl_fit_map_bound(gsl_vector_get(paramValues, 1), min[1], = max[1]); + case nsl_sf_stats_maxwell_boltzmann: { // Y(x) =3D a*sqrt(2/pi) * x^2/s^= 3 * exp(-(x/s)^2/2) + double s =3D nsl_fit_map_bound(gsl_vector_get(paramValues, 0), min[0], = max[0]); + double a =3D nsl_fit_map_bound(gsl_vector_get(paramValues, 1), min[1], = max[1]); for (size_t i =3D 0; i < n; i++) { x =3D xVector[i]; if (sigmaVector) sigma =3D sigmaVector[i]; @@ -685,36 +692,16 @@ int func_df(const gsl_vector* paramValues, void* para= ms, gsl_matrix* J) { if (fixed[j]) gsl_matrix_set(J, i, j, 0.); else - gsl_matrix_set(J, i, j, nsl_fit_model_maxwell_param_deriv(j, x, a, c= , sigma)); + gsl_matrix_set(J, i, j, nsl_fit_model_maxwell_param_deriv(j, x, s, a= , sigma)); } } break; } -*/ -/* = -*/ -/* case nsl_fit_model_levy: { + case nsl_sf_stats_frechet: { double g =3D nsl_fit_map_bound(gsl_vector_get(paramValues, 0), min[0], = max[0]); double mu =3D nsl_fit_map_bound(gsl_vector_get(paramValues, 1), min[1],= max[1]); - double a =3D nsl_fit_map_bound(gsl_vector_get(paramValues, 2), min[2], = max[2]); - for (size_t i =3D 0; i < n; i++) { - x =3D xVector[i]; - if (sigmaVector) sigma =3D sigmaVector[i]; - - for (int j =3D 0; j < 3; j++) { - if (fixed[j]) - gsl_matrix_set(J, i, j, 0.); - else - gsl_matrix_set(J, i, j, nsl_fit_model_levy_param_deriv(j, x, g, mu, = a, sigma)); - } - } - break; - } - case nsl_fit_model_frechet: { - double a =3D nsl_fit_map_bound(gsl_vector_get(paramValues, 0), min[0], = max[0]); - double mu =3D nsl_fit_map_bound(gsl_vector_get(paramValues, 1), min[1],= max[1]); double s =3D nsl_fit_map_bound(gsl_vector_get(paramValues, 2), min[2], = max[2]); - double c =3D nsl_fit_map_bound(gsl_vector_get(paramValues, 3), min[3], = max[3]); + double a =3D nsl_fit_map_bound(gsl_vector_get(paramValues, 3), min[3], = max[3]); for (size_t i =3D 0; i < n; i++) { x =3D xVector[i]; if (sigmaVector) sigma =3D sigmaVector[i]; @@ -723,29 +710,11 @@ int func_df(const gsl_vector* paramValues, void* para= ms, gsl_matrix* J) { if (fixed[j]) gsl_matrix_set(J, i, j, 0.); else - gsl_matrix_set(J, i, j, nsl_fit_model_frechet_param_deriv(j, x, a, m= u, s, c, sigma)); + gsl_matrix_set(J, i, j, nsl_fit_model_frechet_param_deriv(j, x, g, m= u, s, a, sigma)); } } break; } - case nsl_fit_model_sech_dist: { - double s =3D nsl_fit_map_bound(gsl_vector_get(paramValues, 0), min[0], = max[0]); - double mu =3D nsl_fit_map_bound(gsl_vector_get(paramValues, 1), min[1],= max[1]); - double a =3D nsl_fit_map_bound(gsl_vector_get(paramValues, 2), min[2], = max[2]); - for (size_t i =3D 0; i < n; i++) { - x =3D xVector[i]; - if (sigmaVector) sigma =3D sigmaVector[i]; - - for (int j =3D 0; j < 3; j++) { - if (fixed[j]) - gsl_matrix_set(J, i, j, 0.); - else - gsl_matrix_set(J, i, j, nsl_fit_model_sech_dist_param_deriv(j, x, s,= mu, a, sigma)); - } - } - break; - } -*/ } break; case nsl_fit_model_custom: diff --git a/src/kdefrontend/dockwidgets/XYFitCurveDock.cpp b/src/kdefronte= nd/dockwidgets/XYFitCurveDock.cpp index 3e60c88e..bc40e367 100644 --- a/src/kdefrontend/dockwidgets/XYFitCurveDock.cpp +++ b/src/kdefrontend/dockwidgets/XYFitCurveDock.cpp @@ -347,18 +347,20 @@ void XYFitCurveDock::categoryChanged(int index) { for(int i =3D 0; i < NSL_SF_STATS_DISTRIBUTION_COUNT; i++) uiGeneralTab.cbModel->addItem(nsl_sf_stats_distribution_name[i]); = - //TODO: non-used items are disabled here + // non-used items are disabled here const QStandardItemModel* model =3D qobject_cast(uiGeneralTab.cbModel->model()); = for(int i =3D 1; i < NSL_SF_STATS_DISTRIBUTION_COUNT; i++) { - //TODO: Testing - if (i =3D=3D nsl_sf_stats_laplace|| i =3D=3D nsl_sf_stats_cauchy_lorent= z || i =3D=3D nsl_sf_stats_rayleigh || i =3D=3D nsl_sf_stats_logistic - || i =3D=3D nsl_sf_stats_lognormal || i =3D=3D nsl_sf_stats_chi_square= d || i =3D=3D nsl_sf_stats_gamma || i =3D=3D nsl_sf_stats_poisson - || i =3D=3D nsl_sf_stats_weibull || i =3D=3D nsl_sf_stats_gumbel1) - continue; - - QStandardItem* item =3D model->item(i); - item->setFlags(item->flags() & ~(Qt::ItemIsSelectable|Qt::ItemIsEnabled= )); + //TODO: implement following distribution models + if (i =3D=3D nsl_sf_stats_gaussian_tail || i =3D=3D nsl_sf_stats_expone= ntial || i =3D=3D nsl_sf_stats_exponential_power || + i =3D=3D nsl_sf_stats_rayleigh_tail || i =3D=3D nsl_sf_stats_landau ||= i =3D=3D nsl_sf_stats_levy_alpha_stable || + i =3D=3D nsl_sf_stats_levy_skew_alpha_stable || i =3D=3D nsl_sf_stats_= flat || i =3D=3D nsl_sf_stats_fdist || + i =3D=3D nsl_sf_stats_tdist || i =3D=3D nsl_sf_stats_beta || i =3D=3D = nsl_sf_stats_gumbel2 || i =3D=3D nsl_sf_stats_bernoulli || + i =3D=3D nsl_sf_stats_binomial || i =3D=3D nsl_sf_stats_negative_biono= mial || i =3D=3D nsl_sf_stats_pascal || i =3D=3D nsl_sf_stats_geometric + || i =3D=3D nsl_sf_stats_hypergeometric || i =3D=3D nsl_sf_stats_loga= rithmic || i =3D=3D nsl_sf_stats_pareto) { + QStandardItem* item =3D model->item(i); + item->setFlags(item->flags() & ~(Qt::ItemIsSelectable|Qt::ItemIsEnabl= ed)); + } } break; } @@ -665,10 +667,12 @@ void XYFitCurveDock::updateModelEquation() { break; case nsl_fit_model_distribution: switch (m_fitData.modelType) { + // TODO: missing GSL distributions case nsl_sf_stats_gaussian: case nsl_sf_stats_laplace: case nsl_sf_stats_lognormal: case nsl_sf_stats_logistic: + case nsl_sf_stats_sech: m_fitData.paramNames << "s" << "mu" << "a"; m_fitData.paramNamesUtf8 << QString::fromUtf8("\u03c3") << QString::fro= mUtf8("\u03bc") << "A"; break; @@ -679,6 +683,7 @@ void XYFitCurveDock::updateModelEquation() { case nsl_sf_stats_exponential_power: break; case nsl_sf_stats_cauchy_lorentz: + case nsl_sf_stats_levy: m_fitData.paramNames << "g" << "mu" << "a"; m_fitData.paramNamesUtf8 << QString::fromUtf8("\u03b3") << QString::fro= mUtf8("\u03bc") << "A"; break; @@ -703,22 +708,19 @@ void XYFitCurveDock::updateModelEquation() { m_fitData.paramNamesUtf8 << QString::fromUtf8("\u03c3") << QString::fro= mUtf8("\u03b2") << QString::fromUtf8("\u03bc") << "A"; break; case nsl_sf_stats_gumbel2: - // TODO break; case nsl_sf_stats_poisson: m_fitData.paramNames << "l" << "a"; m_fitData.paramNamesUtf8 << QString::fromUtf8("\u03bb") << "A"; break; - // TODO: use nsl_sf_stats -// case nsl_fit_model_maxwell: -// m_fitData.paramNames << "a" << "c"; -// case nsl_fit_model_levy: -// m_fitData.paramNames << "g" << "mu" << "a"; -// case nsl_fit_model_frechet: -// m_fitData.paramNames << "a" << "mu" << "s" << "c"; -// case nsl_fit_model_sech_dist: -// m_fitData.paramNames << "s" << "mu" << "a"; - // TODO: use nsl_sf_stats + case nsl_sf_stats_maxwell_boltzmann: + m_fitData.paramNames << "s" << "a"; + m_fitData.paramNamesUtf8 << QString::fromUtf8("\u03c3") << "A"; + break; + case nsl_sf_stats_frechet: + m_fitData.paramNames << "g" << "mu" << "s" << "a"; + m_fitData.paramNamesUtf8 << QString::fromUtf8("\u03b3") << QString::fro= mUtf8("\u03bc") << QString::fromUtf8("\u03c3") << "A"; + break; } break; case nsl_fit_model_custom: @@ -750,11 +752,10 @@ void XYFitCurveDock::updateModelEquation() { } = // model-dependent start values - // TODO: use nsl_sf_stats if (m_fitData.modelCategory =3D=3D nsl_fit_model_distribution) { if (m_fitData.modelType =3D=3D nsl_sf_stats_weibull) m_fitData.paramStartValues[2] =3D 0.0; - if (m_fitData.modelType =3D=3D nsl_fit_model_frechet || m_fitData.model= Type =3D=3D nsl_fit_model_levy) + if (m_fitData.modelType =3D=3D nsl_sf_stats_frechet || m_fitData.modelT= ype =3D=3D nsl_sf_stats_levy) m_fitData.paramStartValues[1] =3D 0.0; } } @@ -762,18 +763,15 @@ void XYFitCurveDock::updateModelEquation() { uiGeneralTab.teEquation->setVariables(vars); uiGeneralTab.teEquation->setText(eq); = - //TODO: only for dists for testing + //TODO: only for dists atm if (m_fitData.modelCategory =3D=3D nsl_fit_model_distribution) { // show formula pic QString file =3D KStandardDirs::locate("data", "labplot2/pics/gsl_distri= butions/" + QString(nsl_sf_stats_distribution_pic_name[m_fitData.modelType]= ) + ".jpg"); uiGeneralTab.lFuncPic->setPixmap(QPixmap(file)); uiGeneralTab.lFuncPic->show(); = - //TODO: hide uiGeneralTab.teEquation - if (m_fitData.modelType =3D=3D nsl_sf_stats_gaussian) - uiGeneralTab.teEquation->hide(); - else - uiGeneralTab.teEquation->show(); + uiGeneralTab.teEquation->hide(); + = // set label if (m_fitData.modelType =3D=3D nsl_sf_stats_poisson) uiGeneralTab.lEquation->setText(("f(k)/A =3D")); diff --git a/src/pics/gsl_distributions/frechet.jpg b/src/pics/gsl_distribu= tions/frechet.jpg new file mode 100644 index 00000000..986cd38a Binary files /dev/null and b/src/pics/gsl_distributions/frechet.jpg differ diff --git a/src/pics/gsl_distributions/levy.jpg b/src/pics/gsl_distributio= ns/levy.jpg new file mode 100644 index 00000000..6927a639 Binary files /dev/null and b/src/pics/gsl_distributions/levy.jpg differ diff --git a/src/pics/gsl_distributions/maxwell_boltzmann.jpg b/src/pics/gs= l_distributions/maxwell_boltzmann.jpg new file mode 100644 index 00000000..b8aa83ae Binary files /dev/null and b/src/pics/gsl_distributions/maxwell_boltzmann.j= pg differ diff --git a/src/pics/gsl_distributions/sech.jpg b/src/pics/gsl_distributio= ns/sech.jpg new file mode 100644 index 00000000..9e20380c Binary files /dev/null and b/src/pics/gsl_distributions/sech.jpg differ