Type: | Package |
Title: | Continuous Wavelet Transformation for Spectroscopy |
Version: | 0.2.1 |
Maintainer: | J. Antonio Guzmán Q. <antguz06@gmail.com> |
Description: | Fast application of Continuous Wavelet Transformation ('CWT') on time series with special attention to spectroscopy. It is written using data.table and 'C++' language and in some functions it is possible to use parallel processing to speed-up the computation over samples. Currently, only the second derivative of a Gaussian wavelet function is implemented. |
License: | GPL (≥ 3) |
URL: | https://github.com/Antguz/CWT |
BugReports: | https://github.com/Antguz/CWT/issues |
Depends: | R (≥ 4.0.0) |
Imports: | data.table (≥ 1.14.0), Rcpp |
Suggests: | testthat (≥ 3.2.0) |
LinkingTo: | Rcpp, RcppArmadillo |
ByteCompile: | true |
Config/testthat/edition: | 3 |
Encoding: | UTF-8 |
Language: | en-US |
RoxygenNote: | 7.3.1 |
SystemRequirements: | GNU make |
NeedsCompilation: | yes |
Packaged: | 2024-06-28 01:17:03 UTC; antonio |
Author: | J. Antonio Guzmán Q.
|
Repository: | CRAN |
Date/Publication: | 2024-06-28 03:50:02 UTC |
Continuous Wavelet Transformation for Spectroscopy
Description
Fast application of Continuous Wavelet Transformation on time series with special attention to spectroscopy. It is written using 'data.table' and 'C++' language and in some functions it is possible to use parallel processing to speed-up the computation over samples.
Author(s)
Maintainer: J. Antonio Guzmán Q. antguz06@gmail.com (ORCID) [copyright holder]
See Also
Useful links:
Continuous Wavelet Transform
Description
Compute a 1D continuous wavelet transformation using 2st order derivative Gaussian wavelet.
Usage
cwt(t, scales, variance = 1, summed_wavelet = FALSE, threads = 1L)
Arguments
t |
A |
scales |
A positive |
variance |
A positive |
summed_wavelet |
If |
threads |
An |
Value
If summed_wavelet = TRUE
, it returns a data.table
where
columns are the sum of wavelet scales. If summed_wavelet = FALSE
, it
returns an array
(i.e., time, samples, and scales).
Author(s)
J. Antonio Guzmán Q.
Examples
time_series <- sin(seq(0, 20 * pi, length.out = 100))
# Using a numeric vector
cwt(t = time_series,
scales = c(1, 2, 3, 4, 5),
summed_wavelet = FALSE)
cwt(t = time_series,
scales = c(1, 2, 3, 4, 5),
summed_wavelet = TRUE)
# Using a matrix
times <- 100
frame <- matrix(rep(time_series, times),
nrow = times,
byrow = TRUE)
cwt(t = frame,
scales = c(1, 2, 3, 4, 5),
summed_wavelet = FALSE)
cwt(t = frame,
scales = c(1, 2, 3, 4, 5),
summed_wavelet = TRUE)
Full Width Half Maximum Resampling
Description
It resample spectra data using Full Width Half Maximum (FWHM).
Usage
resampling_FWHM(spectra, wavelengths, new_wavelengths, FWHM, threads = 1L)
Arguments
spectra |
A |
wavelengths |
A |
new_wavelengths |
A |
FWHM |
A |
threads |
An |
Value
It returns a data.table
with the resampled spectra, where columns
are the new bands and rows are samples.
Author(s)
J. Antonio Guzmán Q.
Examples
mean <- 50
sd1 <- 5
sd2 <- 10
n <- 100
test <- matrix(c(dnorm(1:n, mean = mean, sd = sd1),
dnorm(1:n, mean = mean, sd = sd2)),
nrow = 2,
byrow = TRUE)
current_bands <- 1:n
new_bands <- seq(10, 90, by = 5)
FHWM <- rep(5, length(new_bands))
resampling_FWHM(spectra = test,
wavelengths = current_bands,
new_wavelengths = new_bands,
FWHM = FHWM)