addspec | R Documentation |
Simple function that interpolates two non wavelength alligned spectra onto a common interpolated scheme,
addspec(wave1, flux1, wave2, flux2, extrap = "constant", waveout = NULL)
wave1 |
Numeric vector; wavelength 1 in in any units (but must be the same as wave2). |
flux1 |
Numeric vector; flux density 1 in any units (but must be the same as flux2). |
wave2 |
Numeric vector; wavelength 2 in in any units (but must be the same as wave1). |
flux2 |
Numeric vector; flux density 2 in any units (but must be the same as flux1). |
extrap |
If 'constant' then values outside the range inherit the nearest. If a numeric scalar (e.g. 0) then values outside the range inherit this value. |
waveout |
Numeric vector; desired output logged wavelength grid to use. If not provided then a sorted vector of wave1 and wave2 is used instead. |
Internally it uses the R approxfun
, so if more sophisticated interpolation is necessary then other routes might be required.
Data.frame; first column is observed wavelength (Angstroms) and second column is observed flux density.
Aaron Robotham
approxfun
plot(BC03lr$Wave, BC03lr$Zspec[[5]][100,], log='xy', type='l', xlim=c(1e3,1e7),
ylim=c(1e-4,1), xlab=BC03lr$Labels$Wavelab, ylab=BC03lr$Labels$Lumlab, col='grey')
lines(Dale_Msol$Wave, Dale_Msol$Aspec[[1]][10,], col='grey')
add=addspec(BC03lr$Wave, BC03lr$Zspec[[5]][100,],Dale_Msol$Wave,
Dale_Msol$Aspec[[1]][10,])
lines(add)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.