View source: R/aux_hvanalysis.R
aux_hvanalysis | R Documentation |
This function cuts a three component seismic data set into time windows
that may or may not overlap and calculates the spectral ratio for each of
these windows. It returns a matrix with the ratios for each time slice.
Thus, it is a wrapper for the function signal_hvratio
. For
further information about the technique and function arguments see the
description of signal_hvratio
.
aux_hvanalysis(
data,
time,
window,
overlap = 0,
dt,
method = "periodogram",
kernel,
order = "xyz",
plot = FALSE,
...
)
data |
|
time |
|
window |
|
overlap |
|
dt |
|
method |
|
kernel |
|
order |
|
plot |
|
... |
Additional arguments passed to the plot function. |
A matrix
with the h-v-frequency ratios for each time slice.
Michael Dietze
## load example data set
data(earthquake)
## ATTENTION, THIS EXAMPLE DATA SET IS FAR FROM IDEAL FOR THIS PURPOSE
## detrend data
s <- signal_detrend(data = s)
## calculate the HV ratios straightforward
HV <- aux_hvanalysis(data = s,
dt = 1 / 200,
kernel = 100)
## calculate the HV ratios with plot output, userdefined palette
plot_col <- colorRampPalette(colors = c("grey", "darkblue", "blue", "orange"))
HV <- aux_hvanalysis(data = s,
dt = 1 / 200,
kernel = 100,
plot = TRUE,
col = plot_col(100))
## calculate the HV ratios with optimised method settings
HV <- aux_hvanalysis(data = s,
time = t,
dt = 1 / 200,
window = 15,
overlap = 0.8,
method = "autoregressive",
plot = TRUE,
col = plot_col(100),
xlab = "Time (UTC)",
ylab = "f (Hz)")
## calculate and plot stack (mean and sd) of all spectral ratios
HV_mean <- apply(X = HV, MARGIN = 1, FUN = mean)
HV_sd <- apply(X = HV, MARGIN = 1, FUN = sd)
HV_f <- as.numeric(rownames(HV))
plot(x = HV_f, y = HV_mean, type = "l", ylim = c(0, 50))
lines(x = HV_f, y = HV_mean + HV_sd, col = 2)
lines(x = HV_f, y = HV_mean - HV_sd, col = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.