eq_ratio {photobiology} | R Documentation |
Energy:photon ratio
Description
This function returns the energy to mole of photons ratio for each waveband and a light source spectrum.
Usage
eq_ratio(spct, w.band, scale.factor, wb.trim, use.cached.mult, use.hinges, ...)
## Default S3 method:
eq_ratio(spct, w.band, scale.factor, wb.trim, use.cached.mult, use.hinges, ...)
## S3 method for class 'source_spct'
eq_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", "[e:q]", ""),
...
)
## S3 method for class 'source_mspct'
eq_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", "[e:q]", ""),
...,
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 irradiance and one energy irradiance, both computed for the same waveband.
\frac{I(s, wb)}{Q(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.#'
@return Computed values are ratios between energy irradiance and photon
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 "[e:q]"
prepended. Units [J mol-1].
Value
Computed values are ratios between energy irradiance and photon
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
multiple spectra, containing one column with ratios 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 are 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 "[e:q]" prepended.
Units [mol J-1].
Methods (by class)
-
eq_ratio(default)
: Default for generic function -
eq_ratio(source_spct)
: Method forsource_spct
objects -
eq_ratio(source_mspct)
: Calculates energy:photon 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()
,
q_fraction()
,
q_ratio()
,
qe_ratio()
Examples
eq_ratio(sun.spct,
waveband(c(400,700), wb.name = "White")) # J mol-1
eq_ratio(sun.spct,
waveband(c(400,700), wb.name = "White"),
scale.factor = 1e-6) # J umol-1