R-Lum/Luminescence

calc_Huntley2006() ... unexpected crash

Closed this issue · 1 comments

Expected behaviour

Function works or shows a reasonable error message.

Observed behaviour

The functions returns a warnings:

In paste0("\nlog10(rho'):\t\t", round(log10(rhoPrime$MEAN), 2),  :
  NaNs produced

and it finally stops in line 574 (calc_Huntley2006()) with an error.

r `$<-`(`*tmp*`, "LxTx.error", value = c(0.562, 1e-04))

Running mini example

library(Luminescence)

##set first dataset
FData <- data.frame(Lx.Tx = c(1.601464, 2.004137, 4.067369, 2.064269, 
1.859081, 2.286282, 1.587824, 3.004019, 2.841654, 1.657617, 2.117007, 
1.701569, 1.640604, 1.552729, 2.080724), error = c(0.137523, 
0.166642, 0.431737, 0.17299, 0.134815, 0.171253, 0.113327, 0.224597, 
0.22732, 0.124679, 0.143766, 0.137208, 0.118597, 0.109504, 0.126912
), time.s. = c(460.818385, 459.800066, 64683.942, 453.688365, 
963.101587, 59646.9371, 461.836621, 2951.72939, 57338.9346, 454.707198, 
4937.24043, 42198.9111, 453.688365, 398614.991, 451.650434))

##set 2nd data set
growth <- data.frame(dose = c(0L, 800L, 400L, 1200L, 1600L, 0L, 800L
), Lx.Tx = c(10.513, 4.278, 3.171, 9.77, 12.018, 0.982, 5.247
), error = c(0.562, 0.337, 0.289, 0.876, 1.005, 0.189, 0.486))

##run fading analysis
Fade <- analyse_FadingMeasurement(FData)

##run corrections (this will fail)
results <-
  calc_Huntley2006(
    data = growth,
    LnTn = NULL,
    rhop = Fade,
    c(1.701, 0.196),
    c(0.0784, 0.004),
    n.MC = 1000,
    fit.method = 'EXP'
  )

Warning fixed with 0ad1d5f

(it was related to analyse_FadingMeasurement())