Skip to content

Commit

Permalink
More informative message en error in loglike (rules)
Browse files Browse the repository at this point in the history
  • Loading branch information
gvegayon committed Jul 28, 2023
1 parent 2d66932 commit 7657250
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
8 changes: 7 additions & 1 deletion inst/include/barry/counters/phylo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2211,7 +2211,13 @@ inline void rule_dyn_limit_changes(
PhyloRuleDynData(
support->get_current_stats(),
pos, lb, ub, duplication
)
),
std::string("Limiting changes in term ") +
std::to_string(pos) + " to [" + std::to_string(lb) + ", " +
std::to_string(ub) + "]",
std::string("When the support is ennumerated, the number of changes in term ") +
std::to_string(pos) + " is limited to [" + std::to_string(lb) + ", " +
std::to_string(ub) + "]"
);

return;
Expand Down
19 changes: 17 additions & 2 deletions inst/include/barry/model-meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,15 @@ MODEL_TEMPLATE(double, likelihood)(
// Checking if passes the rules
if (!support_fun.eval_rules_dyn(target_, 0u, 0u))
{
throw std::range_error("The array is not in the support set.");

// Concatenating the elements of target_ into aa single string
std::string target_str = "";
for (uint i = 0u; i < target_.size(); ++i)
target_str += std::to_string(target_[i]) + " ";

throw std::range_error(
"The array is not in the support set. The array's statistics are: " + target_str + std::string(".")
);
}


Expand Down Expand Up @@ -749,7 +757,14 @@ MODEL_TEMPLATE(double, likelihood)(

if (!support_fun.eval_rules_dyn(tmp_target, 0u, 0u))
{
throw std::range_error("The array is not in the support set.");
// Concatenating the elements of target_ into aa single string
std::string target_str = "";
for (uint i = 0u; i < params.size(); ++i)
target_str += std::to_string((*target_ + i)) + " ";

throw std::range_error(
"The array is not in the support set. The array's statistics are: " + target_str + std::string(".")
);
// return as_log ? -std::numeric_limits<double>::infinity() : 0.0;
}

Expand Down
1 change: 1 addition & 0 deletions inst/include/barry/models/geese/geese-meat-likelihood.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ inline double Geese::likelihood(

nstate++;

// Computing the likelihood of the event.
off_mult *= model->likelihood(
par0,
temp_stats,
Expand Down

0 comments on commit 7657250

Please sign in to comment.