Skip to content

Commit

Permalink
Remove unnecessary function and replace with inline code
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmbaazam committed May 29, 2024
1 parent 7e83bd9 commit 02f782f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 30 deletions.
8 changes: 0 additions & 8 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,3 @@
next_gen[as.integer(names(next_gen_count))] <- unname(next_gen_count)
return(next_gen)
}

#' Extract the `stat_threshold` attribute from an `<epichains>` object.
#'
#' @param obj An <epichains> or <epichains_summary> object.
#' @keywords internal
.get_stat_threshold <- function(obj) {
attr(obj, "stat_threshold")
}
15 changes: 8 additions & 7 deletions R/likelihood.R
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,17 @@ likelihood <- function(chains, statistic = c("size", "length"), offspring_dist,
# * If the object is an <epichains>/<epichains_summary>, we'll give
# preference to the stat_threshold used in the simulation.
if (.is_epichains_summary(chains)) {
stat_threshold_from_sim <- attr(chains, "stat_threshold")
if (!missing(stat_threshold)) {
warning(
"`stat_threshold` specified but will be ignored. ",
"Using `stat_threshold` = ",
.get_stat_threshold(chains),
" as used in the simulation.",
call. = FALSE
warning(
"`stat_threshold` specified but will be ignored. ",
"Using `stat_threshold` = ",
stat_threshold_from_sim,
" as used in the simulation.",
call. = FALSE
)
}
stat_threshold <- .get_stat_threshold(chains)
stat_threshold <- stat_threshold_from_sim
}

if (is.finite(stat_threshold)) {
Expand Down
15 changes: 0 additions & 15 deletions man/dot-get_stat_threshold.Rd

This file was deleted.

0 comments on commit 02f782f

Please sign in to comment.