Skip to content

Commit

Permalink
Regression: the new internal functions for .throw_warning() and throw…
Browse files Browse the repository at this point in the history
…_error() were flushing the terminal in case of do.call()

+ fx calls
+ ad tests
  • Loading branch information
RLumSK committed Sep 15, 2024
1 parent 54d62db commit 555e2b8
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions R/analyse_pIRIRSequence.R
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,11 @@ analyse_pIRIRSequence <- function(
...
){

if (missing("object")) {
if (missing("object"))
stop("[analyse_pIRIRSequence()] No value set for 'object'!")
}

# SELF CALL -----------------------------------------------------------------------------------
if(is.list(object)){

##make live easy
if(missing("signal.integral.min")){
signal.integral.min <- 1
Expand Down Expand Up @@ -256,21 +254,23 @@ analyse_pIRIRSequence <- function(
results <- merge_RLum(temp)

##DO NOT use invisible here, this will stop the function from stopping
if(length(results) == 0){
if(length(results) == 0)
return(NULL)

}else{
else
return(results)

}

}


# General Integrity Checks ---------------------------------------------------
## CHECK FOR PLOT ...we safe users the pain by checking whether plot device has the
## required size.
if(plot[1] & all(grDevices::dev.size("in") < 20)) {
plot <- FALSE
.throw_warning("Argument 'plot' reset to 'FALSE'. The smallest plot size required is 20 x 20 in! Consider plotting via pdf(..., height = 20, width = 20).")

##GENERAL
}

##GENERAL
##INPUT OBJECTS
if(is(object, "RLum.Analysis")==FALSE){
stop("[analyse_pIRIRSequence()] Input object is not of type 'RLum.Analyis'!",
Expand All @@ -292,7 +292,6 @@ analyse_pIRIRSequence <- function(


# Deal with extra arguments -------------------------------------------------------------------

## default values
mtext.outer <- "MEASUREMENT INFO"
main <- ""
Expand All @@ -308,7 +307,6 @@ analyse_pIRIRSequence <- function(


# Protocol Integrity Checks --------------------------------------------------

##(1) Check structure and remove curves that fit not the recordType criteria

##get sequence structure
Expand Down Expand Up @@ -619,11 +617,9 @@ analyse_pIRIRSequence <- function(


##============================================================================##
# Plotting additionals--------------------------------------------------------
# Plotting additional --------------------------------------------------------
##============================================================================##

if(plot){

##extract LnLnxTnTx.table
LnLxTnTx.table <- get_RLum(temp.results.final, "LnLxTnTx.table")

Expand All @@ -634,7 +630,6 @@ if(plot){
if(any(is.infinite(LnLxTnTx.table[["LxTx.Error"]])))
LnLxTnTx.table[["LxTx.Error"]][is.infinite(LnLxTnTx.table[["LxTx.Error"]])] <- NA


##plot growth curves
plot(NA, NA,
xlim = range(get_RLum(temp.results.final, "LnLxTnTx.table")$Dose),
Expand All @@ -650,9 +645,8 @@ if(plot){
ylab = expression(L[x]/T[x]),
main = "Summarised Dose Response Curves")


##set x for expression evaluation
x <- seq(0,max(LnLxTnTx.table$Dose)*1.05,length = 100)
x <- seq(0,max(LnLxTnTx.table$Dose)*1.05, length.out = 100)

for(j in 1:length(pIRIR.curve.names)){

Expand Down Expand Up @@ -724,7 +718,7 @@ if(plot){
plot(NA, NA,
xlim = c(0,nrow(LnLxTnTx.table)/
n.loops),
ylim = range(temp.curve.TnTx.matrix),
ylim = if(any(is.na(range(temp.curve.TnTx.matrix)))) c(0,1) else range(temp.curve.TnTx.matrix),
xlab = "# Cycle",
ylab = expression(T[x]/T[n]),
main = "Sensitivity change")
Expand All @@ -733,7 +727,6 @@ if(plot){
abline(h = 1:nrow(temp.curve.TnTx.matrix), col = "gray")

for(j in 1:length(pIRIR.curve.names)){

lines(1:nrow(temp.curve.TnTx.matrix),
temp.curve.TnTx.matrix[,j],
type = "b",
Expand Down Expand Up @@ -876,5 +869,4 @@ if(plot){

return(temp.results.final)


}

0 comments on commit 555e2b8

Please sign in to comment.