Skip to content

Commit

Permalink
clarify vignette, increase connectivity of documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasHohmann committed Dec 6, 2024
1 parent 3cbcdb1 commit e316fb5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: admtools
Title: Estimate and Manipulate Age-Depth Models
Version: 0.4.0.9000
Version: 0.4.0.9001
Authors@R:
person("Niklas", "Hohmann", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-1559-1838"))
Expand Down
10 changes: 8 additions & 2 deletions R/sedrate_gen_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,17 @@ sed_rate_from_matrix = function(height, sedrate, matrix, mode = "deterministic",
#'
#' @returns a function factory for usage with `sedrate_to_multiadm`
#'
#' @seealso [sedrate_to_multiadm()] for estimating sedimentation rates based on the outputs, [get_data_from_eTimeOpt()] for extracting data from the `eTimeOpt` function of the astrochron package.
#' @seealso [sedrate_to_multiadm()] for estimating sedimentation rates based on the outputs, [get_data_from_eTimeOpt()] for extracting data from the `eTimeOpt` function of the astrochron package. [sed_rate_gen_from_bounds()] for construction sedimentation rate generators from simple bounds. See also the vignettes for details on how arbitrary sedimentation rates can be constructed.
#'
#' @description
#' Construct a sedimentation rate generator (function factory) from a matrix, e.g. one returned from `get_data_from_eTimeOpt`. This generator can be passed on to `sedrate_to_multiadm` to estimate age-depth models from it.
#' If mode is "deterministic", the generator evaluates the sedimentation rates at heights specified by `height`, if the mode is "poisson" it is evaluated at heights that are determined based on a poisson point process. At these heights, the value of the sedimentation rate is determined based on the (pseudo) pdf that is determined by the matrix values.
#'
#' @examples
#' # see vignette
#' # vignette("adm_from_sedrate")
#' # for more general examples
#'
if (!all(dim(matrix) == c(length(sedrate), length(height)))){
stop("dimension mismatch. \"matrix\" must have length(height) columns and length(sedrate) rows")
}
Expand Down Expand Up @@ -137,7 +143,7 @@ sed_rate_gen_from_bounds = function(h_l, s_l, h_u, s_u, rate = 1){
#' constructs a sedimentation rate generator for usage with `sedrate_to_multiadm` based on the following procedure: (1) determine stratigraphic points based on a Poisson point process with rate `rate` (2) at these points, determine the sedimentation rate based on a uniform distribution between the bounds provided by the input parameters (3) linearly interpolate between those points with sedimentation rate determined in step 2.
#' This approach can be used to estimate age-depth models when only rough boundaries on sedimentation rates are available. Here, the uniform distribution is chosen to reflect that no other information other than maximum and minimum sed. rate is available.
#'
#' @seealso [sedrate_to_multiadm()] for estimating age-depth models using the outputs, [sed_rate_from_matrix()] for other means of defining sedimentation rates
#' @seealso [sedrate_to_multiadm()] for estimating age-depth models using the outputs, [sed_rate_from_matrix()] for other means of defining sedimentation rates, the vignette on how to construct arbitrary sedimentation rate generators.
#'
#' @examples
#' # see vignette
Expand Down
8 changes: 7 additions & 1 deletion man/sed_rate_from_matrix.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/sed_rate_gen_from_bounds.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vignettes/adm_from_sedrate.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Additional parameters that determine the numeric behavior of the integration met

## Example

We construct an age depth model for a section of 10 m thickness where upper and lower bounds on sedimentation rates are available.
We construct an age depth model for a section of 10 m thickness where upper and lower bounds on sedimentation rates are available. This is a simplified example, details on how arbitrary sedimentation rates can be encoded can be found below.

### Data

Expand Down Expand Up @@ -160,7 +160,7 @@ plot(mean_adm)

### Background

Times and heights of tie points are coded via the functions `t_tp` (timing) and `h_tp` (height) that take no inputs. They serve as wrappers around user-defined procedures that reflect uncertainties around tie points. Every time `t_tp` and `h_tp` are evaluated, they return possible values for the tie points. Conceptually, both `t_tp`and `h_tp` are user implemented random number generators that draw from the distributions of tie points. Writing these functions requires some effort, but it allows the user to hand over arbitrarily complex uncertainties of the tie points to the `strat_cont_to_multiadm` function.
Times and heights of tie points are coded via the functions `t_tp` (timing) and `h_tp` (height) that take no inputs. They serve as wrappers around user-defined procedures that reflect uncertainties around tie points. Every time `t_tp` and `h_tp` are evaluated, they return possible values for the tie points. Conceptually, both `t_tp`and `h_tp` are user implemented random number generators that draw from the distributions of tie points. Writing these functions requires some effort, but it allows the user to hand over arbitrarily complex uncertainties of the tie points to the `sedrate_to_multiadm` function.

### Wrappers

Expand Down

0 comments on commit e316fb5

Please sign in to comment.