Compute the matrix that converts between incremental cone
coordinates and DKL space. The order of
the coordinates in the DKL column vectors is (Lum, RG, S)
The code follows that published by Brainard
as an appendix to Human Color Vision by Kaiser
and Boynton, but has been generalized to work
for passed cone fundamentals and luminosity
These should be passed in standard Psychtoolbox
form (LMS in rows of T_cones; luminosity function
as single row vector T_Y).
The argument bg is the LMS cone coordinates of the
background that defines the space.
8/30/96 dhb Pulled it out.
4/9/05 dhb Allow passing of cones and luminance to be used.
11/17/05 dhb Require passing of cones and luminance.
dhb Fixed definition of M_raw to handle arbitrary L,M scaling.
10/5/12 dhb Comment specifying coordinate system convention. Supress extraneous printout.
04/13/17 dhb Return weights that give luminance from sum of L and M cone excitations.
08/20/21 dhb Added check of a direct method of computing M, provided by Supi Ray (firstname.lastname@example.org).
The check is commented out at the end of this routine, but
does indeed give the same answer in the limited cases I’ve
checked. At the heart of the derivation is analytic
inversion of M_raw. I imagine that Ray would be happy to
provide the derivation if asked.