Module Expr Str Import alias Assign NameStore Num Assign NameStore Dict Str Str Str Str Str Str Str Str Str Str Str Num Num Num Num Num Num Num Num NameLoad Assign NameStore Dict Str Str Str Str Str Str Str Str Str Str Str Num Num Num Num Num Num Num Num NameLoad Assign NameStore Dict Str Str Str Str Str Str Str Str Str Str Str Num Num Num Num Num Num Num Num NameLoad Assign NameStore Dict Str Str Str Str Str Str Str Str Str Str Str Num Num Num Num Num Num Num Num NameLoad Assign NameStore Dict Str Str Str Str Str Str Str Str Str Str Str Num Num Num Num Num Num Num Num NameLoad Assign NameStore Dict Str Str Str Str Str Str Str Str Str Str Str Num Num Num Num Num Num Num Num NameLoad FunctionDef arguments args NameParam NameParam defaults body Assign NameStore BinOpDiv BinOpMult Num NameLoad BinOpAdd BinOpSub BinOpMult Num NameLoad BinOpMult Num NameLoad Num Assign NameStore BinOpDiv BinOpMult Num NameLoad BinOpAdd BinOpSub BinOpMult Num NameLoad BinOpMult Num NameLoad Num Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore BinOpDiv BinOpMult Num NameLoad BinOpAdd BinOpAdd BinOpMult Num NameLoad BinOpMult Num NameLoad Num Assign NameStore BinOpDiv BinOpMult Num NameLoad BinOpAdd BinOpAdd BinOpMult Num NameLoad BinOpMult Num NameLoad Num Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore BinOpSub Num BinOpAdd NameLoad NameLoad Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore BinOpSub Num BinOpAdd NameLoad NameLoad Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore BinOpSub Num BinOpAdd NameLoad NameLoad Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore BinOpSub Num BinOpAdd NameLoad NameLoad Assign NameStore BinOpSub BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Assign NameStore BinOpSub BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Assign NameStore BinOpSub BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Assign NameStore BinOpSub BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Assign NameStore BinOpSub BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Assign NameStore BinOpSub BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Assign NameStore BinOpSub BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Assign NameStore BinOpSub BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Assign NameStore BinOpSub BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Assign NameStore BinOpDiv BinOpAdd BinOpAdd BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad NameLoad Assign NameStore BinOpDiv BinOpAdd BinOpAdd BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad NameLoad Assign NameStore BinOpDiv BinOpAdd BinOpAdd BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad NameLoad Assign NameStore BinOpDiv NameLoad NameLoad Assign NameStore BinOpDiv NameLoad NameLoad Assign NameStore BinOpDiv NameLoad NameLoad Assign NameStore BinOpDiv NameLoad NameLoad Assign NameStore BinOpDiv NameLoad NameLoad Assign NameStore BinOpDiv NameLoad NameLoad Assign NameStore BinOpDiv NameLoad NameLoad Assign NameStore BinOpDiv NameLoad NameLoad Assign NameStore BinOpDiv NameLoad NameLoad Assign NameStore BinOpAdd BinOpAdd BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Assign NameStore BinOpAdd BinOpAdd BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Assign NameStore BinOpAdd BinOpAdd BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Return TupleLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Return BoolOpAnd CompareGtE NameLoad Num CompareGtE NameLoad Num CompareGtE NameLoad Num decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore UnaryOpUSub Call NameLoad ListLoad Num NameLoad NameLoad NameLoad If CompareGt NameLoad Num body AugAssignAdd NameStore NameLoad AugAssignAdd NameStore NameLoad AugAssignAdd NameStore NameLoad Return TupleLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore AttributeLoad NameLoad attr If CompareEq NameLoad NameLoad body Assign NameStore Num If CompareLt NameLoad NameLoad body Assign NameStore BinOpDiv BinOpSub BinOpMult Num Call AttributeLoad NameLoad attr NameLoad Num Num NameLoad orelse Assign NameStore BinOpSub BinOpMult Num Call AttributeLoad NameLoad attr NameLoad Num Num orelse Assign NameStore Call AttributeLoad NameLoad attr NameLoad BinOpDiv Num NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Return TupleLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad ListLoad NameLoad NameLoad NameLoad If CompareGt NameLoad Num body AugAssignDiv NameStore NameLoad AugAssignDiv NameStore NameLoad AugAssignDiv NameStore NameLoad Return TupleLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore ListLoad ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num Assign NameStore Num Assign NameStore Num Assign NameStore Num For TupleStore NameStore NameStore Call NameLoad Call NameLoad Num Num Num body Assign NameStore Call NameLoad NameLoad NameLoad AugAssignAdd NameStore BinOpMult NameLoad SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Num AugAssignAdd NameStore BinOpMult NameLoad SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Num AugAssignAdd NameStore BinOpMult NameLoad SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Num Assign NameStore BinOpAdd BinOpAdd NameLoad NameLoad NameLoad Assign NameStore BinOpDiv NameLoad NameLoad Assign NameStore BinOpDiv NameLoad NameLoad Assign NameStore BinOpDiv NameLoad NameLoad Return TupleLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Num body Expr Str Assign NameStore BinOpMult NameLoad Num Return BinOpDiv BinOpMult Num Call AttributeLoad NameLoad attr NameLoad Num BinOpSub Call AttributeLoad NameLoad attr BinOpDiv Num BinOpMult NameLoad NameLoad Num Expr Str decorator_list If CompareEq NameLoad Str body Print Str Print Str For NameStore Call NameLoad Num Num Num body Assign TupleStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad Assign TupleStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad Print BinOpMod Str TupleLoad NameLoad NameLoad NameLoad NameLoad Assign TupleStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad Assign TupleStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad Print BinOpMod Str TupleLoad NameLoad NameLoad NameLoad
N/A N/A 
Colour Rendering of Spectra

