diff --git a/NEWS.Rmd b/NEWS.Rmd index 9182c2538..e265d605f 100644 --- a/NEWS.Rmd +++ b/NEWS.Rmd @@ -48,6 +48,10 @@ data frames as input (#200). * The function computed the number of breaks for the histogram incorrectly (#197, fixed with #198). +### `fit_CWCurve()` +* Argument `output.path` has been removed, and a warning is raised when +attempting to use it (#207, fixed in #209). + ### `fit_EmissionSpectra()` * Parameter `input_scale` was not correctly propagated when the function would self-call (#160, @mcol). @@ -56,13 +60,17 @@ self-call (#160, @mcol). * The validation of the minimum dataset size didn't account for the use of the `signal.range` argument (#182, fixed by #195, @mcol). - ### `fit_SurfaceExposure()` * Fix #162 to remove a dimension mismatch if the input data contained `NA`s, which would generate unexpected warnings (#163, @mcol). * The function doesn't stop anymore with an error if called on an `RLum.Results` object (#165, @mcol). +### `plot_DetPlot()` +* Argument `signal.integral.max` is now enforced to be greater than +`signal.integral.min`, as otherwise the computation of the number of channels +would produce `Inf` (#203, fixed in #206). + ### `plot_GrowthCurve()` * The function now calculates the relative saturation (`n/N`) using the ration of the two integrates. The values is part of the output table. diff --git a/R/fit_CWCurve.R b/R/fit_CWCurve.R index 5b5a58305..e1369259e 100644 --- a/R/fit_CWCurve.R +++ b/R/fit_CWCurve.R @@ -84,11 +84,6 @@ #' @param sample_code [character] (*optional*): #' sample code used for the plot and the optional output table (`mtext`). #' -#' @param output.path [character] (*optional*): -#' output path for table output containing the results of the fit. The file -#' name is set automatically. If the file already exists in the directory, -#' the values are appended. -#' #' @param output.terminal [logical] (*with default*): #' terminal output with fitting results. #' @@ -106,12 +101,6 @@ #' #' the fitted CW-OSL curves are returned as plot. #' -#' **table (*optional*)** -#' -#' an output table (`*.csv`) with parameters of the fitted components is -#' provided if the `output.path` is set. -#' -#' #' **RLum.Results** #' #' Beside the plot and table output options, an [RLum.Results-class] object is @@ -171,7 +160,7 @@ #' The function **does not** ensure that the fitting procedure has reached a #' global minimum rather than a local minimum! #' -#' @section Function version: 0.5.2 +#' @section Function version: 0.5.3 #' #' @author #' Sebastian Kreutzer, Institute of Geography, Heidelberg University (Germany) @@ -215,15 +204,11 @@ fit_CWCurve<- function( LED.wavelength = 470, cex.global = 0.6, sample_code = "Default", - output.path, output.terminal = TRUE, output.terminalAdvanced = TRUE, plot = TRUE, ... ){ - ##TODO - ##remove output.path - # INTEGRITY CHECKS -------------------------------------------------------- ##INPUT OBJECTS @@ -266,6 +251,8 @@ fit_CWCurve<- function( ylab <- if("ylab" %in% names(extraArgs)) {extraArgs$ylab} else {paste("OSL [cts/",round(max(x)/length(x), digits = 2)," s]",sep="")} + if ("output.path" %in% names(extraArgs)) + .throw_warning("Argument 'output.path' no longer supported, ignored") ##============================================================================## ## FITTING @@ -388,9 +375,7 @@ fit_CWCurve<- function( ))#end try }else{ - - stop("[fit_CWCurve()] fit.method unknown.", call. = FALSE) - + .throw_error("'fit.method' unknown") } @@ -533,7 +518,7 @@ fit_CWCurve<- function( pR<-round(1-RSS/TSS,digits=4) if(pR<0){ - warning("pseudo-R^2 < 0!") + .throw_warning("pseudo-R^2 < 0!") } ## --------------------------------------------- @@ -635,22 +620,6 @@ fit_CWCurve<- function( colnames(output.table)<-c("sample_code","n.components", output.tableColNames,"pseudo-R^2") - if(missing(output.path)==FALSE){ - - ##write file with just the header if the file not exists - if(file.exists(paste(output.path,"fit_CWCurve_Output_",sample_code,".csv",sep=""))==FALSE){ - write.table(output.table,file=paste(output.path,"fit_CWCurve_Output_", - sample_code,".csv",sep=""), sep=";" - ,row.names=FALSE) - }else{ - write.table(output.table,file=paste(output.path,"fit_CWCurve_Output_", - sample_code,".csv",sep=""), sep=";" - ,row.names=FALSE, append=TRUE, col.names=FALSE) - - }#endif::for write option - - }#endif::table output - ##============================================================================## ## COMPONENT TO SUM CONTRIBUTION PLOT ##============================================================================## diff --git a/man/fit_CWCurve.Rd b/man/fit_CWCurve.Rd index 426c7b6e4..360967408 100644 --- a/man/fit_CWCurve.Rd +++ b/man/fit_CWCurve.Rd @@ -15,7 +15,6 @@ fit_CWCurve( LED.wavelength = 470, cex.global = 0.6, sample_code = "Default", - output.path, output.terminal = TRUE, output.terminalAdvanced = TRUE, plot = TRUE, @@ -60,11 +59,6 @@ global scaling factor.} \item{sample_code}{\link{character} (\emph{optional}): sample code used for the plot and the optional output table (\code{mtext}).} -\item{output.path}{\link{character} (\emph{optional}): -output path for table output containing the results of the fit. The file -name is set automatically. If the file already exists in the directory, -the values are appended.} - \item{output.terminal}{\link{logical} (\emph{with default}): terminal output with fitting results.} @@ -82,11 +76,6 @@ returns a plot of the fitted curves.} the fitted CW-OSL curves are returned as plot. -\strong{table (\emph{optional})} - -an output table (\verb{*.csv}) with parameters of the fitted components is -provided if the \code{output.path} is set. - \strong{RLum.Results} Beside the plot and table output options, an \linkS4class{RLum.Results} object is @@ -192,7 +181,7 @@ The function \strong{does not} ensure that the fitting procedure has reached a global minimum rather than a local minimum! } \section{Function version}{ - 0.5.2 + 0.5.3 } \examples{ diff --git a/tests/testthat/test_fit_CWCurve.R b/tests/testthat/test_fit_CWCurve.R index 1a6eae559..4a48316bf 100644 --- a/tests/testthat/test_fit_CWCurve.R +++ b/tests/testthat/test_fit_CWCurve.R @@ -49,12 +49,9 @@ test_that("check values from output example", { # } SW({ - fit_CWCurve(ExampleData.CW_OSL_Curve, - fit.method = "LM", fit.calcError = TRUE, - output.path = tempdir()) - fit_CWCurve(ExampleData.CW_OSL_Curve, - fit.method = "LM", fit.calcError = TRUE, - log = "xy", - output.path = tempdir()) + expect_warning(fit_CWCurve(ExampleData.CW_OSL_Curve, fit.method = "LM", + fit.calcError = TRUE, + output.path = tempdir()), + "Argument 'output.path' no longer supported") }) })