spec.arith: Arithmetic operations on spectra

Description Usage Arguments Value Author(s)

Description

The functions perform the elementary arithmetic operations on the flux values of spectra. If s2 is a spectrum sampled on a different wavelength vector than s1, it is first resampled. If s2 is a numeric vector, it must have the same length as s1.

Usage

1
2
3
4
5
spadd(s1, s2)
spsub(s1, s2)
spmult(s1, s2)
spdiv(s1, s2)
sarith(s1, s2, op)

Arguments

s1

object of class spectrum with components lambda, value and optionally noise, contsub and mask

s2

object of class spectrum, a number or a numerical vector of the same length as the value component of s1

op

One of '+', '-', '*', '/'.

Value

an object of class spectrum, sampled on the same wavelength vector as s1

When adding or subtracting spectra, their noise vectors are added quadratically. If s2 is a number, the noise vector of s1 is unchanged.

When multiplying or dividing spectra, the noise vector of s1 is scaled by the value of s2. This is appropriate if s2 is some wavelength-dependent scaling (like a transmission curve), but it is not fully general!

Author(s)

Oliver Czoske


oczoske/slacR documentation built on May 20, 2019, 8:23 p.m.