Skip to contents

Method to compute the "parallel" product of values across members of a collection of spectra or of a spectral object containing multiple spectra in long form.

Usage

s_prod(x, na.rm, ...)

# Default S3 method
s_prod(x, na.rm = FALSE, ...)

# S3 method for class 'generic_spct'
s_prod(x, na.rm = FALSE, ...)

# S3 method for class 'source_mspct'
s_prod(x, na.rm = FALSE, ...)

# S3 method for class 'response_mspct'
s_prod(x, na.rm = FALSE, ...)

# S3 method for class 'filter_mspct'
s_prod(x, na.rm = FALSE, ...)

# S3 method for class 'reflector_mspct'
s_prod(x, na.rm = FALSE, ...)

# S3 method for class 'calibration_mspct'
s_prod(x, na.rm = FALSE, ...)

# S3 method for class 'cps_mspct'
s_prod(x, na.rm = FALSE, ...)

# S3 method for class 'raw_mspct'
s_prod(x, na.rm = FALSE, ...)

Arguments

x

An R object. Currently this package defines methods for collections of spectral objects.

na.rm

logical. A value indicating whether NA values should be stripped before the computation proceeds.

...

Further arguments passed to or from other methods.

Value

If x is a collection spectral of objects, such as a "filter_mspct" object, the returned object is of same class as the members of the collection, such as "filter_spct", containing the summary spectrum, with variables with names tagged for summaries other than mean or median.

Details

Method specializations compute the product at each wavelength across a group of spectra stored in an object of one of the classes defined in package 'photobiology'. Omission of NAs is done separately at each wavelength. Interpolation is not applied, so all spectra in x must share the same set of wavelengths. An error is triggered if this condition is nor fulfilled.

Methods (by class)

  • s_prod(default):

  • s_prod(generic_spct):

  • s_prod(source_mspct):

  • s_prod(response_mspct):

  • s_prod(filter_mspct):

  • s_prod(reflector_mspct):

  • s_prod(calibration_mspct):

  • s_prod(cps_mspct):

  • s_prod(raw_mspct):

Note

Objects of classes raw_spct and cps_spct can contain data from multiple scans in multiple variables or "columns". The methods accept as arguments objects of these classes only if spectra contain data for a single spectrometer scan. In the case of cps_spct objects, a single column can also contain data from multiple scans spliced into a single variable.

The product operation is meaningful only for certain physical quantities or bases of expression.

See also

See prod for the prod() method used for the computations.

Examples

s_prod(two_filters.mspct)
#> Object: filter_spct [454 x 2]
#> Wavelength range 240-800 nm, step 1-4 nm 
#> Label: Product of 2 filter_spct objects. 
#> Rfr (/1): NA, thickness (mm): NA, attenuation mode: NA.
#> Variables:
#>  w.length: Wavelength [nm]
#>  Tfr: Total spectral transmittance [/1] 
#> --
#> # A tibble: 454 × 2
#>    w.length          Tfr
#>       <int>        <dbl>
#>  1      240 0.0000000482
#>  2      241 0.0000000464
#>  3      242 0.0000000446
#>  4      244 0.0000000414
#>  5      246 0.0000000400
#>  6      248 0.0000000400
#>  7      252 0.0000000386
#>  8      256 0.0000000329
#>  9      258 0.0000000300
#> 10      259 0.0000000300
#> # ℹ 444 more rows