Skip to content

Commit

Permalink
Small additions to thermochronometry docs and uniform function name.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcol committed Dec 17, 2024
1 parent 21e75e4 commit 7a3c9cb
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 34 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export(extract_ROI)
export(fit_CWCurve)
export(fit_DoseResponseCurve)
export(fit_EmissionSpectra)
export(fit_IsoThermalHolding)
export(fit_IsothermalHolding)
export(fit_LMCurve)
export(fit_OSLLifeTimes)
export(fit_SurfaceExposure)
Expand Down
18 changes: 10 additions & 8 deletions R/analyse_ThermochronometryData.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,33 @@
#'
#' @details ##TODO
#'
#' @param object [character] (**required**): path to a CSV file with;
#' @param object [character] (**required**): path to a CSV file ##TODO;
#' alternatively a [vector] of paths
#'
#' @param ITL_model [character] (*with default*): type of model to fit,
#' either `"GOK"` or `"BTS"`
#' either `"GOK"` (default) or `"BTS"`
#'
#' @param plot [logical] (*with default*): enable/disable plot output
#'
#' @param verbose [logical] (*with default*): enable/disable terminal output
#'
#' @param ... further arguments passed to ...
#' @param ... currently unused
#'
#' @section Function version: 0.1.0
#'
#' @author Sebastian Kreutzer, Institute of Geography, Heidelberg University (Germany), Svenja Riedesel, DTU Risø (Denmark)
#' @author
#' Sebastian Kreutzer, Institute of Geography, Heidelberg University (Germany),
#' Svenja Riedesel, DTU Risø (Denmark)
#'
#' @keywords datagen
#'
#' @return
#' An [RLum.Results-class] object is returned: ##TODO
#'
#' @seealso [analyse_FadingMeasurement], ## TODO
#' @seealso [analyse_FadingMeasurement], [fit_IsothermalHolding]
#'
#' @examples
#' # example code ##TOD
#' # example code ##TODO
#'
#' @md
#' @export
Expand Down Expand Up @@ -89,7 +91,7 @@ analyse_ThermochronometryData <- function(

# (2) ITL Data ------------------------------------------------------------
df_ITL <- object@data$ITL[object@data$ITL$SAMPLE == sample_names[i],]
results_ITL <- fit_IsoThermalHolding(
results_ITL <- fit_IsothermalHolding(
data = df_ITL,
ITL_model = ITL_model,
rhop = results_FAD,
Expand Down Expand Up @@ -148,7 +150,7 @@ analyse_ThermochronometryData <- function(
class = "RLum.Results",
data = list(
FAD = results_combined[["analyse_FadingMeasurement"]],
ITL = results_combined[["fit_IsoThermalHolding"]],
ITL = results_combined[["fit_IsothermalHolding"]],
DRC = results_combined[["fit_DoseResponseCurve"]]),
info = list(
call = sys.call()
Expand Down
12 changes: 7 additions & 5 deletions R/fit_IsothermalHolding.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' @title Fit ISO-Thermal Holding Data
#' @title Fit Isothermal Holding Data
#'
#' @description ##TODO
#'
Expand All @@ -17,29 +17,31 @@
#'
#' @section Function version: 0.1.0
#'
#' @author Svenja Riedesel, DTU Risø (Denmark), Sebastian Kreutzer, Institute of Geography, Heidelberg University (Germany)
#' @author
#' Svenja Riedesel, DTU Risø (Denmark)
#' Sebastian Kreutzer, Institute of Geography, Heidelberg University (Germany)
#'
#' @keywords datagen
#'
#' @return
#' An [RLum.Results-class] object is returned: ##TODO
#'
#' @seealso ##TODO
#' @seealso [analyse_ThermochronometryData], [analyse_FadingMeasurement]
#'
#' @examples
#' # example code ##TOD
#'
#'
#' @md
#' @export
fit_IsoThermalHolding <- function(
fit_IsothermalHolding <- function(
data,
ITL_model = 'GOK',
rhop,
plot = TRUE,
...
) {
.set_function_name("fit_IsoThermalHolding")
.set_function_name("fit_IsothermalHolding")
on.exit(.unset_function_name(), add = TRUE)

## TODOs
Expand Down
13 changes: 7 additions & 6 deletions man/analyse_ThermochronometryData.Rd

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

13 changes: 7 additions & 6 deletions man/fit_IsoThermalHolding.Rd → man/fit_IsothermalHolding.Rd

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

Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
## load data
input.csv <- file.path(test_path("_data"),
paste0("CLBR_IR", c(50, 100, 150, 225), ".csv"))

test_that("input validation", {
testthat::skip_on_cran()

expect_error(fit_IsoThermalHolding(list()),
expect_error(fit_IsothermalHolding(list()),
"'data' should be of class 'character', 'RLum.Results' or")
expect_error(fit_IsoThermalHolding("error"),
expect_error(fit_IsothermalHolding("error"),
"File does not exist")
expect_error(fit_IsoThermalHolding(set_RLum("RLum.Results", data = list(1))),
expect_error(fit_IsothermalHolding(set_RLum("RLum.Results", data = list(1))),
"'data' has unsupported originator")
expect_error(fit_IsoThermalHolding(iris),
expect_error(fit_IsothermalHolding(iris),
"'data' has the wrong column headers")
expect_error(fit_IsoThermalHolding(input.csv[1], ITL_model = "error"),
expect_error(fit_IsothermalHolding(input.csv[1], ITL_model = "error"),
"'ITL_model' should be one of 'GOK' or 'BTS'")
expect_error(fit_IsoThermalHolding(test_path("_data/CLBR.xlsx")),
expect_error(fit_IsothermalHolding(test_path("_data/CLBR.xlsx")),
"XLS/XLSX format is not supported, use CSV instead")
})

test_that("check functionality", {
testthat::skip_on_cran()

expect_s4_class(fit_IsoThermalHolding(input.csv[1], rhop = -7),
expect_s4_class(fit_IsothermalHolding(input.csv[1], rhop = -7),
"RLum.Results")

data <- .import_ThermochronometryData(input.csv[1])
expect_s4_class(fit_IsoThermalHolding(data, rhop = -7, mfrow = c(2, 2)),
expect_s4_class(fit_IsothermalHolding(data, rhop = -7, mfrow = c(2, 2)),
"RLum.Results")
})

0 comments on commit 7a3c9cb

Please sign in to comment.