Skip to content

Commit

Permalink
Fix names
Browse files Browse the repository at this point in the history
  • Loading branch information
Bisaloo committed Dec 4, 2018
1 parent 9b05070 commit b0ff46c
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions R/peakshape.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,10 @@ peakshape <- function(rspecdata, select = NULL, lim = NULL,
rspecdata2 <- rspecdata[wl>=lim[1] & wl<=lim[2], , drop = FALSE]

Bmax <- apply(rspecdata2, 2, max) # max refls
Bmin <- apply(rspecdata2, 2, min) # min refls
Bmin_all <- apply(rspecdata, 2, min) # min refls, whole spectrum

if (absolute.min) {
Bmin <- apply(rspecdata, 2, min) # min refls, whole spectrum
} else {
Bmin <- apply(rspecdata2, 2, min) # min refls
}

halfmax <- (Bmax + Bmin) / 2 # reflectance midpoint
halfmax <- ifelse(absolute.min, (Bmax + Bmin_all)/2, (Bmax + Bmin)/2)

Xi <- vapply(
seq_along(rspecdata2),
Expand All @@ -115,7 +111,7 @@ peakshape <- function(rspecdata, select = NULL, lim = NULL,
return(c(fstHM, sndHM))
})

if (any(Yj > Yk)) {
if (any(Bmin > Bmin_all)) {
warning("Consider fixing ", dQuote("lim"), " in spectra with ",
Quote("incl.min"), " marked ", dQuote("No"),
" to incorporate all minima in spectral curves",
Expand Down Expand Up @@ -146,6 +142,7 @@ peakshape <- function(rspecdata, select = NULL, lim = NULL,

data.frame(
id = nms[select], B3 = as.numeric(Bmax), H1 = hue,
FWHM = Xb - Xa, HWHM.l = hue - Xa, HWHM.r = Xb - hue
FWHM = Xb - Xa, HWHM.l = hue - Xa, HWHM.r = Xb - hue,
incl.min = c("Yes", "No")[as.numeric(Bmin > Bmin_all) + 1]
)
}

0 comments on commit b0ff46c

Please sign in to comment.