---
title: "colorSpec User Guide"
author: "Glenn Davis"
date: "`r Sys.Date()`"
output:
rmarkdown::html_vignette:
css: widevignette.css # width 900px to match the included tables
toc: true
toc_depth: 2
number_sections: true
bibliography: bibliography.bib
csl: personal.csl
# csl: institute-of-mathematical-statistics.csl
# csl: transactions-on-mathematical-software.csl
vignette: >
%\VignetteIndexEntry{colorSpec User Guide}
%\VignetteEngine{knitr::rmarkdown}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(colorSpec)
```
**colorSpec** is an **R** package providing an S3 class with methods for color spectra.
It supports the standard calculations with spectral properties of light sources, materials, cameras, eyes, scanners, etc..
And it works well with the more general action spectra.
Many ideas are taken from packages
**hsdar** @hsdar,
**hyperSpec** @hyperSpec,
**pavo** @pavo,
**photobiology** @photobiology, and
**zoo** @zoo.
Some features:
- a clear classification of the common color spectra into 4 types
- flexible organization for the spectra in memory, using an S3 class - **colorSpec**
- a product algebra for the **colorSpec** objects
- uniform handling of biological eyes, electronic cameras, and general action spectra
- a few advanced calculations, such as computing optimal colors (aka MacAdam Limits)
- _inverse colorimetry_, e.g. reflectance recovery from response
- built-in essential tables, such as the CIE illuminants and color matching functions
- a package logging system with log levels taken from the popular **Log4J**
- support for reading a few spectrum file types, including CGATS
- bonus files containing some other interesting spectra
- minimal dependencies on other **R** packages
The following packages are **Imports**:
- **logger** @logger, used for all logging, see Appendix G for more information.
The following packages are **Suggests**:
- **spacesXYZ** @spacesXYZ, required for computing CCT, CRI, and for some vignettes
- **rootSolve** @rootSolve, required for inverse colorimetry
- **MASS** @MASS, required for camera emulation, which uses the matrix pseudoinverse `MASS::ginv()`
- **rgl** @rgl, required for plotting optimal colors in 3D
- **microbenchmark** @microbenchmark, for a timer with higher precision
than **R**'s built-in timer
- **arrangements** @arrangements, makes the zonohedron calculations
for optimal colors a little bit faster
- **quadprog** @quadprog, may be used in `responsivityMetrics()` to determine whether the
generators lie in an open linear halfspace
- **knitr** @knitr, **rmarkdown** @rmarkdown, and **spacesRGB** @spacesRGB,
required for building the vignettes
Some non-features:
-
There is no support for 3D colors spaces other than XYZ and RGB; see packages **colorspace** @colorspace,
**colorscience** @colorscience,
**spacesRGB** @spacesRGB,
and
**spacesXYZ** @spacesXYZ for more 3D spaces.
-
there are few non-linear operations.
The only such operations are conversion of absorbance to transmittance,
and the reparameterized wavelength $\omega$ from $\lambda$ in `computeADL()`.
The electronic camera model is purely linear with no dark current offset or other deviations.
- there is little support for scientific units; for these see packages
**photobiology** @photobiology
and **colorscience** @colorscience
- photons are parameterized by wavelength in nanometers (nm);
other wavelength units (such as Ångstrom and micron)
and alternative parameterizations (such as wavenumber and electronvolt)
are not available.
```{r echo=FALSE, results='asis'}
includetable <- function( path, height ) {
tmp1 <- URLencode( paste(readLines(path,warn=FALSE), collapse="\n"), reserved = TRUE )
tmp2 <- sprintf( '", style="border: none; seamless:seamless; width: 900px; height: %s" >', height )
# cat( '