Skip to content

Commit 0138539

Browse files
authored
Merge pull request #200 from aglowacki/master
Fixed issues with labeled spectra not clearing properly. Changed defa…
2 parents b04ba4b + 8df7b42 commit 0138539

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/data_struct/analysis_job.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ namespace data_struct
5757
template<typename T_real>
5858
Analysis_Job<T_real>::Analysis_Job()
5959
{
60-
_optimizer = &_lmfit_optimizer;
60+
_optimizer = &_mpfit_optimizer;
6161
optimize_fit_routine = OPTIMIZE_FIT_ROUTINE::ALL_PARAMS;
6262
_last_init_sample_size = 0;
6363
_first_init = true;
6464
num_threads = std::thread::hardware_concurrency();
6565
//default mode for which parameters to fit when optimizing fit parameters
66-
optimize_fit_params_preset = fitting::models::Fit_Params_Preset::BATCH_FIT_NO_TAILS;
66+
optimize_fit_params_preset = fitting::models::Fit_Params_Preset::BATCH_FIT_WITH_TAILS;
6767
quick_and_dirty = false;
6868
generate_average_h5 = false;
6969
add_v9_layout = false;

src/fitting/models/gaussian_model.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,9 @@ const Spectra<T_real> Gaussian_Model<T_real>::model_spectrum(const Fit_Parameter
352352

353353
if (labeled_spectras != nullptr) // if this stucture is not null then initialize
354354
{
355+
labeled_spectras->clear();
355356
for (auto& itr : spectra_labels)
356357
{
357-
if (labeled_spectras->count(itr) > 1)
358-
{
359-
labeled_spectras->erase(itr);
360-
}
361358
labeled_spectras->insert({ itr, Spectra<T_real>(energy_range.count()) });
362359
}
363360
}
@@ -430,12 +427,9 @@ const std::tuple<std::vector<std::string>, std::vector<ArrayTr<T_real>>> Gaussia
430427

431428
if (labeled_spectras != nullptr) // if this stucture is not null then initialize
432429
{
430+
labeled_spectras->clear();
433431
for (auto& itr : spectra_labels)
434432
{
435-
if (labeled_spectras->count(itr) > 1)
436-
{
437-
labeled_spectras->erase(itr);
438-
}
439433
labeled_spectras->insert({ itr, Spectra<T_real>(energy_range.count()) });
440434
}
441435
}
@@ -574,7 +568,7 @@ const Spectra<T_real> Gaussian_Model<T_real>::model_spectrum_element(const Fit_P
574568

575569
if (false == std::isfinite(pre_faktor))
576570
{
577-
logE << "Prefactor = " << pre_faktor << "\n";
571+
logE << "Prefactor = " << pre_faktor << " for "<<element_to_fit->full_name()<<" . Log10 Value = "<< fitp->at(element_to_fit->full_name()).value <<"\n";
578572
spectra_model = (ArrayTr<T_real>)(spectra_model).unaryExpr([](T_real v) { return std::numeric_limits<T_real>::quiet_NaN(); });
579573
return spectra_model;
580574
}

0 commit comments

Comments
 (0)