find.bottom: Identify the bottom points in a hopping-mode position trace

Description Usage Arguments Value Author(s) Examples

View source: R/breakage.R

Description

Identifies the bottom points of each approach in a positional trace from a scanning ion conductance probe operating in hopping mode.

Usage

1
find.bottom(x, window = 50, box.size = 9, clip.ends=TRUE)

Arguments

x

A vector of positions recorded over time. Positions are taken to be measured upward, i.e. a higher value corresponds to a higher probe position further from the sample. Units are unspecified.

window

Minimum number of previous descending points before a bottom point is accepted. This allows positional wobbles at the bottom and top of a hop to be ignored.

box.size

Width (in samples) of a simple box filter to apply in order to smooth the signal before searching for minima.

clip.ends

Whether to omit bottom points discovered within window points from the end of the signal. This avoids mis-identifying a de facto minimum at the end of the signal as being an actual bottom point. TRUE by default.

Value

A logical vector the same length as the input vector x, with the bottom points set to TRUE and all others FALSE.

Author(s)

Matthew Caldwell

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# use a simple sine wave as an example signal
t <- 1:1000
hops <- sin(t * pi/100)

# find the bottom points
bots <- find.bottom(hops)

# plot the result
plot(hops, type="l")
abline(v=t[bots], col=2)

breakage documentation built on May 1, 2019, 11:30 p.m.