Skip to content

Commit

Permalink
Fix #373
Browse files Browse the repository at this point in the history
+ fx the single that caused the issue
+ ad a dedicated test
+ ad NEWS
+ up NEWS
o no manual update - regression
  • Loading branch information
RLumSK authored and mcol committed Nov 15, 2024
1 parent 02d37ad commit cefe19b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
6 changes: 6 additions & 0 deletions NEWS.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ affected was also `analyse_SAR.CWOSL()`.
prevent "Figure margins too large" errors.
* The function will not crash anymore during the plotting in another edge case related to single grain data.

### `analyse_SAR.CWOSL()`
* The function crashed for mixed set of `RLum.Analysis-class` objects typically observed
for single grain data, e.g., one object contains only TL curves while all other contain the OSL/IRSL
data from the grain. Because the function filters those records automatically, it crashed because
the aliquot number assignment internally relied on the length of the object (regression, #373, fixed)

### `analyse_SAR.TL()`
* The function now produces a more correct `rejection.criteria` data frame
(#245, fixed in #246).
Expand Down
11 changes: 10 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<!-- NEWS.md was auto-generated by NEWS.Rmd. Please DO NOT edit by hand!-->

# Changes in version 0.9.25.9000-6 (2024-09-20)
# Changes in version 0.9.25.9000-59 (2024-10-30)

## New functions

Expand All @@ -30,6 +30,15 @@
- The function will not crash anymore during the plotting in another
edge case related to single grain data.

### `analyse_SAR.CWOSL()`

- The function crashed for mixed set of `RLum.Analysis-class` objects
typically observed for single grain data, e.g., one object contains
only TL curves while all other contain the OSL/IRSL data from the
grain. Because the function filters those records automatically, it
crashed because the aliquot number assignment internally relied on the
length of the object (regression, \#373, fixed)

### `analyse_SAR.TL()`

- The function now produces a more correct `rejection.criteria` data
Expand Down
6 changes: 3 additions & 3 deletions R/analyse_SAR.CWOSL.R
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ if(is.list(object)){

}

results <- merge_RLum(lapply(1:length(object), function(x){
results <- .warningCatcher(merge_RLum(lapply(seq_along(object), function(x){
analyse_SAR.CWOSL(
object = object[[x]],
signal.integral.min = parm$signal.integral.min[[x]],
Expand All @@ -311,10 +311,10 @@ if(is.list(object)){
onlyLxTxTable = parm$onlyLxTxTable[[x]],
main = main[[x]],
...)
}))
})))

## add aliquot number
results@data$data$ALQ <- seq_along(object)
results@data$data$ALQ <- seq_along(object)[1:nrow(results@data$data)]

##return
##DO NOT use invisible here, this will prevent the function from stopping
Expand Down
20 changes: 20 additions & 0 deletions tests/testthat/test_analyse_SAR.CWOSL.R
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,26 @@ test_that("simple run", {
class = "RLum.Results"
)

##no mix TL and OSL (the only TL will be sorted out automatically)
only_TL <- set_RLum("RLum.Analysis", records = rep(object_CH_TL[[1]]@records[[2]], length(object_NO_TL[[1]]@records)))
object_mixed <- c(object_NO_TL, only_TL)

t <- expect_s4_class(
analyse_SAR.CWOSL(
object = object_mixed[2:3],
signal.integral.min = 1,
signal.integral.max = 2,
background.integral.min = 900,
background.integral.max = 1000,
fit.method = "LIN",
log = "x",
plot = FALSE,
verbose = FALSE
),
class = "RLum.Results"
)
expect_equal(nrow(t@data$data), 1)

##plot single
expect_s4_class(
analyse_SAR.CWOSL(
Expand Down

0 comments on commit cefe19b

Please sign in to comment.