Note:
Note that his tutorial will not explain you the math/algorithms behind the different processing methods.
RGPR
# install "devtools" if not already done
if(!require("devtools")) install.packages("devtools")
devtools::install_github("emanuelhuber/RGPR")
library(RGPR) # load RGPR in the current R session
RPGR
comes along with a GPR data called frenkeLine00
. Because this name is long, we set x
equal to frenkeLine00
:
x <- frenkeLine00
plot(x)
We apply some basic processing to the data with the pipe operator (%>%
):
x <- x %>% estimateTime0(w = 5, method = "MER", FUN = mean) %>%
time0Cor(method = "pchip") %>%
dewow(type = "Gaussian", w = 5) %>%
fFilter(f = c(200, 300), type = "low") %>%
gainSEC(a = 0.003, t0 = 50)
plot(x)
Select points interactively on the plot with
xy <- locator(type = "l")
## $x
## [1] 11.8 15.0 17.7 20.3 24.4 27.4 30.9 35.2
##
## $y
## [1] 142.2 119.8 107.7 99.5 97.5 105.6 120.9 138.1
Fit the corresponding hyperbola with the function hyperbolaFit()
:
hyp <- hyperbolaFit(xy)
hyperbolaFit()
returns:
c(hyp$x0, hyp$t0)
hyp$vrms
hyp$z0
hyp$x
and hyp$y
lm()
): hyp$reg
Plot the hyperbola for x-position ranging from 5 to 50:
plot(x)
points(xy, pch = 20, col = "blue")
hyperbolaPlot(hyp, x = seq(5, 50, by = 0.01), col = "red", lwd = 2)
Plot the hyperbola without defining its x-position (in this case the hyperbola is displayed over the entire plot)
plot(x)
points(xy, pch = 20, col = "blue")
hyperbolaPlot(hyp, col = "red", lwd = 2)
Define the hyperbola range with xlim
and add some annotations:
plot(x)
points(xy, pch = 20, col = "blue")
hyperbolaPlot(hyp, col = "red", lwd = 2, xlim = c(10, 40), ann = TRUE)
Define the hyperbola parameters
hyp2 <- list(x0 = hyp$x0, t0 = hyp$t0, vrms = hyp$vrms)
Plot the hyperbola
plot(x)
points(hyp$x0, hyp$t0, pch = 20, col = "red", cex = 1.3)
hyperbolaPlot(hyp2, col = "blue", lwd = 2, ann = TRUE)
Using the output of hyperbolaFit()
:
xv <- seq(5, 45, by = 0.1)
y <- hyperbolaSim(xv, hyp)
plot(x)
points(hyp$x0, hyp$t0, pch = 20, col = "blue")
lines(xv, y)
Defining its vertex position and the root-mean-square velocity:
hyp2 <- list(x0 = hyp$x0, t0 = hyp$t0, vrms = hyp$vrms)
xv <- seq(5, 45, by = 0.1)
y <- hyperbolaSim(xv, hyp2)
plot(x)
lines(xv, y)
points(hyp$x0, hyp$t0, pch = 20, col = "blue")