[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [labplot] src: updated Maxwell-Boltzmann, Sech, Levy and Frechet distribution fit model
From: Stefan Gerlach <null () kde ! org>
Date: 2016-12-31 22:31:26
Message-ID: E1cNSBS-0003x7-As () code ! kde ! org
[Download RAW message or body]
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, double 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, double mu, \
double s, double c, double sigma) {
- double y = (x-mu)/s, efactor = exp(-pow(y, -a));
+double nsl_fit_model_frechet_param_deriv(int param, double x, double g, double mu, \
double s, double a, double sigma) { + double y = (x-mu)/s, efactor = exp(-pow(y, \
-g));
if (param == 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 == 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 == 2)
- return c/sigma * gsl_pow_2(a/s)*pow(y, -2.*a-1.) * (pow(y, a)-1.) * efactor;
+ return a/sigma * gsl_pow_2(g/s)*pow(y, -2.*g-1.) * (pow(y, g)-1.) * efactor;
if (param == 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, double 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_lorentz, \
nsl_fit_model_sech, #define NSL_FIT_MODEL_GROWTH_COUNT 8
typedef enum {nsl_fit_model_atan, nsl_fit_model_tanh, \
nsl_fit_model_algebraic_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, \
nsl_fit_model_gumbel, nsl_fit_model_sech_dist} nsl_fit_model_type_distribution;
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, double 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, double c, \
double sigma); double nsl_fit_model_poisson_param_deriv(int param, double x, double \
l, double 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, double k, double a, \
double sigma); double nsl_fit_model_laplace_param_deriv(int param, double x, double \
s, double mu, double a, double sigma); double nsl_fit_model_rayleigh_param_deriv(int \
param, double x, double s, double a, double sigma);
-double nsl_fit_model_levy_param_deriv(int param, double x, double g, double 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, double l, double mu, \
double a, double sigma);
-double nsl_fit_model_frechet_param_deriv(int param, double x, double a, double mu, \
double s, double c, double sigma); double nsl_fit_model_gumbel1_param_deriv(int \
param, double x, double s, double b, double mu, double a, double sigma); +
+double nsl_fit_model_maxwell_param_deriv(int param, double x, double a, double 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, double mu, double a, \
double sigma); +double nsl_fit_model_frechet_param_deriv(int param, double x, double \
a, double 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[] = {i18n("Gaussian \
(Normal)"), i18n( i18n("Levy skew alpha-stable"), i18n("Gamma"), i18n("Flat \
(uniform)"), i18n("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"), \
i18n("Hyperbolic secant (sech)"), i18n("Levy"), i18n("Frechet (inverse Weibull)")}; \
const char* nsl_sf_stats_distribution_pic_name[] = {
- "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", "binomial", "binomial_negative", "pascal", \
"geometric", + "hypergeometric", "logarithmic", "maxwell_boltzmann", "sech", "levy", \
"frechet"}; const char* nsl_sf_stats_distribution_equation[] = {
"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[] = {
"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 Weibull)
-"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_stats_exponential, nsl_sf_stats_laplace, nsl_sf_stats_exponential_power, @@ \
-37,8 +37,8 @@ typedef enum {nsl_sf_stats_gaussian, nsl_sf_stats_gaussian_tail, \
nsl_sf_stats_ex nsl_sf_stats_levy_skew_alpha_stable, nsl_sf_stats_gamma, \
nsl_sf_stats_flat, nsl_sf_stats_lognormal, nsl_sf_stats_chi_squared, \
nsl_sf_stats_fdist, nsl_sf_stats_tdist, nsl_sf_stats_beta, nsl_sf_stats_logistic, \
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/backend/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 == nsl_fit_model_distribution && modelType == \
nsl_fit_model_lognormal) { + if (modelCategory == nsl_fit_model_distribution && \
modelType == nsl_sf_stats_lognormal) { if (x[i] < 0)
x[i] = 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 = nsl_fit_map_bound(gsl_vector_get(paramValues, 0), min[0], max[0]);
double mu = nsl_fit_map_bound(gsl_vector_get(paramValues, 1), min[1], max[1]);
double a = 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* params, \
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* params, \
gsl_matrix* J) { }
break;
}
- // TODO: nsl_sf_stats
-/* case nsl_fit_model_maxwell: { // Y(x) = c*sqrt(2/pi) * x^2/a^3 * exp(-(x/a)^2/2)
- double a = nsl_fit_map_bound(gsl_vector_get(paramValues, 0), min[0], max[0]);
- double c = nsl_fit_map_bound(gsl_vector_get(paramValues, 1), min[1], max[1]);
+ case nsl_sf_stats_maxwell_boltzmann: { // Y(x) = a*sqrt(2/pi) * x^2/s^3 * \
exp(-(x/s)^2/2) + double s = nsl_fit_map_bound(gsl_vector_get(paramValues, 0), \
min[0], max[0]); + double a = nsl_fit_map_bound(gsl_vector_get(paramValues, 1), \
min[1], max[1]); for (size_t i = 0; i < n; i++) {
x = xVector[i];
if (sigmaVector) sigma = sigmaVector[i];
@@ -685,36 +692,16 @@ int func_df(const gsl_vector* paramValues, void* params, \
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 = nsl_fit_map_bound(gsl_vector_get(paramValues, 0), min[0], max[0]);
double mu = nsl_fit_map_bound(gsl_vector_get(paramValues, 1), min[1], max[1]);
- double a = nsl_fit_map_bound(gsl_vector_get(paramValues, 2), min[2], max[2]);
- for (size_t i = 0; i < n; i++) {
- x = xVector[i];
- if (sigmaVector) sigma = sigmaVector[i];
-
- for (int j = 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 = nsl_fit_map_bound(gsl_vector_get(paramValues, 0), min[0], max[0]);
- double mu = nsl_fit_map_bound(gsl_vector_get(paramValues, 1), min[1], max[1]);
double s = nsl_fit_map_bound(gsl_vector_get(paramValues, 2), min[2], max[2]);
- double c = nsl_fit_map_bound(gsl_vector_get(paramValues, 3), min[3], max[3]);
+ double a = nsl_fit_map_bound(gsl_vector_get(paramValues, 3), min[3], max[3]);
for (size_t i = 0; i < n; i++) {
x = xVector[i];
if (sigmaVector) sigma = sigmaVector[i];
@@ -723,29 +710,11 @@ int func_df(const gsl_vector* paramValues, void* params, \
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, mu, s, c, \
sigma)); + gsl_matrix_set(J, i, j, nsl_fit_model_frechet_param_deriv(j, x, g, \
mu, s, a, sigma)); }
}
break;
}
- case nsl_fit_model_sech_dist: {
- double s = nsl_fit_map_bound(gsl_vector_get(paramValues, 0), min[0], max[0]);
- double mu = nsl_fit_map_bound(gsl_vector_get(paramValues, 1), min[1], max[1]);
- double a = nsl_fit_map_bound(gsl_vector_get(paramValues, 2), min[2], max[2]);
- for (size_t i = 0; i < n; i++) {
- x = xVector[i];
- if (sigmaVector) sigma = sigmaVector[i];
-
- for (int j = 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/kdefrontend/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 = 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 = qobject_cast<const \
QStandardItemModel*>(uiGeneralTab.cbModel->model());
for(int i = 1; i < NSL_SF_STATS_DISTRIBUTION_COUNT; i++) {
- //TODO: Testing
- if (i == nsl_sf_stats_laplace|| i == nsl_sf_stats_cauchy_lorentz || i == \
nsl_sf_stats_rayleigh || i == nsl_sf_stats_logistic
- || i == nsl_sf_stats_lognormal || i == nsl_sf_stats_chi_squared || i == \
nsl_sf_stats_gamma || i == nsl_sf_stats_poisson
- || i == nsl_sf_stats_weibull || i == nsl_sf_stats_gumbel1)
- continue;
-
- QStandardItem* item = model->item(i);
- item->setFlags(item->flags() & ~(Qt::ItemIsSelectable|Qt::ItemIsEnabled));
+ //TODO: implement following distribution models
+ if (i == nsl_sf_stats_gaussian_tail || i == nsl_sf_stats_exponential || i == \
nsl_sf_stats_exponential_power || + i == nsl_sf_stats_rayleigh_tail || i == \
nsl_sf_stats_landau || i == nsl_sf_stats_levy_alpha_stable || + i == \
nsl_sf_stats_levy_skew_alpha_stable || i == nsl_sf_stats_flat || i == \
nsl_sf_stats_fdist || + i == nsl_sf_stats_tdist || i == nsl_sf_stats_beta || i == \
nsl_sf_stats_gumbel2 || i == nsl_sf_stats_bernoulli || + i == \
nsl_sf_stats_binomial || i == nsl_sf_stats_negative_bionomial || i == \
nsl_sf_stats_pascal || i == nsl_sf_stats_geometric + || i == \
nsl_sf_stats_hypergeometric || i == nsl_sf_stats_logarithmic || i == \
nsl_sf_stats_pareto) { + QStandardItem* item = model->item(i);
+ item->setFlags(item->flags() & ~(Qt::ItemIsSelectable|Qt::ItemIsEnabled));
+ }
}
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::fromUtf8("\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::fromUtf8("\u03bc") << "A"; break;
@@ -703,22 +708,19 @@ void XYFitCurveDock::updateModelEquation() {
m_fitData.paramNamesUtf8 << QString::fromUtf8("\u03c3") << \
QString::fromUtf8("\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::fromUtf8("\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 == nsl_fit_model_distribution) {
if (m_fitData.modelType == nsl_sf_stats_weibull)
m_fitData.paramStartValues[2] = 0.0;
- if (m_fitData.modelType == nsl_fit_model_frechet || m_fitData.modelType == \
nsl_fit_model_levy) + if (m_fitData.modelType == nsl_sf_stats_frechet || \
m_fitData.modelType == nsl_sf_stats_levy) m_fitData.paramStartValues[1] = 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 == nsl_fit_model_distribution) {
// show formula pic
QString file = KStandardDirs::locate("data", "labplot2/pics/gsl_distributions/" + \
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 == nsl_sf_stats_gaussian)
- uiGeneralTab.teEquation->hide();
- else
- uiGeneralTab.teEquation->show();
+ uiGeneralTab.teEquation->hide();
+
// set label
if (m_fitData.modelType == nsl_sf_stats_poisson)
uiGeneralTab.lEquation->setText(("f(k)/A ="));
diff --git a/src/pics/gsl_distributions/frechet.jpg \
b/src/pics/gsl_distributions/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_distributions/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/gsl_distributions/maxwell_boltzmann.jpg new file mode 100644
index 00000000..b8aa83ae
Binary files /dev/null and b/src/pics/gsl_distributions/maxwell_boltzmann.jpg differ
diff --git a/src/pics/gsl_distributions/sech.jpg \
b/src/pics/gsl_distributions/sech.jpg new file mode 100644
index 00000000..9e20380c
Binary files /dev/null and b/src/pics/gsl_distributions/sech.jpg differ
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic