-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathSpectral.js
More file actions
560 lines (526 loc) · 51.1 KB
/
Copy pathSpectral.js
File metadata and controls
560 lines (526 loc) · 51.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
/*************************************************************************
* @license
*
*
* Copyright © 2019, 2024 Glenn Wilton
* O2 Creative Limited
* www.o2creative.co.nz
* support@o2creative.co.nz
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
*/
'use strict';
/* ============================================================================
* Spectral.js — spectral data and reflectance → XYZ/Lab integration
* ============================================================================
*
* This module is for working with COLOUR AS PHYSICS rather than colour as
* device numbers. If you are converting RGB → CMYK or applying an ICC
* profile, you don't need this file — use Profile / Transform instead.
*
* You DO need this file when you have:
*
* - A reflectance or transmittance spectrum from a spectrophotometer
* (i1Pro, X-Rite eXact, Konica Minolta CM-26d, Barbieri Spectro, ...).
* Most spectros report 36 or 31 reflectance values from 380-730 nm in
* 10 nm steps, or 81 values in 5 nm steps.
*
* - A spectral library (Pantone Live, ink/paint formulator output, NCS,
* Munsell book of color, the digitised IT8.7/4 / ECI2002 / TC1617 /
* GATCS targets used to build ICC profiles).
*
* - A simulated illuminant and you want to know what a sample would look
* like under different lights ("metamerism check" — does this print
* match under D50 daylight AND under F11 store fluorescent?).
*
*
* WHAT'S IN THIS FILE
* ----------------------------------------------------------------------------
*
* 1. Illuminants[] — the relative spectral power distribution (SPD) of
* a few CIE standard light sources:
* A Tungsten-filament, ~2856 K
* C Old "average daylight", ~6774 K (deprecated, kept for legacy targets)
* D50 ISO graphic-arts viewing, 5000 K (the default for ICC)
* D55 Mid-morning/afternoon, 5500 K
* D65 Noon daylight, 6504 K (the default for sRGB)
*
* Each is a curve S(λ) sampled at fixed nm steps, normalised so that
* the value at 560 nm ≈ 100. Add F-series (fluorescent) or LED SPDs
* here if you need them — same shape.
*
* 2. Observers[] — the CIE colour-matching functions x̄(λ), ȳ(λ), z̄(λ):
* 2° CIE 1931 standard observer (most colour work)
* 10° CIE 1964 standard observer (large-field work, paint, textiles)
*
* These describe how the human eye's three cone types respond to each
* wavelength. They turn an SPD into a tristimulus (X, Y, Z) value.
*
* 3. The Spectral class with helpers and the integration `calculateXYZ()`
* which turns reflectance + illuminant + observer into XYZ. The
* returned XYZ already carries the illuminant's whitePoint so passing
* it to convert.XYZ2Lab() (or piping it through a Transform) gives
* Lab measured under that illuminant.
*
*
* THE MATH (calculateXYZ)
* ----------------------------------------------------------------------------
*
* X = k · Σ S(λ) · R(λ) · x̄(λ)
* Y = k · Σ S(λ) · R(λ) · ȳ(λ)
* Z = k · Σ S(λ) · R(λ) · z̄(λ)
*
* k = 100 / Σ S(λ) · ȳ(λ)
*
* where S(λ) = illuminant SPD (Illuminants[].data)
* R(λ) = sample reflectance (your spectrum.data)
* x̄ ȳ z̄ = observer matching functions (Observers[].X/Y/Z)
*
* The Δλ that should appear inside each sum cancels in the ratio because
* the same step is used in numerator and denominator, so it is omitted from
* the loop. Wavelengths where the spectrum's grid doesn't line up with the
* illuminant's or observer's grid are linearly interpolated.
*
*
* TYPICAL USAGE
* ----------------------------------------------------------------------------
*
* var Spectral = require('jscolorengine').Spectral;
* var s = new Spectral();
*
* // 36 reflectance values from a spectro, 380-730 nm @ 10 nm
* var swatch = s.toSpectral(380, 730, [0.05, 0.04, 0.04, ...], 10);
*
* var d50 = s.getIlluminant('D50');
* var obs2 = s.getObserver('2');
*
* var xyz = s.calculateXYZ(swatch, d50, obs2); // {type, X, Y, Z, whitePoint}
* var lab = convert.XYZ2Lab(xyz); // Lab under D50/2°
*
* // Same swatch under D65/10° — for a metamerism check
* var labD65 = convert.XYZ2Lab(
* s.calculateXYZ(swatch, s.getIlluminant('D65'), s.getObserver('10'))
* );
* var dE = convert.deltaE76(lab, labD65); // how different they look
*
*
* PERFORMANCE NOTE
* ----------------------------------------------------------------------------
*
* This is an ACCURACY-PATH module (see Transform.js USAGE GUIDE for the
* same distinction). calculateXYZ is typically called once per spectro
* reading — tens to thousands of times in a profile build, NOT millions of
* times per image. The loop is straightforward and not micro-optimised;
* if you find yourself calling it per pixel, you are doing the wrong thing
* — pre-build a LUT instead.
*
*
* REFERENCES
* ----------------------------------------------------------------------------
*
* CIE 015:2018 Colorimetry, 4th edition (the canonical reference)
* ASTM E308 Standard practice for computing colors of objects
* Wikipedia: "CIE 1931 color space", "Standard illuminant", "Tristimulus values"
* Bruce Lindbloom: http://www.brucelindbloom.com/ (excellent practical tables)
* The Munsell Color Science Lab spectral data archives
*
* ============================================================================
*/
var convert = require('./convert');
/* ----------------------------------------------------------------------------
* Illuminants — CIE Standard Illuminant relative spectral power distributions
*
* Schema for each entry:
* name Short name used as a key in getIlluminant('D50') etc.
* description Human-readable note.
* isDefault (D50 only) flag for "use this if the caller didn't pick one".
* startnm First wavelength in `data`, in nanometres.
* endnm Last wavelength in `data`, in nanometres.
* step Nm spacing between consecutive `data` values.
* range Legacy scale denominator (~max(data)); not used by calculateXYZ.
* temp Correlated colour temperature in Kelvin.
* whitePoint Reference XYZ whitepoint object from convert.js. The XYZ
* returned by calculateXYZ() inherits this so downstream
* Lab conversion uses the matching whitepoint.
* data Relative SPD samples, normalised so data[wavelength=560nm] ≈ 100.
*
* Coverage and step size matter: an integration over 380-730 nm @ 5 nm is
* the de-facto industry standard (matches typical spectro output). Wider
* range / smaller step costs nothing per call here and improves accuracy at
* the edges of the visible band.
* ---------------------------------------------------------------------------- */
var Illuminants = [
{
name: 'A',
description: '# CIE standard Illuminant A, a typical tungsten-filament light with relative spectral power distribution of 2856K, at 1nm resolution',
startnm: 300,
endnm: 830,
step: 1,
range: 1000,
temp: 2856.1,
whitePoint: convert.a,
data: [
0.930483, 0.967643, 1.00597, 1.04549, 1.08623, 1.12821, 1.17147, 1.21602, 1.26188, 1.3091, 1.35769, 1.40768, 1.4591, 1.51198, 1.56633, 1.62219, 1.67959, 1.73855, 1.7991, 1.86127, 1.92508, 1.99057, 2.05776, 2.12667, 2.19734, 2.2698, 2.34406, 2.42017, 2.49814, 2.57801, 2.65981, 2.74355, 2.82928, 2.91701, 3.00678, 3.09861, 3.19253, 3.28857, 3.38676, 3.48712, 3.58968, 3.69447, 3.80152, 3.91085, 4.0225, 4.13648, 4.25282, 4.37156, 4.49272, 4.61631, 4.74238, 4.87095, 5.00204, 5.13568, 5.27189, 5.4107, 5.55213, 5.69622, 5.84298, 5.99244, 6.14462, 6.29955, 6.45724, 6.61774, 6.78105, 6.9472, 7.11621, 7.28811, 7.46292, 7.64066, 7.82135, 8.00501, 8.19167, 8.38134, 8.57404, 8.7698, 8.96864, 9.17056, 9.37561, 9.58378, 9.7951, 10.0096, 10.2273, 10.4481, 10.6722, 10.8996, 11.1302, 11.364, 11.6012, 11.8416, 12.0853, 12.3324, 12.5828, 12.8366, 13.0938, 13.3543, 13.6182, 13.8855, 14.1563, 14.4304, 14.708, 14.9891, 15.2736, 15.5616, 15.853, 16.148, 16.4464, 16.7484, 17.0538, 17.3628, 17.6753, 17.9913, 18.3108, 18.6339, 18.9605, 19.2907, 19.6244, 19.9617, 20.3026, 20.647, 20.995, 21.3465, 21.7016, 22.0603, 22.4225, 22.7883, 23.1577, 23.5307, 23.9072, 24.2873, 24.6709, 25.0581, 25.4489, 25.8432, 26.2411, 26.6425, 27.0475, 27.456, 27.8681, 28.2836, 28.7027, 29.1253, 29.5515, 29.9811, 30.4142, 30.8508, 31.2909, 31.7345, 32.1815, 32.632, 33.0859, 33.5432, 34.004, 34.4682, 34.9358, 35.4068, 35.8811, 36.3588, 36.8399, 37.3243, 37.8121, 38.3031, 38.7975, 39.2951, 39.796, 40.3002, 40.8076, 41.3182, 41.832, 42.3491, 42.8693, 43.3926, 43.9192, 44.4488, 44.9816, 45.5174, 46.0563, 46.5983, 47.1433, 47.6913, 48.2423, 48.7963, 49.3533, 49.9132, 50.476, 51.0418, 51.6104, 52.1818, 52.7561, 53.3332, 53.9132, 54.4958, 55.0813, 55.6694, 56.2603, 56.8539, 57.4501, 58.0489, 58.6504, 59.2545, 59.8611, 60.4703, 61.082, 61.6962, 62.3128, 62.932, 63.5535, 64.1775, 64.8038, 65.4325, 66.0635, 66.6968, 67.3324, 67.9702, 68.6102, 69.2525, 69.8969, 70.5435, 71.1922, 71.843, 72.4959, 73.1508, 73.8077, 74.4666, 75.1275, 75.7903, 76.4551, 77.1217, 77.7902, 78.4605, 79.1326, 79.8065, 80.4821, 81.1595, 81.8386, 82.5193, 83.2017, 83.8856, 84.5712, 85.2584, 85.947, 86.6372, 87.3288, 88.0219, 88.7165, 89.4124, 90.1097, 90.8083, 91.5082, 92.2095, 92.912, 93.6157, 94.3206, 95.0267, 95.7339, 96.4423, 97.1518, 97.8623, 98.5739, 99.2864, 100, 100.715, 101.43, 102.146, 102.864, 103.582, 104.301, 105.02, 105.741, 106.462, 107.184, 107.906, 108.63, 109.354, 110.078, 110.803, 111.529, 112.255, 112.982, 113.709, 114.436, 115.164, 115.893, 116.622, 117.351, 118.08, 118.81, 119.54, 120.27, 121.001, 121.731, 122.462, 123.193, 123.924, 124.655, 125.386, 126.118, 126.849, 127.58, 128.312, 129.043, 129.774, 130.505, 131.236, 131.966, 132.697, 133.427, 134.157, 134.887, 135.617, 136.346, 137.075, 137.804, 138.532, 139.26, 139.988, 140.715, 141.441, 142.167, 142.893, 143.618, 144.343, 145.067, 145.79, 146.513, 147.235, 147.957, 148.678, 149.398, 150.117, 150.836, 151.554, 152.271, 152.988, 153.704, 154.418, 155.132, 155.845, 156.558, 157.269, 157.979, 158.689, 159.397, 160.104, 160.811, 161.516, 162.221, 162.924, 163.626, 164.327, 165.028, 165.726, 166.424, 167.121, 167.816, 168.51, 169.203, 169.895, 170.586, 171.275, 171.963, 172.65, 173.335, 174.019, 174.702, 175.383, 176.063, 176.741, 177.419, 178.094, 178.769, 179.441, 180.113, 180.783, 181.451, 182.118, 182.783, 183.447, 184.109, 184.77, 185.429, 186.087, 186.743, 187.397, 188.05, 188.701, 189.35, 189.998, 190.644, 191.288, 191.931, 192.572, 193.211, 193.849, 194.484, 195.118, 195.75, 196.381, 197.009, 197.636, 198.261, 198.884, 199.506, 200.125, 200.743, 201.359, 201.972, 202.584, 203.195, 203.803, 204.409, 205.013, 205.616, 206.216, 206.815, 207.411, 208.006, 208.599, 209.189, 209.778, 210.365, 210.949, 211.532, 212.112, 212.691, 213.268, 213.842, 214.415, 214.985, 215.553, 216.12, 216.684, 217.246, 217.806, 218.364, 218.92, 219.473, 220.025, 220.574, 221.122, 221.667, 222.21, 222.751, 223.29, 223.826, 224.361, 224.893, 225.423, 225.951, 226.477, 227, 227.522, 228.041, 228.558, 229.073, 229.585, 230.096, 230.604, 231.11, 231.614, 232.115, 232.615, 233.112, 233.606, 234.099, 234.589, 235.078, 235.564, 236.047, 236.529, 237.008, 237.485, 237.959, 238.432, 238.902, 239.37, 239.836, 240.299, 240.76, 241.219, 241.675, 242.13, 242.582, 243.031, 243.479, 243.924, 244.367, 244.808, 245.246, 245.682, 246.116, 246.548, 246.977, 247.404, 247.829, 248.251, 248.671, 249.089, 249.505, 249.918, 250.329, 250.738, 251.144, 251.548, 251.95, 252.35, 252.747, 253.142, 253.535, 253.925, 254.314, 254.7, 255.083, 255.465, 255.844, 256.221, 256.595, 256.968, 257.338, 257.706, 258.071, 258.434, 258.795, 259.154, 259.511, 259.865, 260.217, 260.567, 260.914, 261.259, 261.602
]
},
{
name: 'C',
description: 'CIE deprecated standard Illuminant C, approximately 6774K, at 5nm resolution',
startnm: 380,
endnm: 780,
step: 5,
range: 1000,
temp: 6769.2,
whitePoint: convert.c,
data: [
33, 39.92, 47.4, 55.17, 63.3, 71.81, 80.6, 89.53, 98.1, 105.8, 112.4, 117.75, 121.5, 123.45, 124, 123.6, 123.1, 123.3, 123.8, 124.09, 123.9, 122.92, 120.7, 116.9, 112.1, 106.98, 102.3, 98.81, 96.9, 96.78, 98, 99.94, 102.1, 103.95, 105.2, 105.67, 105.3, 104.11, 102.3, 100.15, 97.8, 95.43, 93.2, 91.22, 89.7, 88.83, 88.4, 88.19, 88.1, 88.06, 88, 87.86, 87.8, 87.99, 88.2, 88.2, 87.9, 87.22, 86.3, 85.3, 84, 82.21, 80.2, 78.24, 76.3, 74.36, 72.4, 70.4, 68.3, 66.3, 64.4, 62.8, 61.5, 60.2, 59.2, 58.5, 58.1, 58, 58.2, 58.5, 59.1
]
},
{
name: 'D50',
description: 'CIE standard D50 illuminator, approximating light at the horizon at 5nm resolution',
isDefault: true,
startnm: 380,
endnm: 780,
step: 5,
range: 1000,
temp: 5000,
whitePoint: convert.d50,
data: [
24.5, 27.2, 29.8, 39.6, 49.3, 52.9, 56.5, 58.3, 60, 58.9, 57.8, 66.3, 74.8, 81, 87.2, 88.9, 90.6, 91, 91.4, 93.3, 95.2, 93.6, 92, 93.9, 95.7, 96.2, 96.6, 96.9, 97.1, 99.6, 102.1, 101.5, 100.8, 101.6, 102.3, 101.2, 100, 98.9, 97.7, 98.3, 98.9, 96.2, 93.5, 95.6, 97.7, 98.5, 99.3, 99.2, 99, 97.4, 95.7, 97.3, 98.8, 97.3, 95.7, 97, 98.2, 100.6, 103, 101.1, 99.1, 93.3, 87.4, 89.5, 91.6, 92.3, 92.9, 84.9, 76.8, 81.7, 86.6, 89.6, 92.6, 85.4, 78.2, 68, 57.7, 70.3, 82.9, 80.6, 78.3
]
},
{
name: 'D55',
description: 'CIE standard Illuminant D55, mid-morning/mid-afternoon daylight, at 5nm resolution',
startnm: 380,
endnm: 780,
step: 5,
range: 1000,
temp: 5500,
whitePoint: convert.d55,
data: [
32.58, 35.34, 38.09, 49.52, 60.95, 64.75, 68.55, 70.07, 71.58, 69.75, 67.91, 76.76, 85.61, 91.8, 97.99, 99.23, 100.46, 100.19, 99.91, 101.33, 102.74, 100.41, 98.08, 99.38, 100.68, 100.69, 100.7, 100.34, 99.99, 102.1, 104.21, 103.16, 102.1, 102.53, 102.97, 101.48, 100, 98.61, 97.22, 97.48, 97.75, 94.59, 91.43, 92.93, 94.42, 94.78, 95.14, 94.68, 94.22, 92.33, 90.45, 91.39, 92.33, 90.59, 88.85, 89.59, 90.32, 92.13, 93.95, 91.95, 89.96, 84.82, 79.68, 81.26, 82.84, 83.84, 84.84, 77.54, 70.24, 74.77, 79.3, 82.15, 84.99, 78.44, 71.88, 62.34, 52.79, 64.36, 75.93, 73.87, 71.82
]
},
{
name: 'D65',
description: 'CIE standard Illuminant D65, at 5nm resolution',
startnm: 300,
endnm: 830,
step: 5,
range: 1000,
temp: 6500,
whitePoint: convert.d65,
data: [
0.0341, 1.6643, 3.2945, 11.7652, 20.236, 28.6447, 37.0535, 38.5011, 39.9488, 42.4302, 44.9117, 45.775, 46.6383, 49.3637, 52.0891, 51.0323, 49.9755, 52.3118, 54.6482, 68.7015, 82.7549, 87.1204, 91.486, 92.4589, 93.4318, 90.057, 86.6823, 95.7736, 104.865, 110.936, 117.008, 117.41, 117.812, 116.336, 114.861, 115.392, 115.923, 112.367, 108.811, 109.082, 109.354, 108.578, 107.802, 106.296, 104.79, 106.239, 107.689, 106.047, 104.405, 104.225, 104.046, 102.023, 100, 98.1671, 96.3342, 96.0611, 95.788, 92.2368, 88.6856, 89.3459, 90.0062, 89.8026, 89.5991, 88.6489, 87.6987, 85.4936, 83.2886, 83.4939, 83.6992, 81.863, 80.0268, 80.1207, 80.2146, 81.2462, 82.2778, 80.281, 78.2842, 74.0027, 69.7213, 70.6652, 71.6091, 72.979, 74.349, 67.9765, 61.604, 65.7448, 69.8856, 72.4863, 75.087, 69.3398, 63.5927, 55.0054, 46.4182, 56.6118, 66.8054, 65.0941, 63.3828, 63.8434, 64.304, 61.8779, 59.4519, 55.7054, 51.959, 54.6998, 57.4406, 58.8765, 60.3125
]
}
];
/* ----------------------------------------------------------------------------
* Observers — CIE Standard Observer colour-matching functions x̄(λ), ȳ(λ), z̄(λ)
*
* The colour-matching functions describe how the eye's three cone responses
* combine to produce tristimulus (X, Y, Z) sensations for monochromatic
* light at wavelength λ. Multiplying an SPD by these and summing gives XYZ.
*
* Two standard observers are provided:
* '2' CIE 1931 2° — small visual field. The historical default and
* the right choice for most ICC / graphic-arts work,
* colour pickers, soft proofing, etc.
* '10' CIE 1964 10° — large visual field. Used in paint, textiles, and
* industrial colour matching where samples subtend
* a larger angle. CRF / ΔE numbers can differ
* noticeably from 2° on saturated reds and blues.
*
* Schema for each entry:
* name '2' or '10' (used as a key in getObserver('2') etc.)
* description Human-readable note.
* isDefault ('2' only) flag for "use this if the caller didn't pick one".
* startnm First wavelength in X/Y/Z, in nanometres.
* endnm Last wavelength in X/Y/Z, in nanometres.
* step Nm spacing between consecutive samples (1 nm here).
* range Legacy scale denominator (~max value); not used by calculateXYZ.
* X, Y, Z The three colour-matching curves x̄(λ), ȳ(λ), z̄(λ),
* each as an array of length (endnm - startnm) / step + 1.
*
* Note: Y(λ) (=ȳ) is by definition the photopic luminous efficiency
* function V(λ), so a sum of S(λ)·Y(λ) is proportional to luminance — that
* is why the k normaliser in calculateXYZ uses only Y.
* ---------------------------------------------------------------------------- */
var Observers = [
{
name: '2',
description: 'CIE 1931 standard 2° observer tristimulus response values',
isDefault: true,
startnm: 360,
endnm: 830,
step: 1,
range: 1000,
X: [
0.0001299,0.0001458,0.0001638,0.000184,0.0002067,0.0002321,0.0002607,0.0002931,0.0003294,0.0003699,0.0004149,0.0004642,0.000519,0.0005819,0.0006552,0.0007416,0.000845,0.0009645,0.0010949,0.0012312,0.001368,0.0015021,0.0016423,0.0018024,0.0019958,0.002236,0.0025354,0.0028926,0.0033008,0.0037532,0.004243,0.0047624,0.00533,0.0059787,0.0067411,0.00765,0.0087514,0.0100289,0.0114217,0.012869,0.01431,0.0157044,0.0171474,0.0187812,0.020748,0.02319,0.0262074,0.0297825,0.0338809,0.0384682,0.04351,0.0489956,0.0550226,0.0617188,0.069212,0.07763,0.0869581,0.0971767,0.1084063,0.1207672,0.13438,0.1493582,0.1653957,0.1819831,0.198611,0.21477,0.2301868,0.2448797,0.2587773,0.2718079,0.2839,0.2949438,0.3048965,0.3137873,0.3216454,0.3285,0.3343513,0.3392101,0.3431213,0.3461296,0.34828,0.3495999,0.3501474,0.350013,0.349287,0.34806,0.3463733,0.3442624,0.3418088,0.3390941,0.3362,0.3331977,0.3300411,0.3266357,0.3228868,0.3187,0.3140251,0.308884,0.3032904,0.2972579,0.2908,0.2839701,0.2767214,0.2689178,0.2604227,0.2511,0.2408475,0.2298512,0.2184072,0.2068115,0.19536,0.1842136,0.1733273,0.1626881,0.1522833,0.1421,0.1321786,0.1225696,0.1132752,0.1042979,0.09564,0.0872996,0.079308,0.0717178,0.064581,0.05795,0.0518621,0.0462815,0.0411509,0.0364128,0.03201,0.0279172,0.0241444,0.020687,0.0175404,0.0147,0.0121618,0.00992,0.0079672,0.0062963,0.0049,0.0037772,0.0029453,0.0024249,0.0022363,0.0024,0.0029255,0.0038366,0.0051748,0.0069821,0.0093,0.0121495,0.0155359,0.0194775,0.0239928,0.0291,0.0348149,0.0411202,0.047985,0.0553786,0.06327,0.071635,0.0804622,0.08974,0.0994565,0.1096,0.1201674,0.1311145,0.1423679,0.1538542,0.1655,0.1772571,0.18914,0.2011694,0.2133658,0.2257499,0.2383209,0.2510668,0.2639922,0.2771017,0.2904,0.3038912,0.3175726,0.3314384,0.3454828,0.3597,0.3740839,0.3886396,0.4033784,0.4183115,0.4334499,0.4487953,0.464336,0.480064,0.4959713,0.5120501,0.5282959,0.5446916,0.5612094,0.5778215,0.5945,0.6112209,0.6279758,0.6447602,0.6615697,0.6784,0.6952392,0.7120586,0.7288284,0.7455188,0.7621,0.7785432,0.7948256,0.8109264,0.8268248,0.8425,0.8579325,0.8730816,0.8878944,0.9023181,0.9163,0.9297995,0.9427984,0.9552776,0.9672179,0.9786,0.9893856,0.9995488,1.0090892,1.0180064,1.0263,1.0339827,1.040986,1.047188,1.0524667,1.0567,1.0597944,1.0617992,1.0628068,1.0629096,1.0622,1.0607352,1.0584436,1.0552244,1.0509768,1.0456,1.0390369,1.0313608,1.0226662,1.0130477,1.0026,0.9913675,0.9793314,0.9664916,0.9528479,0.9384,0.923194,0.907244,0.890502,0.87292,0.8544499,0.835084,0.814946,0.794186,0.772954,0.7514,0.7295836,0.7075888,0.6856022,0.6638104,0.6424,0.6215149,0.6011138,0.5811052,0.5613977,0.5419,0.5225995,0.5035464,0.4847436,0.4661939,0.4479,0.4298613,0.412098,0.394644,0.3775333,0.3608,0.3444563,0.3285168,0.3130192,0.2980011,0.2835,0.2695448,0.2561184,0.2431896,0.2307272,0.2187,0.2070971,0.1959232,0.1851708,0.1748323,0.1649,0.1553667,0.14623,0.13749,0.1291467,0.1212,0.1136397,0.106465,0.0996904,0.0933306,0.0874,0.081901,0.0768043,0.0720771,0.0676866,0.0636,0.0598069,0.0562822,0.052971,0.0498186,0.04677,0.0437841,0.0408754,0.0380726,0.0354046,0.0329,0.0305642,0.0283806,0.0263448,0.0244528,0.0227,0.0210843,0.0195999,0.0182373,0.0169872,0.01584,0.0147906,0.0138313,0.0129487,0.0121292,0.0113592,0.0106294,0.0099388,0.0092884,0.0086789,0.0081109,0.0075824,0.0070887,0.0066273,0.0061954,0.0057903,0.0054098,0.0050526,0.0047175,0.0044035,0.0041095,0.0038339,0.0035757,0.0033343,0.0031091,0.0028993,0.0027043,0.002523,0.0023542,0.0021966,0.0020492,0.001911,0.0017814,0.0016601,0.0015465,0.00144,0.00134,0.0012463,0.0011585,0.0010764,0.0009999,0.0009287,0.0008624,0.0008008,0.0007434,0.0006901,0.0006405,0.0005945,0.0005519,0.0005124,0.000476,0.0004425,0.0004115,0.000383,0.0003566,0.0003323,0.0003098,0.0002889,0.0002695,0.0002516,0.0002348,0.0002192,0.0002045,0.0001908,0.0001781,0.0001662,0.000155,0.0001446,0.0001349,0.0001259,0.0001174,0.0001096,0.0001022,9.539E-05,8.902E-05,8.308E-05,7.751E-05,7.231E-05,6.746E-05,6.293E-05,5.871E-05,5.477E-05,5.11E-05,4.768E-05,4.449E-05,4.151E-05,3.873E-05,3.614E-05,3.372E-05,3.146E-05,2.935E-05,2.738E-05,2.552E-05,2.379E-05,2.218E-05,2.067E-05,1.927E-05,1.797E-05,1.675E-05,1.562E-05,1.456E-05,1.357E-05,1.265E-05,1.18E-05,1.1E-05,1.025E-05,9.56E-06,8.912E-06,8.308E-06,7.746E-06,7.221E-06,6.732E-06,6.276E-06,5.851E-06,5.455E-06,5.086E-06,4.741E-06,4.42E-06,4.121E-06,3.842E-06,3.582E-06,3.339E-06,3.113E-06,2.902E-06,2.706E-06,2.523E-06,2.352E-06,2.192E-06,2.044E-06,1.905E-06,1.777E-06,1.656E-06,1.544E-06,1.439E-06,1.342E-06,1.251E-06
],
Y: [
3.917E-06,4.394E-06,4.93E-06,5.532E-06,6.208E-06,6.965E-06,7.813E-06,8.767E-06,9.84E-06,1.104E-05,1.239E-05,1.389E-05,1.556E-05,1.744E-05,1.958E-05,2.202E-05,2.484E-05,2.804E-05,3.153E-05,3.522E-05,0.000039,4.283E-05,4.691E-05,5.159E-05,5.718E-05,0.000064,7.234E-05,8.221E-05,9.351E-05,0.0001061,0.00012,0.000135,0.0001515,0.0001702,0.0001918,0.000217,0.0002469,0.0002812,0.0003185,0.0003573,0.000396,0.0004337,0.000473,0.0005179,0.0005722,0.00064,0.0007246,0.0008255,0.0009412,0.0010699,0.00121,0.0013621,0.0015308,0.0017204,0.0019353,0.00218,0.0024548,0.002764,0.0031178,0.0035264,0.004,0.0045462,0.0051593,0.0058293,0.0065462,0.0073,0.0080865,0.0089087,0.0097677,0.0106644,0.0116,0.0125732,0.0135827,0.0146297,0.0157151,0.01684,0.0180074,0.0192145,0.0204539,0.0217182,0.023,0.0242946,0.0256102,0.0269586,0.0283513,0.0298,0.0313108,0.0328837,0.0345211,0.0362257,0.038,0.0398467,0.041768,0.043766,0.0458427,0.048,0.0502437,0.052573,0.0549806,0.0574587,0.06,0.062602,0.0652775,0.0680421,0.0709111,0.0739,0.077016,0.0802664,0.0836668,0.0872328,0.09098,0.0949176,0.0990458,0.1033674,0.1078846,0.1126,0.117532,0.1226744,0.1279928,0.1334528,0.13902,0.1446764,0.1504693,0.1564619,0.1627177,0.1693,0.1762431,0.1835581,0.1912735,0.199418,0.20802,0.2171199,0.2267345,0.2368571,0.2474812,0.2586,0.2701849,0.2822939,0.2950505,0.308578,0.323,0.3384021,0.3546858,0.3716986,0.3892875,0.4073,0.4256299,0.4443096,0.4633944,0.4829395,0.503,0.5235693,0.544512,0.56569,0.5869653,0.6082,0.6293456,0.6503068,0.6708752,0.6908424,0.71,0.7281852,0.7454636,0.7619694,0.7778368,0.7932,0.8081104,0.8224962,0.8363068,0.8494916,0.862,0.8738108,0.8849624,0.8954936,0.9054432,0.9148501,0.9237348,0.9320924,0.9399226,0.9472252,0.954,0.9602561,0.9660074,0.9712606,0.9760225,0.9803,0.9840924,0.9874182,0.9903128,0.9928116,0.9949501,0.9967108,0.9980983,0.999112,0.9997482,1,0.9998567,0.9993046,0.9983255,0.9968987,0.995,0.9926005,0.9897426,0.9864444,0.9827241,0.9786,0.9740837,0.9691712,0.9638568,0.9581349,0.952,0.9454504,0.9384992,0.9311628,0.9234576,0.9154,0.9070064,0.8982772,0.8892048,0.8797816,0.87,0.8598613,0.849392,0.838622,0.8275813,0.8163,0.8047947,0.793082,0.781192,0.7691547,0.757,0.7447541,0.7324224,0.7200036,0.7074965,0.6949,0.6822192,0.6694716,0.6566744,0.6438448,0.631,0.6181555,0.6053144,0.5924756,0.5796379,0.5668,0.5539611,0.5411372,0.5283528,0.5156323,0.503,0.4904688,0.4780304,0.4656776,0.4534032,0.4412,0.42908,0.417036,0.405032,0.393032,0.381,0.3689184,0.3568272,0.3447768,0.3328176,0.321,0.3093381,0.2978504,0.2865936,0.2756245,0.265,0.2547632,0.2448896,0.2353344,0.2260528,0.217,0.2081616,0.1995488,0.1911552,0.1829744,0.175,0.1672235,0.1596464,0.1522776,0.1451259,0.1382,0.1315003,0.1250248,0.1187792,0.1127691,0.107,0.1014762,0.0961886,0.091123,0.0862649,0.0816,0.0771206,0.0728255,0.0687101,0.0647698,0.061,0.0573962,0.053955,0.0506738,0.0475497,0.04458,0.0417587,0.039085,0.0365638,0.0342005,0.032,0.0299626,0.0280766,0.0263294,0.0247081,0.0232,0.0218008,0.0205011,0.0192811,0.0181207,0.017,0.0159038,0.0148372,0.0138107,0.0128348,0.01192,0.0110683,0.0102734,0.0095333,0.0088462,0.00821,0.0076238,0.0070854,0.0065915,0.0061385,0.005723,0.0053431,0.0049958,0.0046764,0.0043801,0.004102,0.0038385,0.0035891,0.0033542,0.0031341,0.002929,0.0027381,0.0025599,0.0023932,0.0022373,0.002091,0.0019536,0.0018246,0.0017036,0.0015902,0.001484,0.0013845,0.0012913,0.0012041,0.0011227,0.001047,0.0009766,0.0009111,0.0008501,0.0007932,0.00074,0.0006901,0.0006433,0.0005995,0.0005585,0.00052,0.0004839,0.0004501,0.0004183,0.0003887,0.0003611,0.0003354,0.0003114,0.0002892,0.0002685,0.0002492,0.0002313,0.0002147,0.0001993,0.000185,0.0001719,0.0001598,0.0001486,0.0001383,0.0001288,0.00012,0.0001119,0.0001043,9.734E-05,9.085E-05,0.0000848,7.915E-05,7.386E-05,6.892E-05,6.43E-05,0.00006,5.598E-05,5.223E-05,4.872E-05,4.545E-05,0.0000424,3.956E-05,3.692E-05,3.445E-05,3.215E-05,0.00003,2.799E-05,2.611E-05,2.436E-05,2.272E-05,0.0000212,1.978E-05,1.845E-05,1.722E-05,1.606E-05,1.499E-05,1.399E-05,1.305E-05,1.218E-05,1.136E-05,0.0000106,9.886E-06,9.217E-06,8.592E-06,8.009E-06,7.466E-06,6.96E-06,6.488E-06,6.049E-06,5.639E-06,5.258E-06,4.902E-06,4.57E-06,4.26E-06,3.972E-06,3.703E-06,3.452E-06,3.218E-06,3E-06,2.797E-06,2.608E-06,2.431E-06,2.267E-06,2.113E-06,1.97E-06,1.837E-06,1.712E-06,1.596E-06,1.488E-06,1.387E-06,1.293E-06,1.206E-06,1.124E-06,1.048E-06,9.771E-07,9.109E-07,8.493E-07,7.917E-07,7.381E-07,6.881E-07,6.415E-07,5.981E-07,5.576E-07,5.198E-07,4.846E-07,4.518E-07
],
Z: [
0.0006061,0.0006809,0.0007651,0.00086,0.0009666,0.001086,0.0012206,0.0013727,0.0015436,0.0017343,0.001946,0.0021778,0.0024358,0.002732,0.0030781,0.003486,0.0039752,0.0045409,0.0051583,0.0058029,0.00645,0.0070832,0.0077455,0.0085012,0.0094145,0.01055,0.0119658,0.0136559,0.0155881,0.0177302,0.02005,0.0225114,0.0252029,0.0282797,0.031897,0.03621,0.0414377,0.0475037,0.0541199,0.060998,0.06785,0.0744863,0.0813616,0.0891536,0.0985405,0.1102,0.1246133,0.1417017,0.1613035,0.1832568,0.2074,0.2336921,0.2626114,0.2947746,0.3307985,0.3713,0.4162091,0.4654642,0.5196948,0.5795303,0.6456,0.7184838,0.7967133,0.8778459,0.959439,1.0390501,1.1153673,1.1884971,1.2581233,1.3239296,1.3856,1.4426352,1.4948035,1.5421903,1.5848807,1.62296,1.6564048,1.6852959,1.7098745,1.7303821,1.74706,1.7600446,1.7696233,1.7762637,1.7804334,1.7826,1.7829682,1.7816998,1.7791982,1.7758671,1.77211,1.7682589,1.764039,1.7589438,1.7524663,1.7441,1.7335595,1.7208581,1.7059369,1.6887372,1.6692,1.6475287,1.6234127,1.5960223,1.564528,1.5281,1.4861114,1.4395215,1.3898799,1.3387362,1.28764,1.2374223,1.1878243,1.1387611,1.090148,1.0419,0.9941976,0.9473473,0.9014531,0.8566193,0.8129501,0.7705173,0.7294448,0.6899136,0.6521049,0.6162,0.5823286,0.5504162,0.5203376,0.4919673,0.46518,0.4399246,0.4161836,0.3938822,0.3729459,0.3533,0.3348578,0.3175521,0.3013375,0.2861686,0.272,0.2588171,0.2464838,0.2347718,0.2234533,0.2123,0.2011692,0.1901196,0.1792254,0.1685608,0.1582,0.1481383,0.1383758,0.1289942,0.1200751,0.1117,0.1039048,0.0966675,0.0899827,0.0838453,0.07825,0.073209,0.0686782,0.0645678,0.0607884,0.05725,0.0539044,0.0507466,0.0477528,0.0448986,0.04216,0.0395073,0.0369356,0.0344584,0.0320887,0.02984,0.0277118,0.0256944,0.0237872,0.0219893,0.0203,0.0187181,0.0172404,0.0158636,0.0145846,0.0134,0.0123072,0.0113019,0.0103779,0.0095293,0.00875,0.0080352,0.0073816,0.0067854,0.0062428,0.00575,0.0053036,0.0048998,0.0045342,0.0042024,0.0039,0.0036232,0.0033706,0.0031414,0.0029348,0.00275,0.0025852,0.0024386,0.0023094,0.0021968,0.0021,0.0020177,0.0019482,0.0018898,0.0018409,0.0018,0.0017663,0.0017378,0.0017112,0.0016831,0.00165,0.0016101,0.0015644,0.0015136,0.0014585,0.0014,0.0013367,0.00127,0.001205,0.0011467,0.0011,0.0010688,0.0010494,0.0010356,0.0010212,0.001,0.0009686,0.0009299,0.0008869,0.0008426,0.0008,0.000761,0.0007237,0.0006859,0.0006454,0.0006,0.0005479,0.0004916,0.0004354,0.0003835,0.00034,0.0003073,0.0002832,0.0002654,0.0002518,0.00024,0.0002295,0.0002206,0.000212,0.0002022,0.00019,0.0001742,0.0001556,0.000136,0.0001169,0.0001,8.613E-05,0.0000746,0.000065,5.693E-05,5E-05,4.416E-05,3.948E-05,3.572E-05,3.264E-05,0.00003,2.765E-05,2.556E-05,2.364E-05,2.181E-05,0.00002,1.813E-05,0.0000162,0.0000142,1.213E-05,0.00001,7.733E-06,0.0000054,0.0000032,1.333E-06,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
]
},
{
name: '10',
description: 'CIE 1964 10° standard observer tristimulus response values',
startnm: 360,
endnm: 830,
step: 1,
range: 1000,
X: [
0.000000122,0.000000185,0.000000279,0.000000417,0.000000621,0.000000919,0.000001352,0.000001977,0.000002872,0.00000415,0.000005959,0.000008506,0.000012069,0.000017023,0.000023868,0.000033266,0.000046087,0.000063472,0.000086892,0.000118246,0.000159952,0.00021508,0.00028749,0.00038199,0.00050455,0.00066244,0.0008645,0.0011215,0.00144616,0.00185359,0.0023616,0.0029906,0.0037645,0.0047102,0.0058581,0.0072423,0.0088996,0.0108709,0.0131989,0.0159292,0.0191097,0.022788,0.027011,0.031829,0.037278,0.0434,0.050223,0.057764,0.066038,0.075033,0.084736,0.095041,0.105836,0.117066,0.128682,0.140638,0.152893,0.165416,0.178191,0.191214,0.204492,0.21765,0.230267,0.242311,0.253793,0.264737,0.275195,0.285301,0.295143,0.304869,0.314679,0.324355,0.33357,0.342243,0.350312,0.357719,0.364482,0.370493,0.375727,0.380158,0.383734,0.386327,0.387858,0.388396,0.387978,0.386726,0.384696,0.382006,0.378709,0.374915,0.370702,0.366089,0.361045,0.355518,0.349486,0.342957,0.335893,0.328284,0.32015,0.311475,0.302273,0.292858,0.283502,0.274044,0.264263,0.254085,0.243392,0.232187,0.220488,0.208198,0.195618,0.183034,0.170222,0.157348,0.14465,0.132349,0.120584,0.109456,0.099042,0.089388,0.080507,0.072034,0.06371,0.055694,0.048117,0.041072,0.034642,0.028896,0.023876,0.019628,0.016172,0.0133,0.010759,0.008542,0.006661,0.005132,0.003982,0.003239,0.002934,0.003114,0.003816,0.005095,0.006936,0.009299,0.012147,0.015444,0.019156,0.02325,0.02769,0.032444,0.037465,0.042956,0.049114,0.05592,0.063349,0.071358,0.079901,0.088909,0.098293,0.107949,0.117749,0.127839,0.13845,0.149516,0.161041,0.172953,0.185209,0.197755,0.210538,0.22346,0.236491,0.249633,0.262972,0.276515,0.290269,0.304213,0.318361,0.332705,0.347232,0.361926,0.376772,0.391683,0.406594,0.421539,0.436517,0.451584,0.466782,0.482147,0.497738,0.513606,0.529826,0.54644,0.563426,0.580726,0.59829,0.616053,0.633948,0.651901,0.669824,0.687632,0.705224,0.722773,0.740483,0.758273,0.776083,0.793832,0.811436,0.828822,0.845879,0.862525,0.878655,0.894208,0.909206,0.923672,0.937638,0.951162,0.964283,0.977068,0.98959,1.002,1.014,1.026,1.039,1.051,1.063,1.074,1.085,1.095,1.104,1.112,1.119,1.124,1.128,1.131,1.133,1.134,1.134,1.133,1.131,1.128,1.124,1.119,1.113,1.106,1.098,1.089,1.079,1.068,1.057,1.044,1.03,1.016,1.001,0.98479,0.96808,0.95074,0.9328,0.91434,0.89539,0.87603,0.856297,0.83635,0.81629,0.79605,0.77561,0.75493,0.73399,0.71278,0.69129,0.66952,0.647467,0.62511,0.60252,0.57989,0.55737,0.53511,0.51324,0.49186,0.47108,0.45096,0.431567,0.41287,0.39475,0.37721,0.36019,0.34369,0.32769,0.31217,0.29711,0.2825,0.268329,0.25459,0.2413,0.22848,0.21614,0.2043,0.19295,0.18211,0.17177,0.16192,0.152568,0.14367,0.1352,0.12713,0.11948,0.11221,0.10531,0.098786,0.09261,0.086773,0.0812606,0.076048,0.071114,0.066454,0.062062,0.05793,0.05405,0.050412,0.047006,0.043823,0.0408508,0.038072,0.035468,0.033031,0.030753,0.028623,0.026635,0.024781,0.023052,0.021441,0.0199413,0.018544,0.017241,0.016027,0.014896,0.013842,0.012862,0.011949,0.0111,0.010311,0.00957688,0.008894,0.0082581,0.0076664,0.0071163,0.0066052,0.0061306,0.0056903,0.0052819,0.0049033,0.00455263,0.0042275,0.0039258,0.0036457,0.0033859,0.0031447,0.0029208,0.002713,0.0025202,0.0023411,0.00217496,0.0020206,0.0018773,0.0017441,0.0016205,0.0015057,0.0013992,0.0013004,0.0012087,0.0011236,0.00104476,0.00097156,0.0009036,0.00084048,0.00078187,0.00072745,0.0006769,0.00062996,0.00058637,0.00054587,0.000508258,0.0004733,0.0004408,0.00041058,0.00038249,0.00035638,0.00033211,0.00030955,0.00028858,0.00026909,0.000250969,0.00023413,0.00021847,0.00020391,0.00019035,0.00017773,0.00016597,0.00015502,0.0001448,0.00013528,0.00012639,0.0001181,0.00011037,0.00010315,0.000096427,0.000090151,0.000084294,0.00007883,0.000073729,0.000068969,0.000064526,0.000060376,0.0000565,0.00005288,0.000049498,0.000046339,0.000043389,0.000040634,0.00003806,0.000035657,0.000033412,0.000031315,0.000029355,0.000027524,0.000025811,0.000024209,0.000022711,0.000021308,0.000019994,0.000018764,0.000017612,0.000016532,0.000015521,0.000014574,0.000013686,0.000012855,0.000012075,0.000011345,0.000010659,0.000010017,0.000009414,0.000008848,0.000008317,0.000007819,0.000007352,0.000006913,0.000006502,0.000006115,0.000005753,0.000005413,0.000005093,0.000004794,0.000004512,0.000004248,0.000004,0.000003767,0.000003548,0.000003342,0.000003148,0.000002966,0.000002795,0.000002634,0.000002483,0.000002341,0.000002208,0.000002082,0.000001964,0.000001852,0.000001746,0.000001647,0.000001553
],
Y: [
0.000000013,0.00000002,0.000000031,0.000000046,0.000000068,0.000000101,0.000000148,0.000000216,0.000000314,0.000000454,0.000000651,0.000000929,0.000001318,0.000001857,0.000002602,0.000003625,0.000005019,0.000006907,0.000009449,0.000012848,0.000017364,0.000023327,0.00003115,0.00004135,0.00005456,0.00007156,0.0000933,0.00012087,0.00015564,0.0001992,0.0002534,0.0003202,0.0004024,0.0005023,0.0006232,0.0007685,0.0009417,0.0011478,0.0013903,0.001674,0.0020044,0.002386,0.002822,0.003319,0.00388,0.004509,0.005209,0.005985,0.006833,0.007757,0.008756,0.009816,0.010918,0.012058,0.013237,0.014456,0.015717,0.017025,0.018399,0.019848,0.021391,0.022992,0.024598,0.026213,0.027841,0.029497,0.031195,0.032927,0.034738,0.036654,0.038676,0.040792,0.042946,0.045114,0.047333,0.049602,0.051934,0.054337,0.056822,0.059399,0.062077,0.064737,0.067285,0.069764,0.072218,0.074704,0.077272,0.079979,0.082874,0.086,0.089456,0.092947,0.096275,0.099535,0.102829,0.106256,0.109901,0.113835,0.118167,0.122932,0.128201,0.133457,0.138323,0.143042,0.147787,0.152761,0.158102,0.163941,0.170362,0.177425,0.18519,0.193025,0.200313,0.207156,0.213644,0.21994,0.22617,0.232467,0.239025,0.245997,0.253589,0.261876,0.270643,0.279645,0.288694,0.297665,0.306469,0.315035,0.323335,0.331366,0.339133,0.34786,0.358326,0.370001,0.382464,0.395379,0.408482,0.421588,0.434619,0.447601,0.460777,0.47434,0.4882,0.50234,0.51674,0.53136,0.54619,0.56118,0.57629,0.5915,0.606741,0.62215,0.63783,0.65371,0.66968,0.68566,0.70155,0.71723,0.73257,0.74746,0.761757,0.77534,0.78822,0.80046,0.81214,0.82333,0.83412,0.8446,0.85487,0.86504,0.875211,0.88537,0.89537,0.90515,0.91465,0.92381,0.93255,0.94081,0.94852,0.9556,0.961988,0.96754,0.97223,0.97617,0.97946,0.9822,0.98452,0.98652,0.98832,0.99002,0.991761,0.99353,0.99523,0.99677,0.99809,0.99911,0.99977,1,0.99971,0.99885,0.99734,0.99526,0.99274,0.98975,0.9863,0.98238,0.97798,0.97311,0.96774,0.96189,0.955552,0.948601,0.940981,0.932798,0.924158,0.915175,0.905954,0.896608,0.887249,0.877986,0.868934,0.860164,0.851519,0.842963,0.834393,0.825623,0.816764,0.807544,0.797947,0.787893,0.777405,0.76649,0.755309,0.743845,0.73219,0.720353,0.708281,0.696055,0.683621,0.671048,0.658341,0.645545,0.632718,0.619815,0.606887,0.593878,0.580781,0.567653,0.55449,0.541228,0.527963,0.514634,0.501363,0.488124,0.474935,0.461834,0.448823,0.435917,0.423153,0.410526,0.398057,0.385835,0.373951,0.362311,0.350863,0.339554,0.328309,0.317118,0.305936,0.294737,0.283493,0.272222,0.26099,0.249877,0.238946,0.228254,0.217853,0.20778,0.198072,0.188748,0.179828,0.171285,0.163059,0.155151,0.147535,0.140211,0.13317,0.1264,0.119892,0.11364,0.107633,0.10187,0.096347,0.091063,0.08601,0.081187,0.076583,0.072198,0.068024,0.064052,0.060281,0.056697,0.053292,0.050059,0.046998,0.044096,0.041345,0.0387507,0.0362978,0.0339832,0.0318004,0.0297395,0.0277918,0.0259551,0.0242263,0.0226017,0.0210779,0.0196505,0.0183153,0.0170686,0.0159051,0.0148183,0.0138008,0.0128495,0.0119607,0.0111303,0.0103555,0.0096332,0.0089599,0.0083324,0.0077488,0.0072046,0.0066975,0.0062251,0.005785,0.0053751,0.0049941,0.0046392,0.0043093,0.0040028,0.00371774,0.00345262,0.00320583,0.00297623,0.00276281,0.00256456,0.00238048,0.00220971,0.00205132,0.00190449,0.00176847,0.00164236,0.00152535,0.00141672,0.00131595,0.00122239,0.00113555,0.00105494,0.00098014,0.00091066,0.00084619,0.00078629,0.00073068,0.00067899,0.00063101,0.00058644,0.00054511,0.00050672,0.00047111,0.00043805,0.00040741,0.000378962,0.000352543,0.000328001,0.000305208,0.000284041,0.000264375,0.000246109,0.000229143,0.000213376,0.00019873,0.000185115,0.000172454,0.000160678,0.00014973,0.00013955,0.000130086,0.00012129,0.000113106,0.000105501,0.000098428,0.000091853,0.000085738,0.000080048,0.000074751,0.000069819,0.000065222,0.000060939,0.000056942,0.000053217,0.000049737,0.000046491,0.000043464,0.000040635,0.000038,0.00003554,0.000033245,0.000031101,0.000029099,0.000027231,0.000025486,0.000023856,0.000022333,0.00002091,0.000019581,0.000018338,0.000017178,0.000016093,0.00001508,0.000014134,0.000013249,0.000012423,0.00001165,0.000010928,0.000010252,0.00000962,0.000009028,0.000008474,0.000007955,0.000007469,0.000007013,0.000006586,0.000006186,0.000005811,0.000005459,0.00000513,0.000004821,0.000004531,0.000004259,0.000004004,0.000003765,0.00000354,0.000003329,0.000003131,0.000002945,0.000002771,0.000002607,0.000002453,0.000002309,0.000002173,0.000002046,0.000001927,0.000001814,0.000001709,0.00000161,0.000001517,0.000001429,0.000001347,0.000001269,0.000001197,0.000001128,0.000001064,0.000001003,0.000000946,0.000000893,0.000000842,0.000000795,0.00000075,0.000000707,0.000000667,0.00000063
],
Z: [
0.000000535,0.000000811,0.000001221,0.000001829,0.000002722,0.000004028,0.000005926,0.000008665,0.000012596,0.000018201,0.000026144,0.00003733,0.000052987,0.000074764,0.00010487,0.00014622,0.00020266,0.00027923,0.00038245,0.00052072,0.000704776,0.00094823,0.0012682,0.0016861,0.0022285,0.0029278,0.0038237,0.0049642,0.0064067,0.0082193,0.0104822,0.013289,0.016747,0.02098,0.026127,0.032344,0.039802,0.048691,0.05921,0.071576,0.0860109,0.10274,0.122,0.14402,0.16899,0.19712,0.22857,0.26347,0.3019,0.34387,0.389366,0.43797,0.48922,0.5429,0.59881,0.65676,0.71658,0.77812,0.84131,0.90611,0.972542,1.039,1.103,1.165,1.225,1.282,1.338,1.393,1.446,1.499,1.553,1.607,1.659,1.708,1.755,1.798,1.839,1.877,1.91,1.941,1.967,1.989,2.006,2.017,2.024,2.027,2.026,2.022,2.015,2.006,1.995,1.981,1.965,1.946,1.925,1.901,1.874,1.845,1.814,1.781,1.745,1.709,1.672,1.635,1.596,1.555,1.512,1.467,1.42,1.37,1.318,1.262,1.205,1.147,1.088,1.03,0.97383,0.91943,0.86746,0.81828,0.772125,0.72829,0.68604,0.64553,0.60685,0.57006,0.53522,0.50234,0.4714,0.44239,0.415254,0.390024,0.366399,0.344015,0.322689,0.302356,0.283036,0.264816,0.247848,0.232318,0.218502,0.205851,0.193596,0.181736,0.170281,0.159249,0.148673,0.138609,0.129096,0.120215,0.112044,0.10471,0.098196,0.092361,0.087088,0.082248,0.077744,0.073456,0.069268,0.06506,0.060709,0.056457,0.052609,0.049122,0.045954,0.04305,0.040368,0.037839,0.035384,0.032949,0.030451,0.028029,0.025862,0.02392,0.022174,0.020584,0.019127,0.01774,0.016403,0.015064,0.013676,0.012308,0.011056,0.009915,0.008872,0.007918,0.00703,0.006223,0.005453,0.004714,0.003988,0.003289,0.002646,0.002063,0.001533,0.001091,0.000711,0.000407,0.000184,0.000047,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
]
}
];
/**
* @typedef {object} _SpectralData
* @property {number} startnm First wavelength in `data`, in nm.
* @property {number} endnm Last wavelength in `data`, in nm.
* @property {number} step Spacing between consecutive `data` values, in nm.
* @property {number[]} data Reflectance / transmittance / SPD samples.
* For reflectance/transmittance these are typically
* 0.0 - 1.0 (or 0 - 100 if you stay consistent —
* the k normaliser cancels the unit out).
*/
/**
* Spectral data wrangler and reflectance → XYZ integrator.
*
* See the file-top primer for what spectral data is, what the bundled
* illuminants/observers represent, and the math that calculateXYZ() runs.
*
* Stateless — instances are cheap, you can keep one around for the lifetime
* of the app or new one per call. The Illuminants and Observers tables are
* module-level and shared.
*
* @example
* var s = new Spectral();
* var spectrum = s.toSpectral(380, 730, reflArr, 10);
* var xyz = s.calculateXYZ(spectrum, s.getIlluminant('D50'), s.getObserver('2'));
*/
class Spectral {
constructor() {
this.version = '0.0.1';
this.name = 'Spectral';
this.description = 'Spectral data and calculations';
}
/**
* @returns {object[]} The full Illuminants[] table — useful for building
* a UI dropdown of available light sources. Treat as
* read-only (callers share the same array reference).
*/
getIlluminants = function () {
return Illuminants;
};
/**
* Look up an illuminant by short name.
* @param {string} name 'A' | 'C' | 'D50' | 'D55' | 'D65'.
* Case-sensitive — names are uppercase.
* @returns {object|false} The illuminant entry, or false if not found.
* To add F-series / LED illuminants, extend the
* module-level Illuminants[] array using the
* schema documented above the array.
*/
getIlluminant = function (name) {
for (var i = 0; i < Illuminants.length; i++) {
if (name === Illuminants[i].name) {
return Illuminants[i];
}
}
return false;
};
/**
* @returns {object[]} The full Observers[] table — useful for building
* a UI dropdown of "2°" vs "10°". Treat as read-only.
*/
getObservers = function () {
return Observers;
};
/**
* Look up an observer by short name.
* @param {string} name '2' (CIE 1931, 2°) or
* '10' (CIE 1964, 10°).
* @returns {object|false} The observer entry, or false if not found.
*/
getObserver = function (name) {
for (var i = 0; i < Observers.length; i++) {
if (name === Observers[i].name) {
return Observers[i];
}
}
return false;
};
/**
* Wrap a raw reflectance / transmittance / SPD array in the shape that
* calculateXYZ() expects.
*
* If `nmStep` is omitted it is computed from the start/end and array
* length — but see the TODO below; pass it explicitly to be safe.
*
* Use this for spectrophotometer output. Common spectro grids:
* 380 - 730 nm @ 10 nm (36 values) — i1 Pro classic / many older instruments
* 380 - 780 nm @ 10 nm (41 values) — i1 Pro 2 / 3
* 380 - 730 nm @ 5 nm (71 values) — high-resolution mode
* 400 - 700 nm @ 10 nm (31 values) — ASTM E308 truncated range
*
* The `data` units don't matter (reflectance can be 0-1 or 0-100) — the
* k normaliser inside calculateXYZ scales the result so that a perfect
* diffuser (R(λ) = 1 everywhere) returns Y = 100 under any illuminant.
*
* TODO (bug): nmStep auto-derivation has a sign error — the formula
* should be `(endnm - startnm) / (data.length - 1)`, not the reverse.
* As written it returns a negative step. Workaround: always pass
* `nmStep` explicitly. Fix when next touching the file.
*
* @param {number} startnm First wavelength sample, in nm.
* @param {number} endnm Last wavelength sample, in nm.
* @param {number[]} data Sample values at startnm, startnm+step, ...
* @param {number} [nmStep] Spacing in nm. Recommended.
* @returns {_SpectralData}
*/
toSpectral = function (startnm, endnm, data, nmStep) {
if (!nmStep) {
nmStep = (startnm - endnm) / (data.length - 1);
}
return {
startnm: startnm,
endnm: endnm,
step: nmStep,
data: data
}
};
/**
* Integrate a spectrum against an illuminant SPD and an observer's
* colour-matching functions to produce CIE XYZ tristimulus values.
*
* This is the heart of the module. It implements the standard CIE
* tristimulus integration:
*
* X = k · Σ S(λ) · R(λ) · x̄(λ)
* Y = k · Σ S(λ) · R(λ) · ȳ(λ)
* Z = k · Σ S(λ) · R(λ) · z̄(λ)
* k = 100 / Σ S(λ) · ȳ(λ)
*
* The integration is driven by `spectrum`'s wavelength grid. For each
* sample wavelength, the illuminant and observer are linearly
* interpolated when they don't land exactly on their own grids — so it
* is fine to mix a 10-nm spectrum with a 1-nm observer or a 5-nm
* illuminant. Out-of-range wavelengths are clamped to whichever input
* has the narrower coverage (so e.g. integrating against Illuminant C,
* which only covers 380-780 nm, won't reach into 300 nm UV even if your
* spectrum does).
*
* The returned XYZ object inherits the illuminant's whitePoint, so:
*
* var xyz = spectral.calculateXYZ(spectrum, D50, obs2);
* var lab = convert.XYZ2Lab(xyz); // Lab values measured under D50
*
* var xyzD65 = spectral.calculateXYZ(spectrum, D65, obs2);
* var labD65 = convert.XYZ2Lab(xyzD65);
*
* Calling with two different illuminants and comparing the resulting Lab
* pairs is the basis of metamerism / illuminant-mismatch checks.
*
* Performance: this is the accuracy path — designed to be called once
* per measurement, not per pixel. A profile build with a TC1617 chart
* runs ~1617 calculateXYZ() per illuminant per intent, which is plenty
* fast. If you need per-pixel spectral rendering, build a LUT.
*
* @param {_SpectralData} spectrum Reflectance / transmittance spectrum
* from a spectro or library.
* @param {object} illuminant Entry from getIlluminant() / Illuminants[].
* @param {object} observer Entry from getObserver() / Observers[].
* @returns {_cmsXYZ} XYZ object {type, X, Y, Z, whitePoint} where Y is
* normalised so a perfect diffuser yields Y = 100.
* The whitePoint matches `illuminant.whitePoint` so
* downstream Lab conversion is illuminant-correct.
*/
calculateXYZ = function (spectrum, illuminant, observer) {
// calculate based on spectrum
var spectralStart = spectrum.startnm;
var spectralEnd = spectrum.endnm;
var sIndexStart, sIndexEnd, sCount, index, frac;
var sumX = 0, sumY = 0, sumZ = 0, sumK = 0;
var sy, Xk, Yk, Zk, k, X, Y, Z;
var oX, oY, oZ, ilum;
// Check ranges
if (spectralStart < illuminant.startnm) {
spectralStart = illuminant.startnm;
}
if (spectralStart < observer.startnm) {
spectralStart = observer.startnm;
}
if (spectralEnd > illuminant.endnm) {
spectralEnd = illuminant.endnm
}
if (spectralEnd > observer.endnm) {
spectralEnd = observer.endnm
}
sCount = (spectralEnd - spectralStart) / spectrum.step;
sIndexStart = (spectralStart - spectrum.startnm) / spectrum.step;
sIndexEnd = sIndexStart + sCount;
var wavelength = spectralStart;
for (var i = sIndexStart; i <= sIndexEnd; i++) {
// calc observer index
var oi = (wavelength - observer.startnm) / observer.step;
if (oi % 1 !== 0) {
// interpolate
index = Math.floor(oi);
frac = oi - index;
oX = (observer.X[index] * (1 - frac)) + (observer.X[index + 1] * frac);
oY = (observer.Y[index] * (1 - frac)) + (observer.Y[index + 1] * frac);
oZ = (observer.Z[index] * (1 - frac)) + (observer.Z[index + 1] * frac);
} else {
oX = observer.X[oi];
oY = observer.Y[oi];
oZ = observer.Z[oi];
}
// calc illuminant data index
var ii = (wavelength - illuminant.startnm) / illuminant.step;
if (ii % 1 !== 0) {
// interpolate
index = Math.floor(ii);
frac = ii - index;
ilum = (illuminant.data[index] * (1 - frac)) + (illuminant.data[index + 1] * frac);
} else {
ilum = illuminant.data[ii];
}
sy = ilum * oY;
Xk = oX * ilum * spectrum.data[i];
Yk = oY * ilum * spectrum.data[i];
Zk = oZ * ilum * spectrum.data[i];
sumX += Xk;
sumY += Yk;
sumZ += Zk;
sumK += sy;
wavelength += spectrum.step;
}
k = 100 / sumK; // normalise range 0.0 - 1.0
X = sumX * k / 100; // Normalizing Constant
Y = sumY * k / 100;
Z = sumZ * k / 100;
// var chromaticity = {x:0, y:0,z:0};
// if(x + y + z !== 0){
// chromaticity.x = x / (x + y + z);
// chromaticity.y = y / (x + y + z);
// chromaticity.z = z / (x + y + z);
// }
return convert.XYZ(X, Y, Z, illuminant.whitePoint);
}
}
module.exports = Spectral;