Skip to content

Commit 6313d51

Browse files
authored
Merge pull request #214 from aglowacki/master
Update Quantification start calc
2 parents ca2f580 + 38a40e0 commit 6313d51

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

src/core/process_whole.cpp

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,35 @@ bool perform_quantification(data_struct::Analysis_Job<double>* analysis_job, boo
475475
// min, and max values doen't matter because we are free fitting amplitude only
476476
fit_params.add_parameter(Fit_Param<double>("quantifier", 0.0000000001, std::numeric_limits<double>::max()*.00001, 1.0, 0.0001, E_Bound_Type::LIMITED_LO_HI));
477477
//initial guess: parinfo_value[0] = 100000.0 / factor
478-
fit_params["quantifier"].value = (double)100000.0 / quant_itr.second;
478+
std::string str_val = std::to_string( quant_itr.second );
479+
int cntr = 0;
480+
for (auto itr : str_val)
481+
{
482+
if(itr == '.')
483+
{
484+
break;
485+
}
486+
if(itr == '0' && cntr == 0) // ignore leading zero
487+
{
488+
cntr --;
489+
}
490+
cntr++;
491+
}
492+
493+
double recipricle = quant_itr.second;
494+
if( cntr > 0 )
495+
{
496+
if(cntr == 1)
497+
{
498+
recipricle = 1.0 / quant_itr.second;
499+
}
500+
else
501+
{
502+
recipricle = std::pow(10.0, cntr-1) / quant_itr.second;
503+
}
504+
}
505+
//fit_params["quantifier"].value = (double)100000.0 / quant_itr.second;
506+
fit_params["quantifier"].value = recipricle;
479507
optimizer->minimize_quantification(&fit_params, &detector->all_element_quants[fit_itr.first][quant_itr.first], &quantification_model);
480508
double val = fit_params["quantifier"].value;
481509

src/io/file/hdf5_io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ enum GSE_CARS_SAVE_VER {UNKNOWN, XRFMAP, XRMMAP};
9090

9191
using ROI_Vec = std::vector<std::pair<int, int>>;
9292

93-
extern "C" herr_t h5_ext_file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata);
93+
DLL_EXPORT herr_t h5_ext_file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata);
9494

9595
//-----------------------------------------------------------------------------
9696

0 commit comments

Comments
 (0)