Description Usage Arguments Details Value Examples See Also

View source: R/colorSpec.emulate.R

The two possible modifications are:

pre-multiplication by a transmitting filter

post-multiplication by a matrix

Both of these are optional.
If neither of these modifications is enabled, the original `x`

is returned.

1 2 |

`x` |
a |

`y` |
a |

`filter` |
enable filter pre-multiplication. |

`matrix` |
enable matrix post-multiplication.
If |

If `filter=FALSE`

and `matrix=TRUE`

then
the returned value is `multiply(x,A)`

,
where the matrix `A`

is computed to minimize the difference with
`y`

, in the least squares sense (Frobenius matrix norm).
The function `MASS::ginv()`

is used here.

If `filter=TRUE`

and `matrix=FALSE`

then
the returned value is `product(filter,x)`

,
where the object `filter`

is computed to minimize the difference with
`y`

, in the least squares sense (Frobenius matrix norm).
This calculation is fairly straightforward,
but requires that the responsivity of `x`

does not vanish at any wavelength.
It also requires that `M=N`

.
The computed filter may be unrealistic, i.e. the transmittance may be > 1.
If this happens a `WARN`

message is issued.

If `filter=TRUE`

and `matrix=TRUE`

then
the returned value is `product(filter,multiply(x,A))`

,
where `(filter,A)`

are chosen with the above minimization criterion.
If `N=1`

then we must have `M=1`

as well;
the calculation is trivial and the emulation is exact.
If `N`

*≥* `2`

,
the calculation is iterative - solving alternatively for
`filter`

and `A`

until convergence.
The function `MASS::ginv()`

is used on each iteration.
This is a bilinear optimization.
If convergence fails, it is an error and the function returns `NULL`

.
If convergence succeeds, there is 1 degree of freedom in the `(filter,A)`

pair.
If one is scaled by a positive constant, the other can be scaled by the inverse,
and the returned object is the same.
The filter is scaled so the maximum transmittance is 1.

If `filter=FALSE`

and `matrix=FALSE`

then
the original `x`

is returned, with a `WARN`

message.

a **colorSpec** object close to `y`

, as in **Details**.
The `quantity`

is the same as `y`

.
The `specnames()`

are the same as those of `y`

,
except that `".em"`

is appended to each one.
The function attaches attribute `"emulate"`

,
whose value is a list containing `filter`

and/or `A`

as appropriate.

see the vignette **Emulation of one Camera by another Camera**

`wavelength`

,
`type`

,
`quantity`

,
`multiply`

,
`product`

,
`specnames`

colorSpec documentation built on April 2, 2018, 5:05 p.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.