R-Lum / RLumModel

Compare a2fa7c8 ... +5 ... 03e573f

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -19,13 +19,13 @@
Loading
19 19
#' of the used model. They will be loaded, if `simulate_sample_history = FALSE` in
20 20
#' [model_LuminescenceSignals] is chosen.
21 21
#'
22 -
#'
23 22
#' @param model [character] (\bold{required}): set model to be used.
24 23
#' Available models are: `"Bailey2001"`, `"Bailey2002"`, `"Bailey2004"`, `"Pagonis2007"`,
25 -
#' `"Pagonis2008"`
24 +
#' `"Pagonis2008"`, `"Friedrich2017"`, `"Friedrich2018"`. If model is indeed missing,
25 +
#' the list of allowed keywords is returned.
26 26
#'
27 27
#' @return This function returns a [list] with all necessary parameters for
28 -
#' the used model.
28 +
#' the used model. Returns vector of allowed keywords if model is missing.
29 29
#'
30 30
#' @note The order of the energy-band-levels is sometimes in an different order than in the original model.
31 31
#' This was necessary, because in the simulations the luminescence centre always
@@ -49,13 +49,13 @@
Loading
49 49
#' Radiation Protection Dosimetry 100, 33-38.
50 50
#'
51 51
#' Bailey, R.M., 2004. Paper I-simulation of dose absorption in quartz over geological timescales
52 -
#' and it simplications for the precision and accuracy of optical dating.
52 +
#' and its implications for the precision and accuracy of optical dating.
53 53
#' Radiation Measurements 38, 299-310.
54 54
#'
55 55
#' Friedrich, J., Pagonis, V., Chen, R., Kreutzer, S., Schmidt, C., 2017: Quartz radiofluorescence: a modelling approach.
56 56
#' Journal of Luminescence 186, 318-325.
57 57
#'
58 -
#' Pagonis, V., Chen, R., Wintle, A.G., 2007: Modelling thermal transfer in optically
58 +
#' Pagonis, V., Chen, R., Wintle, A.G., 2007. Modelling thermal transfer in optically
59 59
#' stimulated luminescence of quartz. Journal of Physics D: Applied Physics 40, 998-1006.
60 60
#'
61 61
#' Pagonis, V., Wintle, A.G., Chen, R., Wang, X.L., 2008. A theoretical model for a new dating protocol
@@ -84,6 +84,10 @@
Loading
84 84
    "customised"
85 85
  )
86 86
87 +
  ## if missing return lit of allowed keywords
88 +
  if(missing(model))
89 +
    return(model.allowed_keywords)
90 +
87 91
  if(!model%in%model.allowed_keywords){
88 92
    stop(paste0("[.set_Pars()] Model not supported. Supported models are: ",
89 93
                paste(model.allowed_keywords, collapse = ", ")), call. = FALSE)
@@ -239,6 +243,15 @@
Loading
239 243
      W = W,
240 244
      K = K,
241 245
      model = model
246 +
    ),
247 +
248 +
    customised = list(
249 +
      n =  set_RLum(class = "RLum.Results", data = list(
250 +
        n = rep(0,4), temp = 20, model = model)),
251 +
      k_B = k_B,
252 +
      W = W,
253 +
      K = K,
254 +
      model = model
242 255
    )
243 256
  )
244 257
@@ -273,6 +286,10 @@
Loading
273 286
274 287
        "customized" = {
275 288
          return(parameter.list$customized)
289 +
        },
290 +
291 +
        "customised" = {
292 +
            return(parameter.list$customised)
276 293
        }
277 294
  )#end switch
278 295

