Skip to content

Commit b04ba4b

Browse files
authored
Merge pull request #199 from aglowacki/master
Updates
2 parents dad709b + 064b408 commit b04ba4b

File tree

3 files changed

+32
-14
lines changed

3 files changed

+32
-14
lines changed

src/core/main.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ int set_dir_and_files(Command_Line_Parser& clp, data_struct::Analysis_Job<T_real
385385
//Look if files were specified
386386
std::string dset_file = clp.get_option("--files");
387387
//if they were not then look for them in $dataset_directory/mda
388-
if (dset_file.length() < 1)
388+
if (dset_file.length() < 1 || dset_file == "all")
389389
{
390390
std::vector<std::string> flist;
391391

@@ -459,12 +459,14 @@ int set_dir_and_files(Command_Line_Parser& clp, data_struct::Analysis_Job<T_real
459459

460460
io::file::File_Scan::inst()->sort_dataset_files_by_size(dataset_dir, &analysis_job.optimize_dataset_files);
461461

462-
//if no files were specified only take the 8 largest datasets
463-
while (analysis_job.optimize_dataset_files.size() > 9)
462+
if(dset_file != "all")
464463
{
465-
analysis_job.optimize_dataset_files.pop_back();
464+
//if no files were specified only take the 8 largest datasets
465+
while (analysis_job.optimize_dataset_files.size() > 9)
466+
{
467+
analysis_job.optimize_dataset_files.pop_back();
468+
}
466469
}
467-
468470
}
469471
else if (dset_file.find(',') != std::string::npos)
470472
{

src/data_struct/fit_parameters.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,14 @@ void Fit_Parameters<T_real>::print()
363363
logit_s << " Name \t value \t min \t max \t step size \t fitting\n\n";
364364
for(const auto& itr : _params)
365365
{
366-
logit_s<<" "<<itr.first<<" \t "<<itr.second.value<<" \t " << itr.second.min_val << " \t " << itr.second.max_val << " \t " << itr.second.step_size << " \t " <<itr.second.bound_type_str() << "\n";
366+
if(itr.second.value > itr.second.max_val || itr.second.value < itr.second.min_val)
367+
{
368+
logit_s<<"\033[1;31m "<<" "<<itr.first<<" \t "<<itr.second.value<<" \t " << itr.second.min_val << " \t " << itr.second.max_val << " \t " << itr.second.step_size << " \t " <<itr.second.bound_type_str() << "\033[0;m \n";
369+
}
370+
else
371+
{
372+
logit_s<<" "<<itr.first<<" \t "<<itr.second.value<<" \t " << itr.second.min_val << " \t " << itr.second.max_val << " \t " << itr.second.step_size << " \t " <<itr.second.bound_type_str() << "\n";
373+
}
367374
}
368375
logit_s<<"\n";
369376

@@ -378,7 +385,14 @@ void Fit_Parameters<T_real>::print_non_fixed()
378385
{
379386
if(itr.second.bound_type != E_Bound_Type::FIXED)
380387
{
381-
logit_s<<" [ "<<itr.first<<" ] = "<<itr.second.value<<" "<<itr.second.bound_type_str() << "\n";
388+
if(itr.second.value > itr.second.max_val || itr.second.value < itr.second.min_val)
389+
{
390+
logit_s<<"\033[1;31m [ "<<itr.first<<" ] = "<<itr.second.value<<" "<<itr.second.bound_type_str() << "\033[0;m \n";
391+
}
392+
else
393+
{
394+
logit_s<<" [ "<<itr.first<<" ] = "<<itr.second.value<<" "<<itr.second.bound_type_str() << "\n";
395+
}
382396
}
383397
}
384398
logit_s<<"\n";

src/fitting/models/gaussian_model.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ void Gaussian_Model<T_real>::set_fit_params_preset(Fit_Params_Preset preset)
201201
_fit_parameters[STR_COMPTON_F_STEP].bound_type = E_Bound_Type::FIXED;
202202
_fit_parameters[STR_COMPTON_F_TAIL].bound_type = E_Bound_Type::LIMITED_LO_HI;
203203
_fit_parameters[STR_COMPTON_GAMMA].bound_type = E_Bound_Type::FIXED;
204-
_fit_parameters[STR_COMPTON_HI_F_TAIL].bound_type = E_Bound_Type::LIMITED_LO_HI;
204+
_fit_parameters[STR_COMPTON_HI_F_TAIL].bound_type = E_Bound_Type::FIXED;
205205
_fit_parameters[STR_COMPTON_HI_GAMMA].bound_type = E_Bound_Type::FIXED;
206206

207207
_fit_parameters[STR_SNIP_WIDTH].bound_type = E_Bound_Type::FIXED;
@@ -239,10 +239,10 @@ void Gaussian_Model<T_real>::set_fit_params_preset(Fit_Params_Preset preset)
239239
_fit_parameters[STR_COMPTON_F_STEP].bound_type = E_Bound_Type::FIXED;
240240
_fit_parameters[STR_COMPTON_F_TAIL].bound_type = E_Bound_Type::LIMITED_LO_HI;
241241
_fit_parameters[STR_COMPTON_GAMMA].bound_type = E_Bound_Type::LIMITED_LO_HI;
242-
_fit_parameters[STR_COMPTON_HI_F_TAIL].bound_type = E_Bound_Type::LIMITED_LO_HI;
243-
_fit_parameters[STR_COMPTON_HI_GAMMA].bound_type = E_Bound_Type::LIMITED_LO_HI;
242+
_fit_parameters[STR_COMPTON_HI_F_TAIL].bound_type = E_Bound_Type::FIXED;
243+
_fit_parameters[STR_COMPTON_HI_GAMMA].bound_type = E_Bound_Type::FIXED;
244244

245-
_fit_parameters[STR_SNIP_WIDTH].bound_type = E_Bound_Type::LIMITED_LO_HI;
245+
_fit_parameters[STR_SNIP_WIDTH].bound_type = E_Bound_Type::FIXED;
246246

247247
_fit_parameters[STR_F_STEP_OFFSET].bound_type = E_Bound_Type::FIXED;
248248
_fit_parameters[STR_F_STEP_LINEAR].bound_type = E_Bound_Type::FIXED;
@@ -315,7 +315,7 @@ void Gaussian_Model<T_real>::set_fit_params_preset(Fit_Params_Preset preset)
315315
_fit_parameters[STR_COMPTON_F_STEP].bound_type = E_Bound_Type::FIXED;
316316
_fit_parameters[STR_COMPTON_F_TAIL].bound_type = E_Bound_Type::LIMITED_LO_HI;
317317
_fit_parameters[STR_COMPTON_GAMMA].bound_type = E_Bound_Type::FIXED;
318-
_fit_parameters[STR_COMPTON_HI_F_TAIL].bound_type = E_Bound_Type::LIMITED_LO_HI;
318+
_fit_parameters[STR_COMPTON_HI_F_TAIL].bound_type = E_Bound_Type::FIXED;
319319
_fit_parameters[STR_COMPTON_HI_GAMMA].bound_type = E_Bound_Type::FIXED;
320320

321321
_fit_parameters[STR_SNIP_WIDTH].bound_type = E_Bound_Type::FIXED;
@@ -753,14 +753,16 @@ const ArrayTr<T_real> Gaussian_Model<T_real>::step(T_real gain, T_real sigma, co
753753
template<typename T_real>
754754
const ArrayTr<T_real> Gaussian_Model<T_real>::tail(T_real gain, T_real sigma, const ArrayTr<T_real> &delta_energy, T_real gamma) const
755755
{
756+
756757
T_real val = pow(gamma, (T_real)2.0);
757758
val = exp((T_real)-0.5 / val);
758759
val = sigma / val;
759760
val = gamma / val;
760761
val = (T_real)2.0 / val;
761762
val = gain / val;
762-
763-
763+
764+
765+
// T_real val = gain / ( (T_real)2.0 * gamma * sigma * exp( (T_real)-0.5 / pow(gamma, (T_real)2.0) ) );
764766
return delta_energy.unaryExpr([val,sigma,gamma](T_real v) { return (v < (T_real)0.0) ?
765767
std::exp(v/ (gamma * sigma)) * val * std::erfc(v / ( ((T_real)(M_SQRT2)*sigma) + ((T_real)1.0/(gamma*(T_real)(M_SQRT2))) ) )
766768
:

0 commit comments

Comments
 (0)