Skip to content

Commit

Permalink
Finish renaming of NumberIterations.MC to n.MC in plot_GrowthCurve().
Browse files Browse the repository at this point in the history
This completes the work started in fcb3404, adding the deprecation of the
old name in plot_GrowthCurve() and fixing up the tests.
  • Loading branch information
mcol committed Dec 17, 2024
1 parent fcb3404 commit cbf7328
Show file tree
Hide file tree
Showing 16 changed files with 118 additions and 96 deletions.
16 changes: 12 additions & 4 deletions NEWS.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ sometimes under a slightly different name, has now been renamed to
also this function conforms to the rest of the package. The use of the
older names is now deprecated and will produce a warning (#351, fixed in #408).

* The `NumberIterations.MC` option of `plot_GrowthCurve()` has now been
renamed to `n.MC` for consistency with other functions. Potentially affected
are also `analyse_Al2O3C_ITC()`, `analyse_baSAR()`, `analyse_SAR.CWOSL()`,
`analyse_SAR.TL()`, `calc_Huntley2006()`, `calc_Lamothe2003()`,
as they may pass that option `plot_GrowthCurve()` via their `...` argument.
The use of the older name is now deprecated and will produce a warning (#546,
fixed in #547).

## Removed functions and deprecations
* Function `Analyse_SAR.OSLdata()` is now officially deprecated,
`analyse_SAR.CWOSL()` should be used instead (#216, fixed in #264).
Expand Down Expand Up @@ -94,8 +102,9 @@ within the `method_control` argument (#521, fixed in #522).

### `analyse_SAR.CWOSL()`
* The function crashed for a list input that led to `NULL` for various
reasons (e.g., unsuitable set of curves). Here the self-call attempted to extract information
from the results that did not exist in the first place instead of returning `NULL`; fixed.
reasons (e.g., unsuitable set of curves). Here the self-call attempted to
extract information from the results that did not exist in the first place
instead of returning `NULL`; fixed.

### `analyse_FadingMeasurement()`
* The function now checks for the version of the BIN-file that originated the
Expand Down Expand Up @@ -247,8 +256,7 @@ calls itself on each element of the list and produces a list of `RLum.Results`
as output (#405, fixed in #434).
* The function reported negative dose values in the MC runs plot when using
`fit.method = "QDR"` and `mode = "extrapolation"` (#504, fixed in #505).
* New argument added `n.MC`, this is identical to `NumberIterations.MC`. The latter
will be deprecated in v1.1.0 and later defunct.
* Argument `NumberIterations.MC` has been renamed to `n.MC` (#546, fixed in #547).

### `plot_RLum.Analysis()`
* Option `plot.single` has been renamed to `plot_singlePanels` (#351, fixed
Expand Down
15 changes: 12 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<!-- NEWS.md was auto-generated by NEWS.Rmd. Please DO NOT edit by hand!-->

# Changes in version 0.9.26.9000-96 (2024-12-17)
# Changes in version 0.9.26.9000-95 (2024-12-17)

## New functions

Expand Down Expand Up @@ -54,6 +54,15 @@
the older names is now deprecated and will produce a warning (#351,
fixed in \#408).

- The `NumberIterations.MC` option of `plot_GrowthCurve()` has now been
renamed to `n.MC` for consistency with other functions. Potentially
affected are also `analyse_Al2O3C_ITC()`, `analyse_baSAR()`,
`analyse_SAR.CWOSL()`, `analyse_SAR.TL()`, `calc_Huntley2006()`,
`calc_Lamothe2003()`, as they may pass that option
`plot_GrowthCurve()` via their `...` argument. The use of the older
name is now deprecated and will produce a warning (#546, fixed in
\#547).

## Removed functions and deprecations

- Function `Analyse_SAR.OSLdata()` is now officially deprecated,
Expand Down Expand Up @@ -296,8 +305,8 @@
- The function reported negative dose values in the MC runs plot when
using `fit.method = "QDR"` and `mode = "extrapolation"` (#504, fixed
in \#505).
- New argument added `n.MC`, this is identical to `NumberIterations.MC`.
The latter will be deprecated in v1.1.0 and later defunct.
- Argument `NumberIterations.MC` has been renamed to `n.MC` (#546, fixed
in \#547).

### `plot_RLum.Analysis()`

Expand Down
6 changes: 3 additions & 3 deletions R/analyse_baSAR.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
#' `background.count.distribution` \tab [calc_OSLLxTxRatio] \tab `"non-poisson"` \tab set assumed count distribution\cr
#' `fit.weights` \tab [plot_GrowthCurve] \tab `TRUE` \tab enables / disables fit weights\cr
#' `fit.bounds` \tab [plot_GrowthCurve] \tab `TRUE` \tab enables / disables fit bounds\cr
#' `NumberIterations.MC` \tab [plot_GrowthCurve] \tab `100` \tab number of MC runs for error calculation\cr
#' `n.MC` \tab [plot_GrowthCurve] \tab `100` \tab number of MC runs for error calculation\cr
#' `output.plot` \tab [plot_GrowthCurve] \tab `TRUE` \tab enables / disables dose response curve plot\cr
#' `output.plotExtended` \tab [plot_GrowthCurve] \tab `TRUE` \tab enables / disables extended dose response curve plot\cr
#' `recordType` \tab [get_RLum] \tab `c(OSL (UVVIS), irradiation (NA)` \tab helps for the curve selection\cr
Expand Down Expand Up @@ -811,7 +811,7 @@ analyse_baSAR <- function(
## plot_GrowthCurve()
fit.weights = TRUE,
fit.bounds = TRUE,
NumberIterations.MC = 100,
n.MC = 100,
output.plot = plot,
output.plotExtended = plot,

Expand Down Expand Up @@ -1598,7 +1598,7 @@ analyse_baSAR <- function(
fit.weights = additional_arguments$fit.weights,
fit.includingRepeatedRegPoints = fit.includingRepeatedRegPoints,
fit.bounds = additional_arguments$fit.bounds,
NumberIterations.MC = additional_arguments$NumberIterations.MC,
n.MC = additional_arguments$n.MC,
output.plot = additional_arguments$output.plot,
output.plotExtended = additional_arguments$output.plotExtended,
txtProgressBar = FALSE,
Expand Down
10 changes: 2 additions & 8 deletions R/fit_DoseResponseCurve.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,8 @@
#' with the fit methods `EXP`, `EXP+LIN`, `EXP OR LIN`, `GOK`, `LambertW`
#' Argument to be inserted for experimental application only!
#'
#' @param NumberIterations.MC [integer] (*with default*):
#' number of Monte Carlo simulations for error estimation. See details.
#'
#' @param n.MC [integer] (*with default*): number of Monte Carlo simulations
#' for error estimation. Similar to `NumberIterations.MC`, which will be become deprecated
#' at some point.
#' for error estimation, see details.
#'
#' @param txtProgressBar [logical] (*with default*):
#' enables or disables `txtProgressBar`. If `verbose = FALSE` also no
Expand Down Expand Up @@ -289,8 +285,7 @@ fit_DoseResponseCurve <- function(
fit.NumberRegPoints = NULL,
fit.NumberRegPointsReal = NULL,
fit.bounds = TRUE,
NumberIterations.MC = 100,
n.MC = NumberIterations.MC,
n.MC = 100,
txtProgressBar = TRUE,
verbose = TRUE,
...
Expand Down Expand Up @@ -338,7 +333,6 @@ fit_DoseResponseCurve <- function(
.validate_class(fit.bounds, "logical")
.validate_positive_scalar(fit.NumberRegPoints, int = TRUE, null.ok = TRUE)
.validate_positive_scalar(fit.NumberRegPointsReal, int = TRUE, null.ok = TRUE)
.validate_positive_scalar(NumberIterations.MC, int = TRUE)
.validate_positive_scalar(n.MC, int = TRUE)

## convert input to data.frame
Expand Down
2 changes: 1 addition & 1 deletion R/plot_DoseResponseCurve.R
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ plot_DoseResponseCurve <- function(
axes = FALSE,
ylim = c(0, max(norm.curve.y)),
sub = paste0("valid fits = ", length(na.exclude(x.natural)),
"/", fit.args$NumberIterations.MC),
"/", fit.args$n.MC),
col = "grey"
), silent = TRUE)

Expand Down
19 changes: 15 additions & 4 deletions R/plot_GrowthCurve.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,12 @@
#' @param verbose [logical] (*with default*):
#' enables or disables terminal feedback.
#'
#' @param n.MC [integer] (*with default*):
#' number of MC runs for error calculation.
#'
#' @param ... Further arguments to [fit_DoseResponseCurve] (`fit_weights`,
#' `fit_bounds`, `fit.force_through_origin`, `fit.includingRepeatedRegPoints`,
#' `fit.NumberRegPoints`, `fit.NumberRegPointsReal`, `NumberIterations.MC`,
#' `fit.NumberRegPoints`, `fit.NumberRegPointsReal`, `n.MC`,
#' `txtProgressBar`) and graphical parameters to be passed (supported:
#' `xlim`, `ylim`, `main`, `xlab`, `ylab`).
#'
Expand Down Expand Up @@ -132,17 +135,24 @@ plot_GrowthCurve <- function(
plot_singlePanels = FALSE,
cex.global = 1,
verbose = TRUE,
n.MC = 100,
...
) {
.set_function_name("plot_GrowthCurve")
on.exit(.unset_function_name(), add = TRUE)

## deprecated argument
if ("output.plotExtended.single" %in% names(list(...))) {
plot_singlePanels <- list(...)$output.plotExtended.single
extraArgs <- list(...)
if ("output.plotExtended.single" %in% names(extraArgs)) {
plot_singlePanels <- extraArgs$output.plotExtended.single
.throw_warning("'output.plotExtended.single' is deprecated, use ",
"'plot_singlePanels' instead")
}
if ("NumberIterations.MC" %in% names(extraArgs)) {
n.MC <- extraArgs$NumberIterations.MC
.throw_warning("'NumberIterations.MC' is deprecated, use ",
"'n.MC' instead")
}

## input validation
.validate_class(output.plot, "logical")
Expand All @@ -153,7 +163,8 @@ plot_GrowthCurve <- function(

## remaining input validation occurs inside the fitting function
fit <- fit_DoseResponseCurve(sample, mode, fit.method,
verbose = verbose, ...)
verbose = verbose, n.MC = n.MC, ...)

if (is.null(fit)) {
if (verbose)
message("[plot_GrowthCurve()] Fitting failed, no plot possible")
Expand Down
2 changes: 1 addition & 1 deletion man/analyse_SAR.CWOSL.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/analyse_baSAR.Rd

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

10 changes: 5 additions & 5 deletions man/fit_DoseResponseCurve.Rd

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

6 changes: 5 additions & 1 deletion man/plot_GrowthCurve.Rd

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

22 changes: 11 additions & 11 deletions tests/testthat/_snaps/fit_DoseResponseCurve.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"names": {
"type": "character",
"attributes": {},
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "NumberIterations.MC"]
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "n.MC"]
}
},
"value": [
Expand Down Expand Up @@ -352,7 +352,7 @@
"names": {
"type": "character",
"attributes": {},
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "NumberIterations.MC"]
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "n.MC"]
}
},
"value": [
Expand Down Expand Up @@ -593,7 +593,7 @@
"names": {
"type": "character",
"attributes": {},
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "NumberIterations.MC"]
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "n.MC"]
}
},
"value": [
Expand Down Expand Up @@ -834,7 +834,7 @@
"names": {
"type": "character",
"attributes": {},
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "NumberIterations.MC"]
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "n.MC"]
}
},
"value": [
Expand Down Expand Up @@ -1075,7 +1075,7 @@
"names": {
"type": "character",
"attributes": {},
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "NumberIterations.MC"]
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "n.MC"]
}
},
"value": [
Expand Down Expand Up @@ -1316,7 +1316,7 @@
"names": {
"type": "character",
"attributes": {},
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "NumberIterations.MC"]
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "n.MC"]
}
},
"value": [
Expand Down Expand Up @@ -1557,7 +1557,7 @@
"names": {
"type": "character",
"attributes": {},
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "NumberIterations.MC"]
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "n.MC"]
}
},
"value": [
Expand Down Expand Up @@ -1798,7 +1798,7 @@
"names": {
"type": "character",
"attributes": {},
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "NumberIterations.MC"]
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "n.MC"]
}
},
"value": [
Expand Down Expand Up @@ -2039,7 +2039,7 @@
"names": {
"type": "character",
"attributes": {},
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "NumberIterations.MC"]
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "n.MC"]
}
},
"value": [
Expand Down Expand Up @@ -2280,7 +2280,7 @@
"names": {
"type": "character",
"attributes": {},
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "NumberIterations.MC"]
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "n.MC"]
}
},
"value": [
Expand Down Expand Up @@ -2521,7 +2521,7 @@
"names": {
"type": "character",
"attributes": {},
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "NumberIterations.MC"]
"value": ["object", "fit.method", "mode", "fit.force_through_origin", "fit.includingRepeatedRegPoints", "fit.NumberRegPoints", "fit.NumberRegPointsReal", "fit.weights", "fit.bounds", "n.MC"]
}
},
"value": [
Expand Down
Loading

0 comments on commit cbf7328

Please sign in to comment.