Description Usage Arguments Details Value See Also Examples

A band-based material spectrum is a superimposition of bandpass filters, and (optionally) a bandstop filter. The 2 functions in this topic convert a vector of numbers between 0 and 1 to a band representation, and back again.

1 2 3 4 | ```
bandMaterial( lambda, wavelength=380:780 )
## S3 method for class 'colorSpec'
bandRepresentation( x )
``` |

`lambda` |
a numeric Mx2 matrix with wavelength pairs in the rows,
or a vector that can be converted to such a matrix, by row.
The two wavelengths in a row (the |

`wavelength` |
a vector of wavelengths for the returned object |

`x` |
a |

`bandRepresentation()`

is a right-inverse of `bandMaterial()`

,
see **Examples** and the test script `test-bands.R`

.
For more mathematical details, see vignette **convexity**.

`bandMaterial()`

returns a
**colorSpec** object with `quantity`

equal to `'transmitance'`

.
If `lambda`

is a matrix, then the object has 1 spectrum.
If `lambda`

is a list of matrices with length N, then the object has N spectra.

`bandRepresentation()`

returns a list of matrices with 2 columns.
There is a matrix in the list for each spectrum in `x`

.

`rectangularMaterial()`

,
vignette **convexity**

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
# make a vector superimposing a bandpass and a bandstop filter, and of the proper length 401
vec = c( rep(1,100), 0.5, rep(0,40), .25, rep(1,50), 0.9, rep(0,100), 0.4, rep(1,107) )
# convert that vector to a colorSpec object, with a single spectrum
spec = colorSpec( vec, wavelength=380:780, quantity='transmittance', specnames='sample' )
# extract and print the 2 bands
lambda = bandRepresentation( spec ) ; print(lambda)
## $sample
## lambda1 lambda2
## BS 673.10 480.0
## BP1 521.25 572.4
# convert the 2 bands (the transition wavelengths) back to a vector of length 401
# and compare with the original vector
delta = vec - coredata( bandMaterial(lambda) )
range(delta)
## [1] -9.092727e-14 2.275957e-14
``` |

colorSpec documentation built on June 24, 2019, 9:03 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.