Skip to content

Commit

Permalink
Merge pull request #200 from aglowacki/master
Browse files Browse the repository at this point in the history
Fixed issues with labeled spectra not clearing properly. Changed defa…
  • Loading branch information
aglowacki authored Sep 26, 2024
2 parents b04ba4b + 8df7b42 commit 0138539
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/data_struct/analysis_job.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ namespace data_struct
template<typename T_real>
Analysis_Job<T_real>::Analysis_Job()
{
_optimizer = &_lmfit_optimizer;
_optimizer = &_mpfit_optimizer;
optimize_fit_routine = OPTIMIZE_FIT_ROUTINE::ALL_PARAMS;
_last_init_sample_size = 0;
_first_init = true;
num_threads = std::thread::hardware_concurrency();
//default mode for which parameters to fit when optimizing fit parameters
optimize_fit_params_preset = fitting::models::Fit_Params_Preset::BATCH_FIT_NO_TAILS;
optimize_fit_params_preset = fitting::models::Fit_Params_Preset::BATCH_FIT_WITH_TAILS;
quick_and_dirty = false;
generate_average_h5 = false;
add_v9_layout = false;
Expand Down
12 changes: 3 additions & 9 deletions src/fitting/models/gaussian_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,9 @@ const Spectra<T_real> Gaussian_Model<T_real>::model_spectrum(const Fit_Parameter

if (labeled_spectras != nullptr) // if this stucture is not null then initialize
{
labeled_spectras->clear();
for (auto& itr : spectra_labels)
{
if (labeled_spectras->count(itr) > 1)
{
labeled_spectras->erase(itr);
}
labeled_spectras->insert({ itr, Spectra<T_real>(energy_range.count()) });
}
}
Expand Down Expand Up @@ -430,12 +427,9 @@ const std::tuple<std::vector<std::string>, std::vector<ArrayTr<T_real>>> Gaussia

if (labeled_spectras != nullptr) // if this stucture is not null then initialize
{
labeled_spectras->clear();
for (auto& itr : spectra_labels)
{
if (labeled_spectras->count(itr) > 1)
{
labeled_spectras->erase(itr);
}
labeled_spectras->insert({ itr, Spectra<T_real>(energy_range.count()) });
}
}
Expand Down Expand Up @@ -574,7 +568,7 @@ const Spectra<T_real> Gaussian_Model<T_real>::model_spectrum_element(const Fit_P

if (false == std::isfinite(pre_faktor))
{
logE << "Prefactor = " << pre_faktor << "\n";
logE << "Prefactor = " << pre_faktor << " for "<<element_to_fit->full_name()<<" . Log10 Value = "<< fitp->at(element_to_fit->full_name()).value <<"\n";
spectra_model = (ArrayTr<T_real>)(spectra_model).unaryExpr([](T_real v) { return std::numeric_limits<T_real>::quiet_NaN(); });
return spectra_model;
}
Expand Down

0 comments on commit 0138539

Please sign in to comment.