! * sets the parameter names for given model category, model type and degree in \c fitData for given action */
| 372 | * sets the parameter names for given model category, model type and degree in \c fitData for given action |
| 373 | */ |
| 374 | void XYFitCurve::initFitData(XYAnalysisCurve::AnalysisAction action) { |
| 375 | // TODO: exclude others too? |
| 376 | if (action == XYAnalysisCurve::AnalysisAction::DataReduction) |
| 377 | return; |
| 378 | |
| 379 | Q_D(XYFitCurve); |
| 380 | auto& fitData = d->fitData; |
| 381 | if (action == XYAnalysisCurve::AnalysisAction::FitLinear) { |
| 382 | // Linear |
| 383 | fitData.modelCategory = nsl_fit_model_basic; |
| 384 | fitData.modelType = (int)nsl_fit_model_polynomial; |
| 385 | fitData.degree = 1; |
| 386 | } else if (action == XYAnalysisCurve::AnalysisAction::FitPower) { |
| 387 | // Power |
| 388 | fitData.modelCategory = nsl_fit_model_basic; |
| 389 | fitData.modelType = (int)nsl_fit_model_power; |
| 390 | fitData.degree = 1; |
| 391 | } else if (action == XYAnalysisCurve::AnalysisAction::FitExp1) { |
| 392 | // Exponential (degree 1) |
| 393 | fitData.modelCategory = nsl_fit_model_basic; |
| 394 | fitData.modelType = (int)nsl_fit_model_exponential; |
| 395 | fitData.degree = 1; |
| 396 | } else if (action == XYAnalysisCurve::AnalysisAction::FitExp2) { |
| 397 | // Exponential (degree 2) |
| 398 | fitData.modelCategory = nsl_fit_model_basic; |
| 399 | fitData.modelType = (int)nsl_fit_model_exponential; |
| 400 | fitData.degree = 2; |
| 401 | } else if (action == XYAnalysisCurve::AnalysisAction::FitInvExp) { |
| 402 | // Inverse exponential |
| 403 | fitData.modelCategory = nsl_fit_model_basic; |
| 404 | fitData.modelType = (int)nsl_fit_model_inverse_exponential; |
| 405 | } else if (action == XYAnalysisCurve::AnalysisAction::FitGauss) { |
| 406 | // Gauss |
| 407 | fitData.modelCategory = nsl_fit_model_peak; |
| 408 | fitData.modelType = (int)nsl_fit_model_gaussian; |
| 409 | fitData.degree = 1; |
| 410 | } else if (action == XYAnalysisCurve::AnalysisAction::FitCauchyLorentz) { |
| 411 | // Cauchy-Lorentz |
| 412 | fitData.modelCategory = nsl_fit_model_peak; |
| 413 | fitData.modelType = (int)nsl_fit_model_lorentz; |
| 414 | fitData.degree = 1; |
| 415 | } else if (action == XYAnalysisCurve::AnalysisAction::FitTan) { |
| 416 | // Arc tangent |
| 417 | fitData.modelCategory = nsl_fit_model_growth; |
| 418 | fitData.modelType = (int)nsl_fit_model_atan; |
| 419 | } else if (action == XYAnalysisCurve::AnalysisAction::FitTanh) { |
| 420 | // Hyperbolic tangent |
| 421 | fitData.modelCategory = nsl_fit_model_growth; |
| 422 | fitData.modelType = (int)nsl_fit_model_tanh; |
| 423 | } else if (action == XYAnalysisCurve::AnalysisAction::FitErrFunc) { |
| 424 | // Error function |
| 425 | fitData.modelCategory = nsl_fit_model_growth; |
| 426 | fitData.modelType = (int)nsl_fit_model_erf; |
| 427 | } else { |
| 428 | // Custom |
| 429 | fitData.modelCategory = nsl_fit_model_custom; |
| 430 | fitData.modelType = 0; |
| 431 | } |