R-Lum/Luminescence

plot_growthcurve() error when fit.force_through_origin = T

Closed this issue · 2 comments

Expected behaviour

I get output:
[plot_GrowthCurve()] Fit: EXP (interpolation) | De = 0 | D01 = 28412.05

Na is assigned to the De-estimation, and the analysis continues.

Observed behaviour

I get error code:
[plot_GrowthCurve()] Fit: EXP (interpolation) | De = 0 | D01 = 28412.05
Error in temp.GC[, 2]/temp.GC[, 1] :
non-numeric argument to binary operator
In addition: There were 23 warnings (use warnings() to see them)

The function is stopped.

Running mini example

library(Luminescence)
[K1bdaXY2.zip](https://github.com/R-Lum/Luminescence/files/5904466/K1bdaXY2.zip)

# 
unzip(zipfile = "K1bdaXY2.zip", exdir = "./K1bdaXY2")
risoe.file = read_BIN2R("K1bdaXY2/K1bdaXY2.binx")

# RLum
RLum.object <- Risoe.BINfileData2RLum.Analysis(risoe.file, pos = 11, grain = 45, run = c(4,8),set = NULL, ltype = NULL, dtype = NULL, protocol = "unknowm", keep.empty =T, txtProgressBar = TRUE)

# analysis
results <- analyse_SAR.CWOSL(RLum.object,
                             signal.integral.min = 6, signal.integral.max = 11,
                             background.integral.min = 90,background.integral.max = 100,
                             rejection.criteria = NULL,
                             sig0 = 0.025, verbose = T, plot = FALSE,
                             fit.force_through_origin = T)

@IMHarly thanks for reporting. The problem rooted in plot_GrowthCurve() where I opted for a character conversion for very small values (unintentionally). In analyse_SAR.CWOSL(), dividing a number by a character then caused the observed error. It should work now. I tested it with your data set, however, please double-check by using the development version from GitHub (branch dev_0.9.x.).

@RLumSK I can confirm that the fix works. Mad props to Kreutzer.