Photobiological Calculations

227

0

The wavelength vectors of the two spectra are merged, and the missing spectral values are calculated by interpolation. After this, the two spectral values at each wavelength are added.

1 2 | ```
oper_spectra(w.length1, w.length2 = NULL, s.irrad1, s.irrad2,
trim = "union", na.rm = FALSE, bin.oper = NULL, ...)
``` |

`w.length1` |
numeric array of wavelength (nm) |

`w.length2` |
numeric array of wavelength (nm) |

`s.irrad1` |
a numeric array of spectral values |

`s.irrad2` |
a numeric array of spectral values |

`trim` |
a character string with value "union" or "intersection" |

`na.rm` |
a logical value, if TRUE, not the default, NAs in the input are replaced with zeros |

`bin.oper` |
a function defining a binary operator (for the usual math operators enclose argument in backticks) |

`...` |
additional arguments (by name) passed to bin.oper |

If trim=="union" spectral values are calculated for the whole range of wavelengths covered by at least one of the input spectra, and missing values are set in each input spectrum to zero before addition. If trim=="intersection" then the range of wavelengths covered by both input spectra is returned, and the non-overlaping regions discarded. If w.length2==NULL, it is assumed that both spectra are measured at the same wavelengths, and a simple addition is used, ensuring fast calculation.

a dataframe with two numeric variables

`w.length` |
A numeric vector with the wavelengths (nm) obtained by "fusing" w.length1 and w.length2. w.length contains all the unique vales, sorted in ascending order. |

`s.irrad` |
A numeric vector with the sum of the two spectral values at each wavelength. |

1 2 3 4 5 6 7 8 9 10 11 12 | ```
head(sun.data)
result.data <-
with(sun.data,
oper_spectra(w.length, w.length, s.e.irrad, s.e.irrad, bin.oper=`+`))
head(result.data)
tail(result.data)
my_fun <- function(e1, e2, k) {return((e1 + e2) / k)}
result.data <-
with(sun.data,
oper_spectra(w.length, w.length, s.e.irrad, s.e.irrad, bin.oper=my_fun, k=2))
head(result.data)
tail(result.data)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.