Learn R Programming

rvmethod (version 0.1.2)

wave_match: Adjust the wavelength solution of a spectrum

Description

This function takes the wavelength and flux vectors of a normalized spectrum and uses cubic-spline interpolation to adjust the flux vector to match a new wavelength solution.

Usage

wave_match(wvl1, flx1, targetwvl)

Arguments

wvl1

vector of wavelengths for the spectrum to be interpolated

flx1

vector of normalized flux for the spectrum to be interpolated

targetwvl

vector of wavelengths to interpolate to.

Value

A vector of normalized flux for the spectrum at the targetwvl wavelengths. Only flux for targetwvl wavelengths that are contained by the wvl1 wavelengths are returned.

Examples

Run this code
# NOT RUN {
x = seq(0,10)
y = 5*sin(x + 2)
newx = seq(0.5, 9.5)
newy = wave_match(x, y, newx)
plot(x, y)
points(newx, newy, col=2, pch=19)
# }

Run the code above in your browser using DataLab