Skip to content

Commit

Permalink
check to make sure we have at least 1 non fixed fit param, for lmfit
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Glowacki committed Nov 30, 2023
1 parent 301a29a commit 7634f95
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/fitting/optimizers/lmfit_optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ OPTIMIZER_OUTCOME LMFit_Optimizer<T_real>::minimize(Fit_Parameters<T_real> *fit_

User_Data<T_real> ud;
std::vector<T_real> fitp_arr = fit_params->to_array();
if (fitp_arr.size() == 0)
{
return OPTIMIZER_OUTCOME::STOPPED;
}
std::vector<T_real> perror(fitp_arr.size());

size_t total_itr = _options.patience * (fitp_arr.size() + 1);
Expand Down Expand Up @@ -387,6 +391,10 @@ OPTIMIZER_OUTCOME LMFit_Optimizer<T_real>::minimize_func(Fit_Parameters<T_real>*
fill_gen_user_data(ud, fit_params, spectra, energy_range, background, gen_func, use_weights);

std::vector<T_real> fitp_arr = fit_params->to_array();
if (fitp_arr.size() == 0)
{
return OPTIMIZER_OUTCOME::STOPPED;
}
std::vector<T_real> perror(fitp_arr.size());

lm_status_struct<T_real> status;
Expand Down Expand Up @@ -438,6 +446,10 @@ OPTIMIZER_OUTCOME LMFit_Optimizer<T_real>::minimize_quantification(Fit_Parameter
ud.fit_parameters = fit_params;

std::vector<T_real> fitp_arr = fit_params->to_array();
if (fitp_arr.size() == 0)
{
return OPTIMIZER_OUTCOME::STOPPED;
}
std::vector<T_real> perror(fitp_arr.size());

lm_status_struct<T_real> status;
Expand Down

0 comments on commit 7634f95

Please sign in to comment.