Skip to content

Commit

Permalink
Restore NA handling in T.oil
Browse files Browse the repository at this point in the history
  • Loading branch information
Bisaloo committed Sep 6, 2024
1 parent 67cce51 commit ee8d21e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/sensmodel.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,15 @@ sensmodel <- function(peaksens, range = c(300, 700), lambdacut = NULL, Bmid = NU

peaks <- peaks / apply(peaks, 1, max)

# FIXME: re-add handling of NA
if (!is.null(lambdacut) && !is.null(Bmid)) {
T.oil <- exp(-exp(-2.89 * Bmid * (sensecurves - lambdacut) + 1.08))
if (!identical(is.na(lambdacut), is.na(Bmid))) {
warning("NA in lambdacut not paired with NA in Bmid, value of Bmid omitted", call. = FALSE)
T.oil[is.na(lambdacut)] <- 1
}
peaks <- peaks * T.oil
}


for (i in seq_along(peaksens)) {
if (!is.null(lambdacut) && !is.null(oiltype)) {
if (oiltype[i] == "T") {
Expand Down

0 comments on commit ee8d21e

Please sign in to comment.