Author: Jose Eduardo Meireles

# Resampling Spectra

#### Jose Eduardo Meireles

#### January 2025

`spectrolab` can resample spectra using the method `resample`. Since version 0.19, spectrolab uses a gaussian model that takes the Full Width at Half Maximum or FWHM to compute the spectrum values at the new bands.

Here s a quick example.

    dir_path = system.file("extdata/svc_raw_and_overlap_matched_serbin/SVC_Files_moc", package = "spectrolab")

    s_raw     = read_spectra(dir_path)

    new_bands = seq(400, 2400, 5)
    fwhm      = make_fwhm(s_raw, new_bands)
    #> setting k to the number of unique band diff values

    s_resamp  = resample(s_raw,new_bands = new_bands, fwhm = fwhm)

    plot(s_raw, lwd = 0.5)
    plot(s_resamp, add = TRUE, lwd = 0.25, col = "red")