# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#' Mean removal
#'
#' Remove the mean
#' @useDynLib hvsrProc
#' @importFrom Rcpp sourceCpp
#' @param ts An array of time series
#' @param nDC a flag number, if negative, DC is based on the whole windowed record;
#' if positive, DC is based on the first nDC points.
#' @return The DC time series.
#' @export
mean_removal <- function(ts, nDC = -1L) {
.Call('_hvsrProc_mean_removal', PACKAGE = 'hvsrProc', ts, nDC)
}
#' Konno Ohmachi smoothing
#'
#' Apply Konno Ohmachi smoothing to the Fourier Amplitude Spectra (FAS) (Konno, K., Ohmachi, T. Ground-motion characteristics estimated from spectral ratio between horizontal and vertical components of microtremor. Bulletin of the Seismological Society of America. 1998.88 (1): 228–241.)
#' @useDynLib hvsrProc
#' @importFrom Rcpp sourceCpp
#' @param freq An array of the frequency
#' @param amp An array of the corresponding FAS
#' @param b The coefficient of bandwidth. A smaller value will lead to more smoothing
#' @param rate The truncation rate of KO smoothing. A larger value will be more accurate but more time consuming
#' @return The smoothed FAS
#' @export
ko_smooth <- function(freq, amp, b = 20, rate = 2.5) {
.Call('_hvsrProc_ko_smooth', PACKAGE = 'hvsrProc', freq, amp, b, rate)
}
#' Parzen smoothing
#'
#' Apply Parzen smoothing to the Fourier Amplitude Spectra (FAS). The key formula is referred from Eq (5) on the page: http://www2.kobe-u.ac.jp/~nagaotak/poster2017wcee.pdf
#' @useDynLib hvsrProc
#' @importFrom Rcpp sourceCpp
#' @param freq An array of the frequency
#' @param amp An array of the corresponding FAS
#' @param b The bandwidth. A larger value will lead to more smoothing
#' @return The smoothed FAS
#' @export
parzen_smooth <- function(freq, amp, b = 1.5) {
.Call('_hvsrProc_parzen_smooth', PACKAGE = 'hvsrProc', freq, amp, b)
}
#' STA to LTA calculation
#'
#' Calculate the ratio of Short Term Average (STA) to Long Term Average (LTA)
#' @useDynLib hvsrProc
#' @importFrom Rcpp sourceCpp
#' @param ts An array of time series
#' @param short_term An integer, short term length for STA (number of points)
#' @param long_term An integer, long term length for LTA (number of points)
#' @param moving_term An integer, moving step of the preceding point (number of points)
#' @return A vector, the STA/LTA ratios
#' @export
sta_lta_calc <- function(ts, short_term, long_term, moving_term) {
.Call('_hvsrProc_sta_lta_calc', PACKAGE = 'hvsrProc', ts, short_term, long_term, moving_term)
}
#' Taper function
#'
#' Apply Taper to the time series
#' @useDynLib hvsrProc
#' @importFrom Rcpp sourceCpp
#' @param ts An array of time series
#' @param t_front A number, the percentage of taperring for the beginning of the time series
#' @param t_end A number, the percentage of taperring for the end of the time series
#' @return The Taperred time series.
#' @export
taper <- function(ts, t_front = 5, t_end = 5) {
.Call('_hvsrProc_taper', PACKAGE = 'hvsrProc', ts, t_front, t_end)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.