R-Lum/Luminescence

Issue with cobble diameters < 13 cm

feldsparlover opened this issue · 2 comments

When the diameter of the cobble is smaller than 13 cm, then n results in empty. I've tried it for 7 cm up to 12 cm and it's always empty, for 13 cm diameter it works. We don't know why this happens. The line is used to find the point of the other side of the cobble where we have the intersection of slope 1 and slope 2. 0.15 is in this line, as this is where the slope intersection occurs.

Thanks.

data("ExampleData.CobbleData", envir = environment())


ExampleData.CobbleData$CobbleDiameter <- 13
calc_CobbleDoseRate(ExampleData.CobbleData)$DataComponent

@feldsparlover I proposed a solution to your problem. If I am not mistaken, you tried to find the index for the value which lies 0.15 below the maximum value of your diameter sequence?

 n <- which(DiameterSeq == max(DiameterSeq)-0.15)

I changed that to

 n <- which(DiameterSeq >= (max(DiameterSeq)-0.15))[1]

You tried to find a very precise value by comparing real numbers. Your code found nothing because of some double number rounding issue there was nothing to find; can happen because 1.00 is not always 1.00 but sometimes 1.00000000000001 (or whatever) (cf. https://en.wikipedia.org/wiki/Double-precision_floating-point_format).

Now I take all values above the threshold, but I use only the first value. This should work, please download the version from GitHub and test.

Confirmed by @feldsparlover and closed.