R-Lum / Luminescence

Development of the R package 'Luminescence'
http://r-lum.github.io/Luminescence/
GNU General Public License v3.0
15 stars 7 forks source link

clean ups in RejectionCriteria returned from analyse_SAR.TL() #245

Closed mcol closed 1 month ago

mcol commented 1 month ago

As part of #147, I'm having a detailed look at what analyse_SAR.TL() produces and returns. One of this is the rejection.criteria data frame, which is sometimes produced incorrectly.

Example:

data(ExampleData.BINfileData, envir = environment())
object <- Risoe.BINfileData2RLum.Analysis(TL.SAR.Data, pos = 3)

analyse_SAR.TL(
        list(object, object),
        signal.integral.min = 210,
        signal.integral.max = 220,
        dose.points = 1:7,
        integral_input = "temperature",
        sequence.structure = c("SIGNAL", "BACKGROUND"))

res@data$rejection.criteria
#             citeria value threshold status
# 1 recuperation rate    NA   +/- 0.1   <NA>   # recycling ratio
# 2 recuperation rate    NA       0.1     OK
# 3 recuperation rate    NA   +/- 0.1   <NA>   # recycling ratio
# 4 recuperation rate    NA       0.1     OK

In these lines of code: https://github.com/R-Lum/Luminescence/blob/be1602b2c80944541e8386917628e9019143d1af/R/analyse_SAR.TL.R#L352-L359

In these other lines: https://github.com/R-Lum/Luminescence/blob/be1602b2c80944541e8386917628e9019143d1af/R/analyse_SAR.TL.R#L369-L370

RLumSK commented 1 month ago

I do agree with the suggested changes, thank you! And no, this NA vs OK mixture was not intentionally.

mcol commented 1 month ago

One additional thing: for recuperation rate we report the rejection criteria divided by 100 (line 358), but we don't divide in the actual test where we set the status (lines 369-370). For recycling ratio we divide in both places, so I expect that the same would be correct for recuperation rate too.

This means that until now recuperation rates have been marked OK in more cases than expected.

RLumSK commented 1 month ago

OK, obviously this also needs a fix