Skip to contents

Spectra can be conformed to a standard suite of wavenumbers to be compared with a reference library or to be merged to other spectra.

Usage

conform_spec(x, ...)

# Default S3 method
conform_spec(x, ...)

# S3 method for class 'OpenSpecy'
conform_spec(x, range = NULL, res = 5, allow_na = F, type = "interp", ...)

Arguments

x

a list object of class OpenSpecy.

range

a vector of new wavenumber values, can be just supplied as a min and max value.

res

spectral resolution adjusted to or NULL if the raw range should be used.

allow_na

logical; should NA values in places beyond the wavenumbers of the dataset be allowed?

type

the type of wavenumber adjustment to make. "interp" results in linear interpolation while "roll" conducts a nearest rolling join of the wavenumbers. "mean_up" assigns source values by midpoint and returns one row for every requested wavenumber: occupied bins are averaged, while requested positions with no source value are linearly interpolated. This can maintain smaller peaks, match either a coarser or finer target axis, and avoid full-size grouping copies. The mean-up option is still experimental.

...

further arguments passed to approx()

Value

adj_intens() returns a data frame containing two columns named "wavenumber" and "intensity"

See also

restrict_range() and flatten_range() for adjusting wavenumber ranges; subtr_baseline() for spectral background correction

Author

Win Cowger, Zacharias Steinmetz

Examples

data("raman_hdpe")
conform_spec(raman_hdpe, c(1000, 2000))
#>      wavenumber intensity
#>           <num>     <num>
#>   1:       1000  61.69439
#>   2:       1005  69.33837
#>   3:       1010  66.49849
#>   4:       1015  65.00000
#>   5:       1020  70.80060
#>  ---                     
#> 197:       1980 100.32542
#> 198:       1985 114.12203
#> 199:       1990 122.80339
#> 200:       1995 106.29492
#> 201:       2000 115.16610
#> 
#> $metadata
#>        x     y  user_name spectrum_type spectrum_identity      organization
#>    <int> <int>     <char>        <char>            <char>            <char>
#> 1:     1     1 Win Cowger         Raman              HDPE Horiba Scientific
#>     license                                                        session_id
#>      <char>                                                            <char>
#> 1: CC BY-NC 5728ddde4f649fd71f6f487fc5ad8d80/dc85257201307a131e71d9ec24aaccbf
#>                             file_id
#>                              <char>
#> 1: cb06ce2846b119d932fb6696479a445b