resampling_FWHM: Full Width Half Maximum Resampling

View source: R/resampling_FWHM.R

resampling_FWHMR Documentation

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 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.

Value

It returns a data.table with the resampled spectra, where columns are the new bands and rows are samples. New bands whose FWHM window falls partially outside the range of wavelengths are returned as NA.

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)


CWT documentation built on July 28, 2026, 1:07 a.m.