by John Walker
http://www.fourmilab.ch/

Last updated: March 9, 2003

Converted to Python by Andrew Hutchins, sometime in early
2011.

    This program is in the public domain.
    The modifications are also public domain. (AH)

For complete information about the techniques employed in
this program, see the World-Wide Web document:

    http://www.fourmilab.ch/documents/specrend/

The xyz_to_rgb() function, which was wrong in the original
version of this program, was corrected by:

    Andrew J. S. Hamilton 21 May 1999
    Andrew.Hamilton@Colorado.EDU
    http://casa.colorado.edu/~ajsh/

who also added the gamma correction facilities and
modified constrain_rgb() to work by desaturating the
colour by adding white.

A program which uses these functions to plot CIE
"tongue" diagrams called "ppmcie" is included in
the Netpbm graphics toolkit:

    http://netpbm.sourceforge.net/

(The program was called cietoppm in earlier
versions of Netpbm.)

 N/A math N/A GAMMA_REC709 0 N/A NTSCsystem N/A name xRed yRed xGreen yGreen xBlue yBlue xWhite yWhite gamma NTSC 0.67 0.33 0.21 0.71 0.14 0.08 0.3101 0.3163 GAMMA_REC709 N/A EBUsystem N/A name xRed yRed xGreen yGreen xBlue yBlue xWhite yWhite gamma SUBU (PAL/SECAM) 0.64 0.33 0.29 0.6 0.15 0.06 0.3127 0.3291 GAMMA_REC709 N/A SMPTEsystem N/A name xRed yRed xGreen yGreen xBlue yBlue xWhite yWhite gamma SMPTE 0.63 0.34 0.31 0.595 0.155 0.07 0.3127 0.3291 GAMMA_REC709 N/A HDTVsystem N/A name xRed yRed xGreen yGreen xBlue yBlue xWhite yWhite gamma HDTV 0.67 0.33 0.21 0.71 0.15 0.06 0.3127 0.3291 GAMMA_REC709 N/A CIEsystem N/A name xRed yRed xGreen yGreen xBlue yBlue xWhite yWhite gamma CIE 0.7355 0.2645 0.2658 0.7243 0.1669 0.0085 0.3333333333 0.3333333333 GAMMA_REC709 N/A Rec709system N/A name xRed yRed xGreen yGreen xBlue yBlue xWhite yWhite gamma CIE REC709 0.64 0.33 0.3 0.6 0.15 0.06 0.3127 0.3291 GAMMA_REC709 upvp_to_xy N/A N/A up vp N/A N/A N/A xc N/A N/A 9 up N/A N/A N/A 6 up N/A 16 vp 12 N/A yc N/A N/A 4 vp N/A N/A N/A 6 up N/A 16 vp 12 N/A N/A xc yc N/A xy_toupvp N/A N/A xc yc N/A N/A N/A up N/A N/A 4 xc N/A N/A N/A -2 xc N/A 12 yc 3 N/A vp N/A N/A 9 yc N/A N/A N/A -2 xc N/A 12 yc 3 N/A N/A up vp N/A xyz_to_rgb N/A N/A cs xc yc zc N/A N/A N/A 
    Given an additive tricolour system CS, defined by the CIE x
    and y chromaticities of its three primaries (z is derived
    trivially as 1-(x+y)), and a desired chromaticity (XC, YC,
    ZC) in CIE space, determine the contribution of each
    primary in a linear combination which sums to the desired
    chromaticity.  If the  requested chromaticity falls outside
    the Maxwell  triangle (colour gamut) formed by the three
    primaries, one of the r, g, or b weights will be negative.

    Caller can use constrain_rgb() to desaturate an
    outside-gamut colour to the closest representation within
    the available gamut and/or norm_rgb to normalise the RGB
    components so the largest nonzero component has value 1.
     N/A xr N/A cs N/A xRed N/A yr N/A cs N/A yRed N/A zr N/A 1 N/A xr yr N/A xg N/A cs N/A xGreen N/A yg N/A cs N/A yGreen N/A zg N/A 1 N/A xg yg N/A xb N/A cs N/A xBlue N/A yb N/A cs N/A yBlue N/A zb N/A 1 N/A xb yb N/A xw N/A cs N/A xWhite N/A yw N/A cs N/A yWhite N/A zw N/A 1 N/A xw yw N/A rx N/A N/A yg zb N/A yb zg N/A ry N/A N/A xb zg N/A xg zb N/A rz N/A N/A xg yb N/A xb yg N/A gx N/A N/A yb zr N/A yr zb N/A gy N/A N/A xr zb N/A xb zr N/A gz N/A N/A xb yr N/A xr yb N/A bx N/A N/A yr zg N/A yg zr N/A by N/A N/A xg zr N/A xr zg N/A bz N/A N/A xr yg N/A xg yr N/A rw N/A N/A N/A N/A rx xw N/A ry yw N/A rz zw yw N/A gw N/A N/A N/A N/A gx xw N/A gy yw N/A gz zw yw N/A bw N/A N/A N/A N/A bx xw N/A by yw N/A bz zw yw N/A rx N/A rx rw N/A ry N/A ry rw N/A rz N/A rz rw N/A gx N/A gx gw N/A gy N/A gy gw N/A gz N/A gz gw N/A bx N/A bx bw N/A by N/A by bw N/A bz N/A bz bw N/A r N/A N/A N/A rx xc N/A ry yc N/A rz zc N/A g N/A N/A N/A gx xc N/A gy yc N/A gz zc N/A b N/A N/A N/A bx xc N/A by yc N/A bz zc N/A N/A r g b N/A inside_gamut N/A N/A r g b N/A N/A N/A 
     Test whether a requested colour is within the gamut
     achievable with the primaries of the current colour
     system.  This amounts simply to testing whether all the
     primary weights are non-negative. */
     N/A N/A N/A r 0 N/A g 0 N/A b 0 N/A constrain_rgb N/A N/A r g b N/A N/A N/A 
    If the requested RGB shade contains a negative weight for
    one of the primaries, it lies outside the colour gamut
    accessible from the given triple of primaries.  Desaturate
    it by adding white, equal quantities of R, G, and B, enough
    to make RGB all positive.  The function returns 1 if the
    components were modified, zero otherwise.
     N/A w N/A N/A min N/A 0 r g b N/A N/A w 0 N/A N/A r w N/A g w N/A b w N/A N/A r g b N/A gamma_correct N/A N/A cs c N/A N/A N/A 
    Transform linear RGB values to nonlinear RGB values. Rec.
    709 is ITU-R Recommendation BT. 709 (1990) ``Basic
    Parameter Values for the HDTV Standard for the Studio and
    for International Programme Exchange'', formerly CCIR Rec.
    709. For details see

       http://www.poynton.com/ColorFAQ.html
       http://www.poynton.com/GammaFAQ.html
     N/A gamma N/A cs gamma N/A N/A gamma GAMMA_REC709 N/A N/A cc 0.018 N/A N/A c cc N/A N/A c N/A N/A N/A 1.099 N/A N/A math pow cc 0.45 0.099 cc N/A N/A c N/A N/A 1.099 N/A N/A math pow c 0.45 0.099 N/A N/A c N/A N/A math pow c N/A 1.0 gamma N/A c N/A gamma_correct_rgb N/A N/A cs r g b N/A N/A N/A r N/A gamma_correct cs r N/A g N/A gamma_correct cs g N/A b N/A gamma_correct cs b N/A N/A r g b N/A norm_rgb N/A N/A r g b N/A N/A N/A 
    Normalise RGB components so the most intense (unless all
    are zero) has a value of 1.
     N/A greatest N/A max N/A r g b N/A N/A greatest 0 N/A N/A r greatest N/A g greatest N/A b greatest N/A N/A r g b N/A spectrum_to_xyz N/A N/A spec_intens temp N/A N/A N/A 
    Calculate the CIE X, Y, and Z coordinates corresponding to
    a light source with spectral distribution given by  the
    function SPEC_INTENS, which is called with a series of
    wavelengths between 380 and 780 nm (the argument is
    expressed in meters), which returns emittance at  that
    wavelength in arbitrary units.  The chromaticity
    coordinates of the spectrum are returned in the x, y, and z
    arguments which respect the identity:

        x + y + z = 1.

    CIE colour matching functions xBar, yBar, and zBar for
    wavelengths from 380 through 780 nanometers, every 5
    nanometers.  For a wavelength lambda in this range::

        cie_colour_match[(lambda - 380) / 5][0] = xBar
        cie_colour_match[(lambda - 380) / 5][1] = yBar
        cie_colour_match[(lambda - 380) / 5][2] = zBar

    AH Note 2011: This next bit is kind of irrelevant on modern
    hardware. Unless you are desperate for speed.
    In which case don't use the Python version!

    To save memory, this table can be declared as floats
    rather than doubles; (IEEE) float has enough
    significant bits to represent the values. It's declared
    as a double here to avoid warnings about "conversion
    between floating-point types" from certain persnickety
    compilers.
     N/A cie_colour_match N/A N/A 0.0014 0.0 0.0065 N/A 0.0022 0.0001 0.0105 N/A 0.0042 0.0001 0.0201 N/A 0.0076 0.0002 0.0362 N/A 0.0143 0.0004 0.0679 N/A 0.0232 0.0006 0.1102 N/A 0.0435 0.0012 0.2074 N/A 0.0776 0.0022 0.3713 N/A 0.1344 0.004 0.6456 N/A 0.2148 0.0073 1.0391 N/A 0.2839 0.0116 1.3856 N/A 0.3285 0.0168 1.623 N/A 0.3483 0.023 1.7471 N/A 0.3481 0.0298 1.7826 N/A 0.3362 0.038 1.7721 N/A 0.3187 0.048 1.7441 N/A 0.2908 0.06 1.6692 N/A 0.2511 0.0739 1.5281 N/A 0.1954 0.091 1.2876 N/A 0.1421 0.1126 1.0419 N/A 0.0956 0.139 0.813 N/A 0.058 0.1693 0.6162 N/A 0.032 0.208 0.4652 N/A 0.0147 0.2586 0.3533 N/A 0.0049 0.323 0.272 N/A 0.0024 0.4073 0.2123 N/A 0.0093 0.503 0.1582 N/A 0.0291 0.6082 0.1117 N/A 0.0633 0.71 0.0782 N/A 0.1096 0.7932 0.0573 N/A 0.1655 0.862 0.0422 N/A 0.2257 0.9149 0.0298 N/A 0.2904 0.954 0.0203 N/A 0.3597 0.9803 0.0134 N/A 0.4334 0.995 0.0087 N/A 0.5121 1.0 0.0057 N/A 0.5945 0.995 0.0039 N/A 0.6784 0.9786 0.0027 N/A 0.7621 0.952 0.0021 N/A 0.8425 0.9154 0.0018 N/A 0.9163 0.87 0.0017 N/A 0.9786 0.8163 0.0014 N/A 1.0263 0.757 0.0011 N/A 1.0567 0.6949 0.001 N/A 1.0622 0.631 0.0008 N/A 1.0456 0.5668 0.0006 N/A 1.0026 0.503 0.0003 N/A 0.9384 0.4412 0.0002 N/A 0.8544 0.381 0.0002 N/A 0.7514 0.321 0.0001 N/A 0.6424 0.265 0.0 N/A 0.5419 0.217 0.0 N/A 0.4479 0.175 0.0 N/A 0.3608 0.1382 0.0 N/A 0.2835 0.107 0.0 N/A 0.2187 0.0816 0.0 N/A 0.1649 0.061 0.0 N/A 0.1212 0.0446 0.0 N/A 0.0874 0.032 0.0 N/A 0.0636 0.0232 0.0 N/A 0.0468 0.017 0.0 N/A 0.0329 0.0119 0.0 N/A 0.0227 0.0082 0.0 N/A 0.0158 0.0057 0.0 N/A 0.0114 0.0041 0.0 N/A 0.0081 0.0029 0.0 N/A 0.0058 0.0021 0.0 N/A 0.0041 0.0015 0.0 N/A 0.0029 0.001 0.0 N/A 0.002 0.0007 0.0 N/A 0.0014 0.0005 0.0 N/A 0.001 0.0004 0.0 N/A 0.0007 0.0002 0.0 N/A 0.0005 0.0002 0.0 N/A 0.0003 0.0001 0.0 N/A 0.0002 0.0001 0.0 N/A 0.0002 0.0001 0.0 N/A 0.0001 0.0 0.0 N/A 0.0001 0.0 0.0 N/A 0.0001 0.0 0.0 N/A 0.0 0.0 0.0 N/A X 0 N/A Y 0 N/A Z 0 N/A N/A i lamb N/A enumerate N/A range 380 780 5 N/A N/A Me N/A spec_intens lamb temp N/A X N/A Me N/A N/A cie_colour_match N/A i N/A 0 N/A Y N/A Me N/A N/A cie_colour_match N/A i N/A 1 N/A Z N/A Me N/A N/A cie_colour_match N/A i N/A 2 N/A XYZ N/A N/A X Y Z N/A x N/A X XYZ N/A y N/A Y XYZ N/A z N/A Z XYZ N/A N/A x y z N/A bb_spectrum N/A N/A wavelength bbTemp N/A 5000 N/A N/A 
    Calculate, by Planck's radiation law, the emittance of a black body
    of temperature bbTemp at the given wavelength (in metres).  */
     N/A wlm N/A wavelength 1e-09 N/A N/A N/A 3.74183e-16 N/A N/A math pow wlm -5.0 N/A N/A N/A math exp N/A 0.014388 N/A wlm bbTemp 1.0 N/A   Built-in test program which displays the x, y, and Z and RGB
    values for black body spectra from 1000 to 10000 degrees kelvin.
    When run, this program should produce the following output:

    Temperature       x      y      z       R     G     B
    -----------    ------ ------ ------   ----- ----- -----
       1000 K      0.6528 0.3444 0.0028   1.000 0.007 0.000 (Approximation)
       1500 K      0.5857 0.3931 0.0212   1.000 0.126 0.000 (Approximation)
       2000 K      0.5267 0.4133 0.0600   1.000 0.234 0.010
       2500 K      0.4770 0.4137 0.1093   1.000 0.349 0.067
       3000 K      0.4369 0.4041 0.1590   1.000 0.454 0.151
       3500 K      0.4053 0.3907 0.2040   1.000 0.549 0.254
       4000 K      0.3805 0.3768 0.2428   1.000 0.635 0.370
       4500 K      0.3608 0.3636 0.2756   1.000 0.710 0.493
       5000 K      0.3451 0.3516 0.3032   1.000 0.778 0.620
       5500 K      0.3325 0.3411 0.3265   1.000 0.837 0.746
       6000 K      0.3221 0.3318 0.3461   1.000 0.890 0.869
       6500 K      0.3135 0.3237 0.3628   1.000 0.937 0.988
       7000 K      0.3064 0.3166 0.3770   0.907 0.888 1.000
       7500 K      0.3004 0.3103 0.3893   0.827 0.839 1.000
       8000 K      0.2952 0.3048 0.4000   0.762 0.800 1.000
       8500 K      0.2908 0.3000 0.4093   0.711 0.766 1.000
       9000 K      0.2869 0.2956 0.4174   0.668 0.738 1.000
       9500 K      0.2836 0.2918 0.4246   0.632 0.714 1.000
      10000 K      0.2807 0.2884 0.4310   0.602 0.693 1.000
 N/A N/A N/A __name__ __main__ N/A N/A Temperature       x      y      z       R     G     B
 N/A -----------    ------ ------ ------   ----- ----- -----
 N/A t N/A range 1000 10000 500 N/A N/A N/A x y z N/A spectrum_to_xyz bb_spectrum t N/A N/A r g b N/A xyz_to_rgb SMPTEsystem x y z N/A N/A   %5.0f K      %.4f %.4f %.4f    N/A t x y z N/A N/A r g b N/A constrain_rgb r g b N/A N/A r g b N/A norm_rgb r g b N/A N/A %.3f %.3f %.3f N/A r g b