@@ -1,110 +1,111 @@
Loading
1 -
#' Model Luminescence Signals
1 +
#' @title Model Luminescence Signals
2 2
#'
3 -
#' This function models luminescence signals for quartz based on published physical models.
3 +
#' @description This function models luminescence signals for quartz based on published physical models.
4 4
#' It is possible to simulate TL, (CW-) OSL, RF measurements in a arbitrary sequence. This
5 -
#' sequence is definded as a \code{\link{list}} of certain abrivations. Furthermore it is possible to
6 -
#' load a sequence direct from the Riso Sequence Editor.
7 -
#' The output is an \code{\linkS4class{RLum.Analysis}}object and so the plots are done
8 -
#' by the \code{\link{plot_RLum.Analysis}} function. If a SAR sequence is simulated the plot output can be disabled and SAR analyse functions
5 +
#' sequence is defined as a [list] of certain aberrations. Furthermore it is possible to
6 +
#' load a sequence direct from the Risø Sequence Editor. The output is an [Luminescence::RLum.Analysis-class] object and so the plots are done by the [Luminescence::plot_RLum.Analysis] function.
7 +
#' If a SAR sequence is simulated the plot output can be disabled and SAR analyse functions
9 8
#' can be used.
10 9
#'
11 -
#'
12 -
#' Defining a \bold{sequence}\cr
10 +
#' @details
11 +
#' Defining a `sequence`
13 12
#'
14 13
#' \tabular{lll}{
15 14
#' \bold{Arguments} \tab \bold{Description} \tab \bold{Sub-arguments}\cr
16 -
#' TL \tab thermally stimulated luminescence \tab 'temp begin' [\eqn{^{\circ}}C], 'temp end' [\eqn{^{\circ}}C], 'heating rate' [\eqn{^{\circ}}C/s]\cr
17 -
#' OSL\tab optically stimulated luminescence \tab 'temp' [\eqn{^{\circ}}C], 'duration' [s], 'optical_power' [\%]\cr
18 -
#' ILL\tab illumination \tab 'temp' [\eqn{^{\circ}}C], 'duration' [s], 'optical_power' [\%]\cr
19 -
#' LM_OSL\tab linear modulated OSL \tab 'temp' [\eqn{^{\circ}}C], 'duration' [s], optional: 'start_power' [\%], 'end_power' [\%]\cr
20 -
#' RL/RF\tab radioluminescence\tab 'temp' [\eqn{^{\circ}}C], 'dose' [Gy], 'dose_rate' [Gy/s] \cr
21 -
#' RF_heating\tab RF during heating/cooling\tab 'temp begin' [\eqn{^{\circ}}C], 'temp end' [\eqn{^{\circ}}C], 'heating rate' [\eqn{^{\circ}}C/s], 'dose_rate' [Gy/s] \cr
22 -
#' IRR\tab irradiation \tab 'temp' [\eqn{^{\circ}}C], 'dose' [Gy], 'dose_rate' [Gy/s] \cr
23 -
#' CH \tab cutheat \tab 'temp' [\eqn{^{\circ}}C], optional: 'duration' [s], 'heating_rate' [\eqn{^{\circ}}C/s]\cr
24 -
#' PH  \tab preheat \tab 'temp' [\eqn{^{\circ}}C], 'duration' [s], optional: 'heating_rate' [\eqn{^{\circ}}C/s]\cr
25 -
#' PAUSE \tab pause \tab 'temp' [\eqn{^{\circ}}C], 'duration' [s]
15 +
#' `TL` \tab thermally stimulated luminescence \tab 'temp begin' (ºC), 'temp end' (ºC), 'heating rate' (ºC/s)\cr
16 +
#' `OSL`\tab optically stimulated luminescence \tab 'temp' (ºC), 'duration' (s), 'optical_power' (%)\cr
17 +
#' `ILL`\tab illumination \tab 'temp' (ºC), 'duration' (s), 'optical_power' (%)\cr
18 +
#' `LM_OSL`\tab linear modulated OSL \tab 'temp' (ºC), 'duration' (s), optional: 'start_power' (%), 'end_power' (%)\cr
19 +
#' `RL/RF`\tab radioluminescence\tab 'temp' (ºC), 'dose' (Gy), 'dose_rate' (Gy/s) \cr
20 +
#' `RF_heating`\tab RF during heating/cooling\tab 'temp begin' (ºC), 'temp end' (ºC), 'heating rate' (ºC/s], 'dose_rate' (Gy/s) \cr
21 +
#' `IRR`\tab irradiation \tab 'temp' (ºC), 'dose' (Gy), 'dose_rate' (Gy/s) \cr
22 +
#' `CH` \tab cutheat \tab 'temp' (ºC), optional: 'duration' (s), 'heating_rate' (ºC/s)\cr
23 +
#' `PH`  \tab preheat \tab 'temp' (ºC), 'duration' (s), optional: 'heating_rate' (ºC/s)\cr
24 +
#' `PAUSE` \tab pause \tab 'temp' (ºC), 'duration' (s)
26 25
#' }
27 26
#'
28 -
#' Note: 100 \% illumination power equates to 20 mW/cm^2
27 +
#' *Note: 100% illumination power equates to 20 mW/cm^2*
29 28
#'
29 +
#' **Own parameters**
30 30
#'
31 -
#' Defining a \bold{SAR-sequence}\cr
31 +
#' The [list] has to contain the following items:
32 +
#' \itemize{
33 +
#'  \item{N: Concentration of electron- and hole traps (cm^(-3))}
34 +
#'  \item{E: Electron/Hole trap depth (eV)}
35 +
#'  \item{s: Frequency factor (s^(-1))}
36 +
#'  \item{A: Conduction band to electron trap and valence band to hole trap transition probability (s^(-1) * cm^(3)).
37 +
#'  **CAUTION: Not every publication uses
38 +
#'  the same definition of parameter A and B! See vignette "RLumModel - Usage with own parameter sets" for further details}**
39 +
#'  \item{B: Conduction band to hole centre transition probability (s^(-1) * cm^(3)).}
40 +
#'  \item{Th: Photo-eviction constant or photoionisation cross section, respectively}
41 +
#'  \item{E_th: Thermal assistence energy (eV)}
42 +
#'  \item{k_B: Boltzman constant 8.617e-05 (eV/K)}
43 +
#'  \item{W: activation energy 0.64 (eV) (for UV)}
44 +
#'  \item{K: 2.8e7 (dimensionless constant)}
45 +
#'  \item{model: `"customized"`}
46 +
#'  \item{R (optional): Ionisation rate (pair production rate) equivalent to 1 Gy/s (s^(-1)) * cm^(-3))}
47 +
#'  }
48 +
#'
49 +
#' For further details see Bailey 2001, Wintle 1975, vignette "RLumModel - Using own parameter sets"
50 +
#' and example 3.
51 +
#'
52 +
#' **Defining a SAR-sequence**\cr
32 53
#'
33 54
#' \tabular{lll}{
34 55
#' \bold{Abrivation} \tab \bold{Description} \tab \bold{examples} \cr
35 -
#' RegDose \tab Dose points of the regenerative cycles [Gy]\tab c(0, 80, 140, 260, 320, 0, 80)\cr
36 -
#' TestDose\tab Test dose for the SAR cycles  [Gy]\tab 50 \cr
37 -
#' PH\tab Temperature of the preheat [\eqn{^{\circ}}C]\tab 240 \cr
38 -
#' CH\tab Temperature of the cutheat [\eqn{^{\circ}}C]\tab 200 \cr
39 -
#' OSL_temp\tab Temperature of OSL read out [\eqn{^{\circ}}C]\tab  125 \cr
40 -
#' OSL_duration\tab  Duration of OSL read out [s]\tab default: 40 \cr
41 -
#' Irr_temp \tab Temperature of irradiation [\eqn{^{\circ}}C]\tab default: 20\cr
42 -
#' PH_duration  \tab Duration of the preheat [s]\tab default: 10 \cr
43 -
#' dose_rate \tab Dose rate of the laboratory irradiation source [Gy/s]\tab default: 1 \cr
44 -
#' optical_power \tab Percentage of the full illumination power [\%]\tab default: 90 \cr
45 -
#' Irr_2recover \tab Dose to be recovered in a dose-recovery-test [Gy]\tab 20
56 +
#' `RegDose` \tab Dose points of the regenerative cycles (Gy)\tab c(0, 80, 140, 260, 320, 0, 80)\cr
57 +
#' `TestDose`\tab Test dose for the SAR cycles  (Gy)\tab 50 \cr
58 +
#' `PH`\tab Temperature of the preheat (ºC)\tab 240 \cr
59 +
#' `CH`\tab Temperature of the cutheat (ºC)\tab 200 \cr
60 +
#' `OSL_temp`\tab Temperature of OSL read out (ºC)\tab  125 \cr
61 +
#' `OSL_duration`\tab  Duration of OSL read out (s)\tab default: 40 \cr
62 +
#' `Irr_temp` \tab Temperature of irradiation (ºC)\tab default: 20\cr
63 +
#' `PH_duration`  \tab Duration of the preheat (s)\tab default: 10 \cr
64 +
#' `dose_rate` \tab Dose rate of the laboratory irradiation source (Gy/s)\tab default: 1 \cr
65 +
#' `optical_power` \tab Percentage of the full illumination power (%)\tab default: 90 \cr
66 +
#' `Irr_2recover` \tab Dose to be recovered in a dose-recovery-test (Gy)\tab 20
46 67
#' }
47 68
#'
48 -
#' @param sequence \code{\link{list}} (\bold{required}): set sequence to model as \code{\link{list}} or as *.seq file from the
49 -
#' Riso sequence editor. To simulate SAR measurements there is an extra option to set the sequence list (cf. details).
69 +
#' @param sequence [list] (**required**): set sequence to model as [list] or as *.seq file from the
70 +
#' Risø sequence editor. To simulate SAR measurements there is an extra option to set the sequence list (cf. details).
50 71
#
51 -
#' @param model \code{\link{character}} (\bold{required}): set model to be used. Available models are:
52 -
#' "Bailey2001", "Bailey2002", "Bailey2004", "Pagonis2007", "Pagonis2008", "Friedrich2017", "Friedrich2018" and for own models "customized" (or "customised").
53 -
#' Note: When model = "customized" is set, the argument 'own_parameters' has to be set.
72 +
#' @param model [character] (**required**): set model to be used. Available models are:
73 +
#' `"Bailey2001"`, `"Bailey2002"`, `"Bailey2004"`, `"Pagonis2007"`, `"Pagonis2008"`, `"Friedrich2017"`, `"Friedrich2018"` and for own models `"customized"` (or `"customised"`).
74 +
#' Note: When model = `"customized"`/`"customised` is set, the argument `own_parameters` has to be set.
54 75
#'
55 -
#' @param lab.dose_rate \code{\link{numeric}} (with default): laboratory dose rate in XXX
76 +
#' @param lab.dose_rate [numeric] (*with default*): laboratory dose rate in XXX
56 77
#' Gy/s for calculating seconds into Gray in the *.seq file.
57 78
#'
58 -
#' @param simulate_sample_history \code{\link{logical}} (with default): FALSE (with default): simulation begins at laboratory conditions, 
59 -
#' TRUE: simulations begins at crystallization (all levels 0) process
79 +
#' @param simulate_sample_history [logical] (with default): `FALSE` (with default):
80 +
#' simulation begins at laboratory conditions, `TRUE`: simulations begins at crystallization process (all levels 0)
60 81
#'
61 -
#' @param plot \code{\link{logical}} (with default): Enables or disables plot output
82 +
#' @param plot [logical] (with default): Enables or disables plot output
62 83
#'
63 -
#' @param verbose \code{\link{logical}} (with default): Verbose mode on/off
84 +
#' @param verbose [logical] (with default): Verbose mode on/off
64 85
#'
65 -
#' @param show_structure \code{\link{logical}} (with default): Shows the structure of the result.
66 -
#' Recommended to show record.id to analyse concentrations.
67 -
#' 
68 -
#' @param own_parameters \code{\link{list}} (with default): This argument allows the user to submit own parameter sets. The \code{\link{list}}
69 -
#' has to contain the following items:
70 -
#' \itemize{
71 -
#'  \item{N: Concentration of electron- and hole traps [cm^(-3)]}
72 -
#'  \item{E: Electron/Hole trap depth [eV}
73 -
#'  \item{s: Frequency factor [s^(-1)]}
74 -
#'  \item{A: Conduction band to electron trap and valence band to hole trap transition probability [s^(-1) * cm^(3)]. 
75 -
#'  \bold{CAUTION: Not every publication uses 
76 -
#'  the same definition of parameter A and B! See vignette "RLumModel - Usage with own parameter sets" for further details}}
77 -
#'  \item{B: Conduction band to hole centre transition probability [s^(-1) * cm^(3)].}
78 -
#'  \item{Th: Photo-eviction constant or photoionisation cross section, respectively}
79 -
#'  \item{E_th: Thermal assistence energy [eV]}
80 -
#'  \item{k_B: Boltzman constant 8.617e-05 [eV/K]}
81 -
#'  \item{W: activation energy 0.64 [eV] (for UV)}
82 -
#'  \item{K: 2.8e7 (dimensionless constant)}
83 -
#'  \item{model: "customized"}
84 -
#'  \item{R (optional): Ionisation rate (pair production rate) equivalent to 1 Gy/s [s^(-1) * cm^(-3)]}
85 -
#'  }
86 -
#' 
87 -
#' For further details see Bailey 2001, Wintle 1975, vignette "RLumModel - Using own parameter sets" 
88 -
#' and example 3. 
89 -
#' 
90 -
#' @param own_state_parameters \code{\link{numeric}} (with default): Some publications (e.g. Pagonis 2009)
86 +
#' @param show_structure [logical] (with default): Shows the structure of the result.
87 +
#' Recommended to show `record.id` to analyse concentrations.
88 +
#'
89 +
#' @param own_parameters [list] (with default): This argument allows the user to submit own parameter sets. See details for more information.
90 +
#'
91 +
#' @param own_state_parameters [numeric] (with default): Some publications (e.g., Pagonis 2009)
91 92
#' offer state parameters. With this argument the user can submit this state parameters. For further details
92 -
#' see vignette ""RLumModel - Using own parameter sets" and example 3.
93 -
#' 
94 -
#' @param own_start_temperature \code{\link{numeric}} (with default): Parameter to control the start temperature (in deg. C) of
95 -
#' a simulation. This parameter takes effect only when 'model = "customized"' is choosen. 
96 -
#' 
93 +
#' see vignette "RLumModel - Using own parameter sets" and example 3.
94 +
#'
95 +
#' @param own_start_temperature [numeric] (with default): Parameter to control the start temperature (in ºC) of
96 +
#' a simulation. This parameter takes effect only when 'model = "customized"' is chosen.
97 +
#'
97 98
#' @param \dots further arguments and graphical parameters passed to
98 -
#' \code{\link{plot.default}}. See details for further information.
99 +
#' [plot.default]. See details for further information.
99 100
#'
100 -
#' @return This function returns an \code{\linkS4class{RLum.Analysis}} object with all TL, (LM-) OSL and RF/RL steps
101 -
#' in the sequence. Every entry is an \code{\linkS4class{RLum.Data.Curve}} object and can be plotted, analysed etc. with
102 -
#' further \code{RLum}-functions.
101 +
#' @return This function returns an [Luminescence::RLum.Analysis-class] object with all TL, (LM-) OSL and RF/RL steps
102 +
#' in the sequence. Every entry is an [Luminescence::RLum.Data.Curve-class] object and can be plotted, analysed etc. with
103 +
#' further `RLum`-functions.
103 104
#'
104 -
#' @section Function version: 0.1.5 
105 +
#' @section Function version: 0.1.5
105 106
#'
106 107
#' @author Johannes Friedrich, University of Bayreuth (Germany),
107 -
#' Sebastian Kreutzer, IRAMAT-CRP2A, Universite Bordeaux Montaigne (France)
108 +
#' Sebastian Kreutzer, Geography & Earth Sciences, Aberystwyth University (United Kingdom)
108 109
#'
109 110
#' @references
110 111
#'
@@ -118,10 +119,10 @@
Loading
118 119
#' Bailey, R.M., 2004. Paper I-simulation of dose absorption in quartz over geological timescales
119 120
#' and it simplications for the precision and accuracy of optical dating.
120 121
#' Radiation Measurements 38, 299-310.
121 -
#' 
122 +
#'
122 123
#' Friedrich, J., Kreutzer, S., Schmidt, C., 2016. Solving ordinary differential equations to understand luminescence:
123 124
#' 'RLumModel', an advanced research tool for simulating luminescence in quartz using R. Quaternary Geochronology 35, 88-100.
124 -
#' 
125 +
#'
125 126
#' Friedrich, J., Pagonis, V., Chen, R., Kreutzer, S., Schmidt, C., 2017: Quartz radiofluorescence: a modelling approach.
126 127
#' Journal of Luminescence 186, 318-325.
127 128
#'
@@ -131,21 +132,20 @@
Loading
131 132
#' Pagonis, V., Wintle, A.G., Chen, R., Wang, X.L., 2008. A theoretical model for a new dating protocol
132 133
#' for quartz based on thermally transferred OSL (TT-OSL).
133 134
#' Radiation Measurements 43, 704-708.
134 -
#' 
135 -
#' Pagonis, V., Lawless, J., Chen, R., Anderson, C., 2009. Radioluminescence in Al2O3:C - analytical and numerical 
135 +
#'
136 +
#' Pagonis, V., Lawless, J., Chen, R., Anderson, C., 2009. Radioluminescence in Al2O3:C - analytical and numerical
136 137
#' simulation results. Journal of Physics D: Applied Physics 42, 175107 (9pp).
137 138
#'
138 139
#' Soetaert, K., Cash, J., Mazzia, F., 2012. Solving differential equations in R.
139 140
#' Springer Science & Business Media.
140 -
#' 
141 +
#'
141 142
#' Wintle, A., 1975. Thermal Quenching of Thermoluminescence in Quartz. Geophysical Journal International 41, 107-113.
142 143
#'
143 -
#' @seealso \code{\link{plot}}, \code{\linkS4class{RLum}},
144 -
#' \code{\link{read_SEQ2R}}
144 +
#' @seealso [plot], [Luminescence::RLum-class],
145 +
#' [read_SEQ2R]
145 146
#'
146 147
#' @examples
147 148
#'
148 -
#'
149 149
#' ##================================================================##
150 150
#' ## Example 1: Simulate Bailey2001
151 151
#' ## (cf. Bailey, 2001, Fig. 1)
@@ -166,18 +166,18 @@
Loading
166 166
#'   sequence = sequence,
167 167
#'   model = "Bailey2001"
168 168
#' )
169 -
#' 
169 +
#'
170 170
#' ##get all TL concentrations
171 -
#' 
171 +
#'
172 172
#' TL_conc <- get_RLum(model.output, recordType = "(TL)", drop = FALSE)
173 -
#' 
173 +
#'
174 174
#' plot_RLum(TL_conc)
175 -
#' 
175 +
#'
176 176
#' ##plot 110 deg. C trap concentration
177 -
#' 
178 -
#' TL_110 <- get_RLum(TL_conc, recordType = "conc. level 1") 
177 +
#'
178 +
#' TL_110 <- get_RLum(TL_conc, recordType = "conc. level 1")
179 179
#' plot_RLum(TL_110)
180 -
#' 
180 +
#'
181 181
#' ##============================================================================##
182 182
#' ## Example 2: compare different optical powers of stimulation light
183 183
#' ##============================================================================##
@@ -212,16 +212,16 @@
Loading
212 212
#' ##plot
213 213
#' plot_RLum(
214 214
#'  object = model.output.merged,
215 -
#'  xlab = "Illumination time [s]",
216 -
#'  ylab = "OSL signal [a.u.]",
215 +
#'  xlab = "Illumination time (s)",
216 +
#'  ylab = "OSL signal (a.u.)",
217 217
#'  main = "OSL signal dependency on optical power of stimulation light",
218 218
#'  legend.text = paste("Optical power density", 20*optical_power/100, "mW/cm^2"),
219 219
#'  combine = TRUE)
220 -
#'  
220 +
#'
221 221
#' ##============================================================================##
222 222
#' ## Example 3: Usage of own parameter sets (Pagonis 2009)
223 223
#' ##============================================================================##
224 -
#' 
224 +
#'
225 225
#' own_parameters <- list(
226 226
#'   N = c(2e15, 2e15, 1e17, 2.4e16),
227 227
#'   E = c(0, 0, 0, 0),
@@ -236,39 +236,39 @@
Loading
236 236
#'   model = "customized",
237 237
#'   R = 1.7e15
238 238
#'  )
239 -
#'  ## Note: In Pagonis 2009 is B the valence band to hole centre probability, 
239 +
#'  ## Note: In Pagonis 2009 is B the valence band to hole centre probability,
240 240
#'  ## but in Bailey 2001 this is A_j. So the values of B (in Pagonis 2009)
241 -
#'  ## are A in the notation above. Also notice that the first two entries in N, A and 
241 +
#'  ## are A in the notation above. Also notice that the first two entries in N, A and
242 242
#'  ## B belong to the electron traps and the last two entries to the hole centres.
243 -
#'  
243 +
#'
244 244
#'  own_state_parameters <- c(0, 0, 0, 9.4e15)
245 -
#'  
246 -
#'  ## calculate Fig. 3 in Pagonis 2009. Note: The labels for the dose rate in the original 
245 +
#'
246 +
#'  ## calculate Fig. 3 in Pagonis 2009. Note: The labels for the dose rate in the original
247 247
#'  ## publication are not correct.
248 248
#'  ## For a dose rate of 0.1 Gy/s belongs a RF signal to ~ 1.5e14 (see Fig. 6).
249 -
#'  
249 +
#'
250 250
#'  sequence <- list(RF = c(20, 0.1, 0.1))
251 -
#'  
251 +
#'
252 252
#'  model_LuminescenceSignals(
253 -
#'    model = "customized", 
254 -
#'    sequence = sequence, 
255 -
#'    own_parameters = own_parameters, 
253 +
#'    model = "customized",
254 +
#'    sequence = sequence,
255 +
#'    own_parameters = own_parameters,
256 256
#'    own_state_parameters = own_state_parameters)
257 -
#'  
258 -
#'  
259 -
#'  
260 -
#'  
261 -
#' \dontrun{  
257 +
#'
258 +
#'
259 +
#'
260 +
#'
261 +
#' \dontrun{
262 262
#' ##============================================================================##
263 263
#' ## Example 4: Simulate Thermal-Activation-Characteristics (TAC)
264 264
#' ##============================================================================##
265 -
#'  
265 +
#'
266 266
#'  ##set temperature
267 267
#'  act.temp <- seq(from = 80, to = 600, by = 20)
268 -
#'  
268 +
#'
269 269
#'  ##loop over temperature
270 270
#'  model.output <- vapply(X = act.temp, FUN = function(x) {
271 -
#'  
271 +
#'
272 272
#'  ##set sequence, note: sequence includes sample history
273 273
#'    sequence <- list(
274 274
#'      IRR = c(20, 1, 1e-11),
@@ -290,13 +290,13 @@
Loading
290 290
#'    ##return max value in TL curve
291 291
#'    return(max(get_RLum(TL_curve)[,2]))
292 292
#'  }, FUN.VALUE = 1)
293 -
#'  
293 +
#'
294 294
#'  ##plot resutls
295 295
#'  plot(
296 296
#'    act.temp[-(1:3)],
297 297
#'    model.output[-(1:3)],
298 298
#'    type = "b",
299 -
#'    xlab = "Temperature [\u00B0C]",
299 +
#'    xlab = "Temperature [\u00B0C)",
300 300
#'    ylab = "TL [a.u.]"
301 301
#'  )
302 302
#'
@@ -305,8 +305,8 @@
Loading
305 305
#' ##============================================================================##
306 306
#'
307 307
#' ##set SAR sequence with the following steps
308 -
#' ## (1) RegDose: set regenerative dose [Gy] as vector
309 -
#' ## (2) TestDose: set test dose [Gy]
308 +
#' ## (1) RegDose: set regenerative dose (Gy) as vector
309 +
#' ## (2) TestDose: set test dose (Gy)
310 310
#' ## (3) PH: set preheat temperature in deg. C
311 311
#' ## (4) CH: Set cutheat temperature in deg. C
312 312
#' ## (5) OSL_temp: set OSL reading temperature in deg. C
@@ -418,6 +418,7 @@
Loading
418 418
#'    )
419 419
#'
420 420
#'}
421 +
#' @md
421 422
#' @export
422 423
model_LuminescenceSignals <- function(
423 424
  model,
@@ -434,34 +435,25 @@
Loading
434 435
) {
435 436
436 437
# Integrity tests and conversion --------------------------------------------------------------
437 -
  
438 +
438 439
  if(missing(model))
439 440
    stop("[model_LuminescenceSignals()] Argument 'model' not given!", call. = FALSE)
440 -
  
441 +
441 442
  if(missing(sequence))
442 443
    stop("[model_LuminescenceSignals()] Argument 'sequence' not given!", call. = FALSE)
443 444
444 445
  #Check if model is supported
445 -
  model.allowed_keywords <- c("Bailey2001", 
446 -
                              "Bailey2004", 
447 -
                              "Pagonis2008", 
448 -
                              "Pagonis2007", 
449 -
                              "Bailey2002", 
450 -
                              "Friedrich2017", 
451 -
                              "Friedrich2018",
452 -
                              "customized",
453 -
                              "customised")
446 +
  model.allowed_keywords <- .set_pars()
454 447
455 448
  if(!model%in%model.allowed_keywords)
456 -
    stop(paste0("[model_LuminescenceSignals()] Model not supported. Supported models are: ", 
449 +
    stop(paste0("[model_LuminescenceSignals()] Model not supported. Supported models are: ",
457 450
                paste(model.allowed_keywords, collapse = ", ")))
458 451
459 452
  #Check sequence
460 453
  if(is(sequence, "character")){
461 -
    
462 454
    if(!tools::file_ext(sequence) %in% c("SEQ", "seq"))
463 455
      stop("[model_LuminescenceSignals()] Argument 'sequence' is not a *.SEQ file!", call. = FALSE)
464 -
  
456 +
465 457
    sequence <- read_SEQ2R(
466 458
        file = sequence,
467 459
        lab.dose_rate = lab.dose_rate,
@@ -475,7 +467,7 @@
Loading
475 467
476 468
    # test if .create_SAR.sequence is requiered
477 469
    if("RegDose"%in%names(sequence)){
478 -
      
470 +
479 471
      RegDose = sequence$RegDose
480 472
      TestDose = sequence$TestDose
481 473
      PH = sequence$PH
@@ -501,7 +493,7 @@
Loading
501 493
      optical_power = sequence$optical_power
502 494
      if(is.null(optical_power))
503 495
        optical_power <- 90
504 -
      
496 +
505 497
      if(!"Irr_2recover" %in% names(sequence)){# SAR sequence
506 498
507 499
        sequence <- .create_SAR.sequence(
@@ -515,7 +507,7 @@
Loading
515 507
          PH_duration = PH_duration,
516 508
          dose_rate = dose_rate,
517 509
          optical_power = optical_power)
518 -
        
510 +
519 511
      } else {# DRT sequence
520 512
521 513
        sequence <- .create_DRT.sequence(
@@ -532,9 +524,9 @@
Loading
532 524
          Irr_2recover = sequence$Irr_2recover)
533 525
    }
534 526
  } else {
535 -
    
527 +
536 528
   sequence <- sequence
537 -
   
529 +
538 530
  }
539 531
  } else { # end if(is.list(sequence))
540 532
    stop("[model_LuminescenceSignals()] Sequence has to be of class list or a *.seq file", call. = FALSE)
@@ -547,7 +539,7 @@
Loading
547 539
548 540
  ##check
549 541
  if(!all(names(sequence)%in%sequence.allowed_keywords)){
550 -
    stop(paste0("[model_LuminescenceSignals()] Unknow sequence arguments: Allowed arguments are: ", 
542 +
    stop(paste0("[model_LuminescenceSignals()] Unknow sequence arguments: Allowed arguments are: ",
551 543
                paste(sequence.allowed_keywords, collapse = ", ")), call. = FALSE)
552 544
    }
553 545
@@ -558,67 +550,67 @@
Loading
558 550
  extraArgs <- list(...)
559 551
560 552
# Load model parameters ------------------------------------------------------------------------------------
561 -
  
553 +
562 554
  ## check if "parms" in extra arguments for fitting data to model parameters
563 555
564 556
    if(model == "customized" || model == "customised"){
565 557
        if(is.null(own_parameters)){
566 -
          stop("[model_LuminescenceSignals()] Argument 'model' set to 'customized', but no own parameters are given!", 
558 +
          stop("[model_LuminescenceSignals()] Argument 'model' set to 'customized', but no own parameters are given!",
567 559
               call. = FALSE)}
568 -
    
560 +
569 561
        parms <- own_parameters
570 -
        
562 +
571 563
        ##check if "Th", "E_th", "k_B", "W" or "K" are set
572 564
        if("Th" %in% names(parms)){
573 565
          parms$Th <- unname(unlist(parms["Th"]))
574 566
        } else {
575 567
          parms$Th <- rep(0, length(parms$N))
576 568
        }
577 -
        
569 +
578 570
        if("E_th" %in% names(parms)){
579 571
          parms$E_th <- unname(unlist(parms["E_th"]))
580 572
        } else {
581 573
          parms$E_th <- rep(0, length(parms$N))
582 574
        }
583 -
        
575 +
584 576
        parms["k_B"] <- ifelse("k_B" %in% names(parms), unname(unlist(parms["k_B"])), 8.617e-05)
585 577
        parms["W"] <- ifelse("W" %in% names(parms), unname(unlist(parms["W"])), 0.64)
586 578
        parms["K"] <- ifelse("K" %in% names(parms), unname(unlist(parms["K"])), 2.8e7)
587 -
        
579 +
588 580
        ## set start temperature
589 581
        start_temp <- ifelse(is.null(own_start_temperature), 20, own_start_temperature)
590 582
591 583
        if(!is.null(own_state_parameters)){ ## state parameters submitted
592 -
          
584 +
593 585
          own_state_parameters <- c(own_state_parameters, 0, 0)
594 -
          
586 +
595 587
          n <- Luminescence::set_RLum(class = "RLum.Results",
596 588
                                      data = list(n = own_state_parameters,
597 589
                                                  temp = start_temp,
598 590
                                                  model = model))
599 -
          
591 +
600 592
        } else { ## no state parameters submitted
601 -
          
593 +
602 594
          n <- Luminescence::set_RLum(class = "RLum.Results",
603 595
                                      data = list(n = rep(0,length(parms$N)+2),
604 596
                                                  temp = start_temp,
605 597
                                                  model = model))
606 598
        }
607 -
        
599 +
608 600
    } else { ## model not customized and parms not set
609 -
      
601 +
610 602
      if(!is.null(own_parameters)){
611 603
        warning(paste0("[model_LuminescenceSignals()] Argument 'own_parameters' set, but argument 'model' not set to 'customized'. Used '", model, "' as argument for 'model'."), call. = FALSE)
612 604
      }
613 -
      
605 +
614 606
      if(!is.null(own_state_parameters)){
615 607
        warning(paste0("[model_LuminescenceSignals()] Argument 'own_sate_parameters' set, but argument 'model' not set to 'customized'. Ignored argument 'own_state_parameters'."), call. = FALSE)
616 608
      }
617 -
      
609 +
618 610
      if(!is.null(own_start_temperature)){
619 611
        warning(paste0("[model_LuminescenceSignals()] Argument 'own_start_temperature' set, but argument 'model' not set to 'customized'. Ignored argument 'own_start_temperature'."), call. = FALSE)
620 612
      }
621 -
        
613 +
622 614
        parms <- .set_pars(model)
623 615
624 616
        if(simulate_sample_history){
@@ -647,10 +639,10 @@
Loading
647 639
648 640
  if(plot){
649 641
650 -
    plot.data <- get_RLum(model.output, 
651 -
                          recordType = c("RF$", "TL$", "OSL$", "LM-OSL$", "RF_heating$", "pause$"), 
642 +
    plot.data <- get_RLum(model.output,
643 +
                          recordType = c("RF$", "TL$", "OSL$", "LM-OSL$", "RF_heating$", "pause$"),
652 644
                          drop = FALSE)
653 -
    
645 +
654 646
    Luminescence::plot_RLum(plot.data, ...)
655 647
  }
656 648

@@ -10,7 +10,7 @@
Loading
10 10
#'
11 11
#' @param RLumModel_ID \code{\link{numeric}} (optional): A ID-number for the TL-step. This ID
12 12
#' is pass down to \link{calc_concentrations} so all concentrations had the same ID as the
13 -
#' sequence step they were calculated from. This ID is identic to the sequence step in "sequence".
13 +
#' sequence step they were calculated from. This ID is identical to the sequence step in "sequence".
14 14
#'
15 15
#' @param n \code{\link{numeric}} or \code{\linkS4class{RLum.Results}} (\bold{required}):
16 16
#' concentration of electron-/holetraps, valence- and conduction band

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
R 0.20% 91.61%
src 100.00%
Project Totals (20 files) 92.07%
Loading