1
#' Calculate the concentrations for a specific record.id
2
#'
3
#' This function calculates the concentrations
4
#' of all available electron/holes traps including valence- and conduction band.
5
#' They
6
#'
7
#' @param data \code{\link{matrix of class \code{deSolve}}} (\bold{required}): the output of a
8
#' solver from \code{deSolve},
9
#'
10
#' @param times \code{\link{numeric}} (\bold{required}): numeric vector with length nrow(data).
11
#' In common this is the time for irradiaton (RF) or illumination (OSL). For TL measurements this
12
#' argument should be the temperature scale.
13
#'
14
#' @return This function returns an \code{\linkS4class{RLum.Analysis}} object
15
#' with the concentrations of all available electron/holes traps including
16
#' valence- and conduction band.
17
#'
18
#' @section Function version: 0.1.1
19
#'
20
#' @author Johannes Friedrich, University of Bayreuth (Germany)
21
#'
22
#' @seealso \code{\link{simulate_TL}}, \code{\link{simulate_CW_OSL}}, \code{\link{simulate_LM_OSL}},
23
#' \code{\link{simulate_RF}}
24
#'
25
#' @examples
26
#'
27
#' #so far no example available
28
#'
29
#' @noRd
30
.calc_concentrations <- function(
31
  data,
32
  times,
33
  name,
34
  RLumModel_ID = NULL
35
  ){
36

37
  ##check name of sequence step
38

39 5
  if("TL" %in% name){
40

41 5
    xlab <- "Temperature [\u00B0C]"
42

43 5
  } else if("OSL" %in% name | "LM-OSL" %in% name){
44

45 5
    xlab <- "Illumination time [s]"
46

47
  } else {
48

49 5
    xlab <- "Stimulation time [s]"
50
  }
51

52 5
  ylab <- "Concentration [1/cm^3]"
53

54
##calculate concentrations
55

56 5
  concentrations <- lapply(2:ncol(data), function(x){
57

58 5
    value <- data[,x]
59 5
    if(x < (ncol(data)-1)){
60 5
      recordType <- paste0("conc. level ",x-1," (",name,")")}
61

62 5
    if(x == (ncol(data)-1)){
63 5
      recordType <- paste0("conc. n_c (",name,")")}
64

65 5
    if(x == ncol(data)){
66 5
      recordType <- paste0("conc. n_v (",name,")")}
67

68

69 5
    return(set_RLum(class = "RLum.Data.Curve",
70 5
                    data = matrix(
71 5
                      data = c(
72 5
                        time = times,
73 5
                        n = value),
74 5
                        ncol = 2),
75 5
                    recordType = recordType,
76 5
                    curveType = "simulated",
77 5
                    info = list(
78 5
                      curveDescripter = paste(xlab, ylab, sep = ";"),
79 5
                      max.change = (1-min(value)/max(value))*100),
80 5
                    .pid = paste(as.character(RLumModel_ID),x-1,sep = "_"))
81
           )
82

83
  })
84

85 5
  return(concentrations)
86

87
}

Read our documentation on viewing source code .

Loading