3.2 DE(t) plot

The following script is a demonstration how to use the lapply() function to iterate the imported RLum.Analysis object while progressively increasing the signal interval when calculating the equivalent dose using analyse_SAR.CWOSL(). The resulting equivalent doses are then plotted in consecutive order in order to visualise its dependency on the chosen integral; a plot that is commonly referred to as a De(t) plot (Bailey, 2001).

Note that the below script is actually superseded by the already included plot_DetPlot() function in the Luminescence package, but was included for demonstrative purposes. Also, the script uses the popular ggplot2 package for plotting, which is part of the so-called “tidyverse”, a collection of R packages designed for data science. It is by no means necessary to use packages of the “tidyverse” and can easily be replaced with standard R code.

## load additional libraries
library(tidyverse)

## Import BIN file
bin <- read_BIN2R(file = "D-CA1_100-150_2mm_a.BIN", fastForward = TRUE, 
                  txtProgressBar = FALSE, verbose = FALSE)

signal.integral.max <- 2:4

## Calculate equivalent doses
de <- lapply(signal.integral.max, function(x) {
  analyse_SAR.CWOSL(object = bin, 
                    signal.integral.min = 1, signal.integral.max = x, 
                    background.integral.min = 200, background.integral.max = 250, 
                    plot = FALSE, verbose = FALSE)
})

cam <- lapply(de, function(x) {
  calc_CentralDose(get_RLum(x), plot = FALSE, verbose = FALSE)
})

res <- do.call(rbind, get_RLum(cam))
res <- mutate(res, channels = 2:(nrow(res) + 1))

df <- gather(res, key, value, de, OD)

gg <- ggplot2::ggplot(df, aes(x = channels, y = value, color = key)) +
  geom_line() +
  facet_grid(key ~ ., scales = "free_y")

print(gg)