Learn R Programming

specmine (version 4.0.0)

raman_transform_wavelet: Extract Haar wavelet features from Raman or SERS spectra

Description

Computes a multilevel discrete Haar wavelet transform for each Raman or surface-enhanced Raman spectroscopy (SERS) sample.

Usage

raman_transform_wavelet(dataset, level = 1)

Value

The input dataset, with a wavelet element containing:

data

Matrix of Haar wavelet coefficients, with coefficients in rows and samples in columns.

filter

The character string "haar".

level

Number of decomposition levels.

original_length

Number of original wavenumbers.

padded_length

Length used after optional padding.

Arguments

dataset

A dataset list containing a numeric matrix in dataset$data, with wavenumbers in rows and samples in columns.

level

Positive integer specifying the number of Haar decomposition levels.

Details

This function preserves the original data in dataset$data, following the specmine pipeline. Wavelet coefficients are stored in dataset$wavelet$data.

The input data matrix must have wavenumbers in rows and samples in columns. If needed, each spectrum is extended by repeating its final intensity value until its length is a power of two.

Examples

Run this code
wavenumbers = seq(400, 1100, length.out = 8)

dataset = list(
  data = cbind(
    sample1 = sin(seq(0, 2 * pi, length.out = 8)),
    sample2 = cos(seq(0, 2 * pi, length.out = 8))
  ),
  wavenumbers = wavenumbers
)

transformed = raman_transform_wavelet(
  dataset,
  level = 2
)

dim(transformed$wavelet$data)

Run the code above in your browser using DataLab