Spectra are tagged by adding variables and attributes containing color
definitions, labels, and a factor following the wavebands given in
w.band. This methods are most useful for plotting realistic
computed colors from spectral data.
Usage
tag(x, ...)
# Default S3 method
tag(x, ...)
# S3 method for class 'generic_spct'
tag(
x,
w.band = NULL,
wb.trim = getOption("photobiology.waveband.trim", default = TRUE),
use.hinges = TRUE,
short.names = TRUE,
chroma.type = "CMF",
byref = FALSE,
...
)
# S3 method for class 'generic_mspct'
tag(
x,
w.band = NULL,
wb.trim = getOption("photobiology.waveband.trim", default = TRUE),
use.hinges = TRUE,
short.names = TRUE,
chroma.type = "CMF",
byref = FALSE,
...,
.parallel = FALSE,
.paropts = NULL
)Arguments
- x
an R object.
- ...
ignored (possibly used by derived methods).
- w.band
waveband or list of waveband objects. The waveband(s) determine the region(s) of the spectrum that are tagged
- wb.trim
logical Flag telling if wavebands crossing spectral data boundaries are trimmed or ignored
- 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.
- short.names
logical Flag indicating whether to use short or long names for wavebands
- chroma.type
character telling whether "CMF", "CC", or "both" should be returned for human vision, or an object of class
chroma_spctfor any other trichromic visual system.- byref
logical Flag indicating if new object will be created by reference or by copy of
x- .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.
Methods (by class)
tag(default): Default method for generictag(generic_spct): Tag one ofgeneric_spct, and derived classes includingsource_spct,filter_spct,reflector_spct,object_spct, andresponse_spct.tag(generic_mspct): Tag one ofgeneric_mspct, and derived classes includingsource_mspct,filter_mspct,reflector_mspct,object_mspct, andresponse_mspct.
Note
NULL as w.band argument does not add any new tags,
instead it removes existing tags if present. NA, the default, as
w.band argument removes existing waveband tags if present and
sets the wl.color variable. If a waveband object or a list of
wavebands is supplied as argument then tagging is based on them, and
wl.color is also set.
See also
Other tagging and related functions:
is_tagged(),
untag(),
wb2rect_spct(),
wb2spct(),
wb2tagged_spct()
Examples
tag(sun.spct)
#> Object: source_spct [523 x 6]
#> Wavelength range 280-800 nm, step 1.023182e-12-1 nm
#> Label: sunlight, simulated
#> Measured on 2010-06-22 09:51:00 UTC
#> Measured at 60.20911 N, 24.96474 E; Kumpula, Helsinki, FI
#> Variables:
#> w.length: Wavelength [nm]
#> s.e.irrad: Spectral energy irradiance [W m-2 nm-1]
#> s.q.irrad: Spectral photon irradiance [mol s-1 m-2 nm-1]
#> --
#> # A tibble: 523 × 6
#> w.length s.e.irrad s.q.irrad wl.color wb.color wb.f
#> <dbl> <dbl> <dbl> <chr> <chr> <fct>
#> 1 280 0 0 #000000 #554340 Total
#> 2 281. 0 0 #000000 #554340 Total
#> 3 282. 0 0 #000000 #554340 Total
#> 4 283. 0 0 #000000 #554340 Total
#> 5 284. 0 0 #000000 #554340 Total
#> 6 285. 0 0 #000000 #554340 Total
#> 7 286. 0 0 #000000 #554340 Total
#> 8 286. 0 0 #000000 #554340 Total
#> 9 287. 0 0 #000000 #554340 Total
#> 10 288. 0 0 #000000 #554340 Total
#> # ℹ 513 more rows
tag(sun.spct, list(A = waveband(c(300,3005))))
#> Object: source_spct [524 x 6]
#> Wavelength range 280-800 nm, step 1.023182e-12-1 nm
#> Label: sunlight, simulated
#> Measured on 2010-06-22 09:51:00 UTC
#> Measured at 60.20911 N, 24.96474 E; Kumpula, Helsinki, FI
#> Variables:
#> w.length: Wavelength [nm]
#> s.e.irrad: Spectral energy irradiance [W m-2 nm-1]
#> s.q.irrad: Spectral photon irradiance [mol s-1 m-2 nm-1]
#> --
#> # A tibble: 524 × 6
#> w.length s.e.irrad s.q.irrad wl.color wb.color wb.f
#> <dbl> <dbl> <dbl> <chr> <chr> <fct>
#> 1 280 0 0 #000000 NA NA
#> 2 281. 0 0 #000000 NA NA
#> 3 282. 0 0 #000000 NA NA
#> 4 283. 0 0 #000000 NA NA
#> 5 284. 0 0 #000000 NA NA
#> 6 285. 0 0 #000000 NA NA
#> 7 286. 0 0 #000000 NA NA
#> 8 286. 0 0 #000000 NA NA
#> 9 287. 0 0 #000000 NA NA
#> 10 288. 0 0 #000000 NA NA
#> # ℹ 514 more rows
