qe_ratio {photobiology} | R Documentation |
Photon:energy ratio
Description
This function returns the photon to energy ratio for each waveband of a light source spectrum.
Usage
qe_ratio(spct, w.band, scale.factor, wb.trim, use.cached.mult, use.hinges, ...)
## Default S3 method:
qe_ratio(spct, w.band, scale.factor, wb.trim, use.cached.mult, use.hinges, ...)
## S3 method for class 'source_spct'
qe_ratio(
spct,
w.band = NULL,
scale.factor = 1,
wb.trim = getOption("photobiology.waveband.trim", default = TRUE),
use.cached.mult = FALSE,
use.hinges = NULL,
naming = "short",
name.tag = ifelse(naming != "none", "[q:e]", ""),
...
)
## S3 method for class 'source_mspct'
qe_ratio(
spct,
w.band = NULL,
scale.factor = 1,
wb.trim = getOption("photobiology.waveband.trim", default = TRUE),
use.cached.mult = FALSE,
use.hinges = NULL,
naming = "short",
name.tag = ifelse(naming != "none", "[q:e]", ""),
...,
attr2tb = NULL,
idx = "spct.idx",
.parallel = FALSE,
.paropts = NULL
)
Arguments
spct |
source_spct. |
w.band |
waveband or list of waveband objects. |
scale.factor |
numeric vector of length 1, or length equal to that of
|
wb.trim |
logical if TRUE wavebands crossing spectral data boundaries are trimmed, if FALSE, they are discarded. |
use.cached.mult |
logical Flag telling whether multiplier values should be cached between calls. |
use.hinges |
logical Flag indicating whether to insert "hinges" into the spectral data before integration so as to reduce interpolation errors at the boundaries of the wavebands. |
... |
other arguments (possibly used by derived methods). |
naming |
character one of "long", "default", "short" or "none". Used to select the type of names to assign to returned value. |
name.tag |
character Used to tag the name of the returned values. |
attr2tb |
character vector, see |
idx |
character Name of the column with the names of the members of the collection of spectra. |
.parallel |
if TRUE, apply function in parallel, using parallel backend provided by foreach |
.paropts |
a list of additional options passed into the foreach function when parallel computation is enabled. This is important if (for example) your code relies on external data or packages: use the .export and .packages arguments to supply them so that all cluster nodes have the correct environment set up for computing. |
Details
The ratio is based on one photon irrandiance and one energy irradiance, both computed for the same waveband.
\frac{Q(s, wb)}{I(s, wb)}
The last two parameters control speed optimizations. The defaults
should be suitable in most cases. If you will use repeatedly the same SWFs
on many spectra measured at exactly the same wavelengths you may obtain
some speed up by setting use.cached.mult=TRUE
. However, be aware
that you are responsible for ensuring that the wavelengths are the same in
each call, as the only test done is for the length of the w.length
vector.
Value
Computed values are ratios between photon irradiance and energy
irradiance for a given waveband. A named numeric
vector in the case
of methods for individual spectra, with one value for each waveband
passed to parameter w.band
. A data.frame
in the case of
collections of spectra, containing one column for each waveband
object, an index column with the names of the spectra, and optionally
additional columns with metadata values retrieved from the attributes of
the member spectra.
By default values are only integrated, but depending on the argument passed
to parameter quantity
they can be re-expressed as relative fractions
or percentages. In the case of vector output, names
attribute is set
to the name of the corresponding waveband unless a named list is supplied
in which case the names of the list members are used, with "[q:e]" prepended.
Units [mol J-1].
Methods (by class)
-
qe_ratio(default)
: Default for generic function -
qe_ratio(source_spct)
: Method forsource_spct
objects -
qe_ratio(source_mspct)
: Calculates photon:energy ratio from asource_mspct
object.
Performance
As this method accepts spectra as its input, it computes irradiances before computing the ratios. If you need to compute both ratios and irradiances from several hundreds or thousands of spectra, computing the ratios from previously computed irradiances avoids their repeated computation. A less dramatic, but still important, increase in performance is available when computing in the same function call ratios that share the same denominator.
See Also
Other photon and energy ratio functions:
e_fraction()
,
e_ratio()
,
eq_ratio()
,
q_fraction()
,
q_ratio()
Examples
qe_ratio(sun.spct,
waveband(c(400,700), wb.name = "White")) # mol J-1
qe_ratio(sun.spct,
waveband(c(400,700), wb.name = "White"),
scale.factor = 1e6) # umol J-1