Learn R Programming

CWT (version 0.2.1)

resampling_FWHM: 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)

Value

It returns a data.table with the resampled spectra, where columns are the new bands and rows are samples.

Arguments

spectra

A data.table, data.frame, or matrix where columns represent bands and rows samples (i.e., pixels).

wavelengths

A numeric vector describing the current positioning of the spectral bands within spectra.

new_wavelengths

A numeric vector describing positioning of the new spectral bands to resample.

FWHM

A numeric vector describing the Full Width Half Maximums of the new spectral bands. The length of this vector should be equal than the length of new_wavelengths.

threads

An integer specifying the number of threads to use. Experiment to see what works best for your data on your hardware.

Author

J. Antonio Guzmán Q.

Examples

Run this code

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)

Run the code above in your browser using DataLab