Skip to content

Spectral Dataset Authoring

Thomas Mansencal edited this page Jun 27, 2017 · 1 revision

Interpolation

What follows are recommendations from CIE 167:2005:

Uniformly Spaced Independent Variable

image

Non-Uniformly Spaced Independent Variable

image

Extrapolation

image

Implementation

Colour implements the necessary algorithms for that. Taking the Sigma SD1 data Colour ships as an example, performing the necessary shape alignement is done as follows (Sprague (1880) interpolation + constant extrapolation here):

import numpy as np
from pprint import pprint

import colour

np.set_printoptions(formatter={'float': '{:0.13f}'.format})

s = colour.CAMERAS_RGB_SPECTRAL_SENSITIVITIES['Sigma SDMerill (NPL)'].clone()
s.align(colour.SpectralShape(380, 780, 5))

pprint(list(s.__iter__()))

Which yields the following output:

[(380.0, array([0.0056210744061, 0.0063280975126, 0.1621594241331])),
 (385.0, array([0.0056210744061, 0.0063280975126, 0.1621594241331])),
 (390.0, array([0.0056210744061, 0.0063280975126, 0.1621594241331])),
 (395.0, array([0.0056210744061, 0.0063280975126, 0.1621594241331])),
 (400.0, array([0.0056210744061, 0.0063280975126, 0.1621594241331])),
 (405.0, array([-0.0032700368303, 0.0078442533301, 0.2250353173349])),
 (410.0, array([0.0065033562451, 0.0097618045959, 0.2854983780463])),
 (415.0, array([0.0442283819610, 0.0131806655017, 0.3420658516161])),
 (420.0, array([0.0740791128914, 0.0252717700826, 0.3969043106090])),
 (425.0, array([0.0648965887945, 0.0511196177435, 0.4523066568906])),
 (430.0, array([0.0430229594629, 0.0837511858531, 0.5083102431718])),
 (435.0, array([0.0365119103882, 0.1177841176125, 0.5660109443506])),
 (440.0, array([0.0345095256225, 0.1437038197436, 0.6221184724695])),
 (445.0, array([0.0277755773805, 0.1499994509449, 0.6705963584656])),
 (450.0, array([0.0188915672343, 0.1836116893088, 0.7374213624577])),
 (455.0, array([0.0087091842944, 0.2908959273186, 0.8487572445276])),
 (460.0, array([0.0073110769968, 0.4090947800995, 0.9453803667014])),
 (465.0, array([0.0255319264136, 0.4749186195486, 0.9681955435635])),
 (470.0, array([0.0454991512310, 0.5159556408618, 0.9644149477028])),
 (475.0, array([0.0482549214709, 0.5601470746419, 0.9825808584722])),
 (480.0, array([0.0567675292111, 0.6012066466271, 1.0000000000000])),
 (485.0, array([0.0939903669557, 0.6358346290067, 0.9958859733900])),
 (490.0, array([0.1341959206592, 0.6703167998014, 0.9859802118845])),
 (495.0, array([0.1525425415604, 0.7092286996166, 0.9839327960640])),
 (500.0, array([0.1647526899784, 0.7525874715348, 0.9834026635753])),
 (505.0, array([0.1854871971303, 0.7997156914408, 0.9782595610813])),
 (510.0, array([0.2171264197864, 0.8438138436894, 0.9696921956707])),
 (515.0, array([0.2633216096660, 0.8785396570588, 0.9589265516683])),
 (520.0, array([0.3064834383582, 0.9015172455881, 0.9428081740208])),
 (525.0, array([0.3271741563823, 0.9102517532524, 0.9184303066263])),
 (530.0, array([0.3498457961489, 0.9197503066877, 0.8966427991807])),
 (535.0, array([0.3997744611751, 0.9456251404787, 0.8879120041536])),
 (540.0, array([0.4437425813326, 0.9679942905216, 0.8844459022004])),
 (545.0, array([0.4493050712078, 0.9672868230961, 0.8785909874648])),
 (550.0, array([0.4448886052813, 0.9572523106404, 0.8679189907160])),
 (555.0, array([0.4592810217596, 0.9510358717196, 0.8493389158543])),
 (560.0, array([0.4789757567470, 0.9520479186005, 0.8337567958491])),
 (565.0, array([0.4909632258899, 0.9644813612734, 0.8326564021678])),
 (570.0, array([0.5095029148107, 0.9762801445840, 0.8320414024057])),
 (575.0, array([0.5467826345353, 0.9738631672683, 0.8175566893965])),
 (580.0, array([0.5926290937853, 0.9725862438896, 0.8005495638478])),
 (585.0, array([0.6382726163130, 0.9881375121443, 0.7919209358203])),
 (590.0, array([0.6738332756070, 1.0000000000000, 0.7828951247465])),
 (595.0, array([0.6878419872290, 0.9881898311277, 0.7656981723603])),
 (600.0, array([0.7140377148811, 0.9694845275778, 0.7394695300719])),
 (605.0, array([0.7874464018679, 0.9607253897964, 0.7037118594951])),
 (610.0, array([0.8600076131150, 0.9544131912485, 0.6671864017499])),
 (615.0, array([0.8823124202958, 0.9431240656721, 0.6382091164523])),
 (620.0, array([0.8981030284957, 0.9333543589092, 0.6204362780682])),
 (625.0, array([0.9501811624820, 0.9299677091611, 0.6167230389669])),
 (630.0, array([1.0000000000000, 0.9257140683364, 0.6111608787696])),
 (635.0, array([1.0034835332372, 0.9081891683204, 0.5840987018028])),
 (640.0, array([0.9949421331125, 0.8848643954150, 0.5517355619571])),
 (645.0, array([1.0177594613772, 0.8716170685359, 0.5357897232403])),
 (650.0, array([0.9208512773614, 0.7616518474162, 0.4653883174452])),
 (655.0, array([0.5598719814695, 0.4526713639944, 0.2726189404614])),
 (660.0, array([0.1814331163143, 0.1405243705715, 0.0796190783672])),
 (665.0, array([0.0238842174801, 0.0145743920235, 0.0039086825328])),
 (670.0, array([0.0063097879537, 0.0041436721582, 0.0005924444611])),
 (675.0, array([0.0048726008643, 0.0034135547051, 0.0030414341659])),
 (680.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048])),
 (685.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048])),
 (690.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048])),
 (695.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048])),
 (700.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048])),
 (705.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048])),
 (710.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048])),
 (715.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048])),
 (720.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048])),
 (725.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048])),
 (730.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048])),
 (735.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048])),
 (740.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048])),
 (745.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048])),
 (750.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048])),
 (755.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048])),
 (760.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048])),
 (765.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048])),
 (770.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048])),
 (775.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048])),
 (780.0, array([0.0052887438317, 0.0018319895817, 0.0046856368048]))]

Retrieving the values should be even simpler, by calling colour.TriSpectralPowerDistribution.items method on latest develop branch.

References

  • CIE TC 1-38. (2005). CIE 167:2005 Recommended Practice for Tabulating Spectral Data for Use in Colour Computations. ISBN:978-3-901-90641-1