Processing math: 100%

colour.temperature.cct Module

Correlated Colour Temperature Tcp

Defines correlated colour temperature Tcp computations objects:

  • uv_to_CCT_ohno2013(): Correlated colour temperature Tcp and Δuv computation of given CIE UCS colourspace uv chromaticity coordinates using Yoshi Ohno (2013) method.
  • CCT_to_uv_ohno2013(): CIE UCS colourspace uv chromaticity coordinates computation of given correlated colour temperature Tcp, Δuv using Yoshi Ohno (2013) method.
  • uv_to_CCT_robertson1968(): Correlated colour temperature Tcp and Δuv computation of given CIE UCS colourspace uv chromaticity coordinates using Robertson (1968) method.
  • CCT_to_uv_robertson1968(): CIE UCS colourspace uv chromaticity coordinates computation of given correlated colour temperature Tcp and Δuv using Robertson (1968) method.
  • xy_to_CCT_mccamy1992(): Correlated colour temperature Tcp computation of given CIE XYZ colourspace xy chromaticity coordinates using McCamy (1992) method.
  • xy_to_CCT_hernandez1999(): Correlated colour temperature Tcp computation of given CIE XYZ colourspace xy chromaticity coordinates using Hernandez-Andres, Lee & Romero (1999) method.
  • CCT_to_xy_kang2002(): CIE XYZ colourspace xy chromaticity coordinates computation of given correlated colour temperature Tcp using Kang, Moon, Hong, Lee, Cho and Kim (2002) method.
  • CCT_to_xy_illuminant_D(): CIE XYZ colourspace xy chromaticity coordinates computation of CIE Illuminant D Series from given correlated colour temperature Tcp of that CIE Illuminant D Series.

References

[1]http://en.wikipedia.org/wiki/Color_temperature
colour.temperature.cct.PLANCKIAN_TABLE_TUVD

alias of PlanckianTable_Tuvdi

colour.temperature.cct.ROBERTSON_ISOTEMPERATURE_LINES_DATA = ((0, 0.18006, 0.26352, -0.24341), (10, 0.18066, 0.26589, -0.25479), (20, 0.18133, 0.26846, -0.26876), (30, 0.18208, 0.27119, -0.28539), (40, 0.18293, 0.27407, -0.3047), (50, 0.18388, 0.27709, -0.32675), (60, 0.18494, 0.28021, -0.35156), (70, 0.18611, 0.28342, -0.37915), (80, 0.1874, 0.28668, -0.40955), (90, 0.1888, 0.28997, -0.44278), (100, 0.19032, 0.29326, -0.47888), (125, 0.19462, 0.30141, -0.58204), (150, 0.19962, 0.30921, -0.70471), (175, 0.20525, 0.31647, -0.84901), (200, 0.21142, 0.32312, -1.0182), (225, 0.21807, 0.32909, -1.2168), (250, 0.22511, 0.33439, -1.4512), (275, 0.23247, 0.33904, -1.7298), (300, 0.2401, 0.34308, -2.0637), (325, 0.24792, 0.34655, -2.4681), (350, 0.25591, 0.34951, -2.9641), (375, 0.264, 0.352, -3.5814), (400, 0.27218, 0.35407, -4.3633), (425, 0.28039, 0.35577, -5.3762), (450, 0.28863, 0.35714, -6.7262), (475, 0.29685, 0.35823, -8.5955), (500, 0.30505, 0.35907, -11.324), (525, 0.3132, 0.35968, -15.628), (550, 0.32129, 0.36011, -23.325), (575, 0.32931, 0.36038, -40.77), (600, 0.33724, 0.36051, -116.45))

Robertson iso-temperature lines.

ROBERTSON_ISOTEMPERATURE_LINES_DATA : tuple
(Reciprocal Megakelvin, CIE 1960 Chromaticity Coordinate u, CIE 1960 Chromaticity Coordinate v, Slope)

Notes

  • A correction has been done by Bruce Lindbloom for 325 Megakelvin temperature: 0.24702 —> 0.24792

References

[2]Wyszecki & Stiles, Color Science - Concepts and Methods Data and Formulae - Second Edition, Wiley Classics Library Edition, published 2000, ISBN-10: 0-471-39918-3, page 228.
colour.temperature.cct.ROBERTSON_ISOTEMPERATURE_LINES_RUVT

alias of WyszeckiRobertson_ruvt

colour.temperature.cct.planckian_table(uv, cmfs, start, end, count)[source]

Returns a planckian table from given CIE UCS colourspace uv chromaticity coordinates, colour matching functions and temperature range using Yoshi Ohno (2013) method.

Parameters:
  • uv (array_like) – uv chromaticity coordinates.
  • cmfs (XYZ_ColourMatchingFunctions) – Standard observer colour matching functions.
  • start (numeric) – Temperature range start in kelvins.
  • end (numeric) – Temperature range end in kelvins.
  • count (int) – Temperatures count in the planckian table.
Returns:

Planckian table.

Return type:

list

Examples

>>> from colour import STANDARD_OBSERVERS_CMFS
>>> from pprint import pprint
>>> cmfs = 'CIE 1931 2 Degree Standard Observer'
>>> cmfs = STANDARD_OBSERVERS_CMFS.get(cmfs)
>>> pprint(planckian_table((0.1978, 0.3122), cmfs, 1000, 1010, 10))    
[PlanckianTable_Tuvdi(Ti=1000.0, ui=0.4480108..., vi=0.3546249..., di=0.2537821...),
 PlanckianTable_Tuvdi(Ti=1001.1111111..., ui=0.4477508..., vi=0.3546475..., di=0.2535294...),
 PlanckianTable_Tuvdi(Ti=1002.2222222..., ui=0.4474910..., vi=0.3546700..., di=0.2532771...),
 PlanckianTable_Tuvdi(Ti=1003.3333333..., ui=0.4472316..., vi=0.3546924..., di=0.2530251...),
 PlanckianTable_Tuvdi(Ti=1004.4444444..., ui=0.4469724..., vi=0.3547148..., di=0.2527734...),
 PlanckianTable_Tuvdi(Ti=1005.5555555..., ui=0.4467136..., vi=0.3547372..., di=0.2525220...),
 PlanckianTable_Tuvdi(Ti=1006.6666666..., ui=0.4464550..., vi=0.3547595..., di=0.2522710...),
 PlanckianTable_Tuvdi(Ti=1007.7777777..., ui=0.4461968..., vi=0.3547817..., di=0.2520202...),
 PlanckianTable_Tuvdi(Ti=1008.8888888..., ui=0.4459389..., vi=0.3548040..., di=0.2517697...),
 PlanckianTable_Tuvdi(Ti=1010.0, ui=0.4456812..., vi=0.3548261..., di=0.2515196...)]
colour.temperature.cct.planckian_table_minimal_distance_index(planckian_table)[source]

Returns the shortest distance index in given planckian table using Yoshi Ohno (2013) method.

Parameters:planckian_table (list) – Planckian table.
Returns:Shortest distance index.
Return type:int

Examples

>>> from colour import STANDARD_OBSERVERS_CMFS
>>> cmfs = 'CIE 1931 2 Degree Standard Observer'
>>> cmfs = STANDARD_OBSERVERS_CMFS.get(cmfs)
>>> table = planckian_table((0.1978, 0.3122), cmfs, 1000, 1010, 10)
>>> planckian_table_minimal_distance_index(table)
9
colour.temperature.cct.uv_to_CCT_ohno2013(uv, cmfs=<colour.colorimetry.cmfs.XYZ_ColourMatchingFunctions object at 0x102e0ccd0>, start=1000, end=100000, count=10, iterations=6)[source]

Returns the correlated colour temperature Tcp and Δuv from given CIE UCS colourspace uv chromaticity coordinates, colour matching functions and temperature range using Yoshi Ohno (2013) method.

The iterations parameter defines the calculations precision: The higher its value, the more planckian tables will be generated through cascade expansion in order to converge to the exact solution.

Parameters:
  • uv (array_like) – CIE UCS colourspace uv chromaticity coordinates.
  • cmfs (XYZ_ColourMatchingFunctions, optional) – Standard observer colour matching functions.
  • start (numeric, optional) – Temperature range start in kelvins.
  • end (numeric, optional) – Temperature range end in kelvins.
  • count (int, optional) – Temperatures count in the planckian tables.
  • iterations (int, optional) – Number of planckian tables to generate.
Returns:

Correlated colour temperature Tcp, Δuv.

Return type:

tuple

References

[3]Yoshi Ohno, Practical Use and Calculation of CCT and Duv, DOI: https://doi.org/10.1080/15502724.2014.839020

Examples

>>> from colour import STANDARD_OBSERVERS_CMFS
>>> cmfs = 'CIE 1931 2 Degree Standard Observer'
>>> cmfs = STANDARD_OBSERVERS_CMFS.get(cmfs)
>>> uv_to_CCT_ohno2013((0.1978, 0.3122), cmfs)  
(6507.5470349..., 0.0032236...)
colour.temperature.cct.CCT_to_uv_ohno2013(CCT, Duv=0, cmfs=<colour.colorimetry.cmfs.XYZ_ColourMatchingFunctions object at 0x102e0ccd0>)[source]

Returns the CIE UCS colourspace uv chromaticity coordinates from given correlated colour temperature Tcp, Δuv and colour matching functions using Yoshi Ohno (2013) method.

Parameters:
  • CCT (numeric) – Correlated colour temperature Tcp.
  • Duv (numeric, optional) – Δuv.
  • cmfs (XYZ_ColourMatchingFunctions, optional) – Standard observer colour matching functions.
Returns:

CIE UCS colourspace uv chromaticity coordinates.

Return type:

tuple

References

[4]Yoshi Ohno, Practical Use and Calculation of CCT and Duv, DOI: https://doi.org/10.1080/15502724.2014.839020

Examples

>>> from colour import STANDARD_OBSERVERS_CMFS
>>> cmfs = 'CIE 1931 2 Degree Standard Observer'
>>> cmfs = STANDARD_OBSERVERS_CMFS.get(cmfs)
>>> CCT = 6507.4342201047066
>>> Duv = 0.003223690901512735
>>> CCT_to_uv_ohno2013(CCT, Duv, cmfs)  
(0.1978003..., 0.3122005...)
colour.temperature.cct.uv_to_CCT_robertson1968(uv)[source]

Returns the correlated colour temperature Tcp and Δuv from given CIE UCS colourspace uv chromaticity coordinates using Robertson (1968) method.

Parameters:uv (array_like) – CIE UCS colourspace uv chromaticity coordinates.
Returns:Correlated colour temperature Tcp, Δuv.
Return type:tuple

References

[5]Wyszecki & Stiles, Color Science - Concepts and Methods Data and Formulae - Second Edition, Wiley Classics Library Edition, published 2000, ISBN-10: 0-471-39918-3, page 227.
[6]Adobe DNG SDK 1.3.0.0: dng_sdk_1_3/dng_sdk/source/dng_temperature.cpp: dng_temperature::Set_xy_coord.

Examples

>>> uv = (0.19374137599822966, 0.31522104394059397)
>>> uv_to_CCT_robertson1968(uv)  
(6500.0162879..., 0.0083333...)
colour.temperature.cct.CCT_to_uv_robertson1968(CCT, Duv=0)[source]

Returns the CIE UCS colourspace uv chromaticity coordinates from given correlated colour temperature Tcp and Δuv using Robertson (1968) method.

Parameters:
  • CCT (numeric) – Correlated colour temperature Tcp.
  • Duv (numeric) – Δuv.
Returns:

CIE UCS colourspace uv chromaticity coordinates.

Return type:

tuple

References

[7]Wyszecki & Stiles, Color Science - Concepts and Methods Data and Formulae - Second Edition, Wiley Classics Library Edition, published 2000, ISBN-10: 0-471-39918-3, page 227.
[8]Adobe DNG SDK 1.3.0.0: dng_sdk_1_3/dng_sdk/source/dng_temperature.cpp: dng_temperature::xy_coord.

Examples

>>> CCT = 6500.0081378199056
>>> Duv = 0.0083333312442250979
>>> CCT_to_uv_robertson1968(CCT, Duv)  
(0.1937413..., 0.3152210...)
colour.temperature.cct.UV_TO_CCT_METHODS = CaseInsensitiveMapping({u'Ohno 2013': <function uv_to_CCT_ohno2013 at 0x102fdb938>, u'robertson1968': <function uv_to_CCT_robertson1968 at 0x102fdba28>, u'ohno2013': <function uv_to_CCT_ohno2013 at 0x102fdb938>, u'Robertson 1968': <function uv_to_CCT_robertson1968 at 0x102fdba28>})

Supported CIE UCS colourspace uv chromaticity coordinates to correlated colour temperature Tcp computation methods.

UV_TO_CCT_METHODS : dict
(‘Ohno 2013’, ‘Robertson 1968’)

Aliases:

  • ‘ohno2013’: ‘Ohno 2013’
  • ‘robertson1968’: ‘Robertson 1968’
colour.temperature.cct.uv_to_CCT(uv, method=u'Ohno 2013', **kwargs)[source]

Returns the correlated colour temperature Tcp and Δuv from given CIE UCS colourspace uv chromaticity coordinates using given method.

Parameters:
  • uv (array_like) – CIE UCS colourspace uv chromaticity coordinates.
  • method (unicode) – (‘Ohno 2013’, ‘Robertson 1968’) Computation method.
  • **kwargs (**) – Keywords arguments.
Returns:

Correlated colour temperature Tcp, Δuv.

Return type:

tuple

Raises:

ValueError – If the computation method is not defined.

Examples

>>> from colour import STANDARD_OBSERVERS_CMFS
>>> cmfs = 'CIE 1931 2 Degree Standard Observer'
>>> cmfs = STANDARD_OBSERVERS_CMFS.get(cmfs)
>>> uv_to_CCT((0.1978, 0.3122), cmfs=cmfs)  
(6507.5470349..., 0.0032236...)
colour.temperature.cct.CCT_TO_UV_METHODS = CaseInsensitiveMapping({u'Ohno 2013': <function CCT_to_uv_ohno2013 at 0x102fdb9b0>, u'robertson1968': <function CCT_to_uv_robertson1968 at 0x102fdbaa0>, u'ohno2013': <function CCT_to_uv_ohno2013 at 0x102fdb9b0>, u'Robertson 1968': <function CCT_to_uv_robertson1968 at 0x102fdbaa0>})

Supported correlated colour temperature Tcp to CIE UCS colourspace uv chromaticity coordinates computation methods.

CCT_TO_UV_METHODS : dict
(‘Ohno 2013’, ‘Robertson 1968’)

Aliases:

  • ‘ohno2013’: ‘Ohno 2013’
  • ‘robertson1968’: ‘Robertson 1968’
colour.temperature.cct.CCT_to_uv(CCT, Duv=0, method=u'Ohno 2013', **kwargs)[source]

Returns the CIE UCS colourspace uv chromaticity coordinates from given correlated colour temperature Tcp and Δuv using given method.

Parameters:
  • CCT (numeric) – Correlated colour temperature Tcp.
  • Duv (numeric) – Δuv.
  • method (unicode) – (‘Ohno 2013’, ‘Robertson 1968’) Computation method.
  • **kwargs (**) – Keywords arguments.
Returns:

CIE UCS colourspace uv chromaticity coordinates.

Return type:

tuple

Raises:

ValueError – If the computation method is not defined.

Examples

>>> from colour import STANDARD_OBSERVERS_CMFS
>>> cmfs = 'CIE 1931 2 Degree Standard Observer'
>>> cmfs = STANDARD_OBSERVERS_CMFS.get(cmfs)
>>> CCT = 6507.4342201047066
>>> Duv = 0.003223690901512735
>>> CCT_to_uv(CCT, Duv, cmfs=cmfs)  
(0.1978003..., 0.3122005...)
colour.temperature.cct.xy_to_CCT_mccamy1992(xy)[source]

Returns the correlated colour temperature Tcp from given CIE XYZ colourspace xy chromaticity coordinates using McCamy (1992) method.

Parameters:xy (array_like) – xy chromaticity coordinates.
Returns:Correlated colour temperature Tcp.
Return type:numeric

References

[9]http://en.wikipedia.org/wiki/Color_temperature#Approximation (Last accessed 28 June 2014)

Examples

>>> xy_to_CCT_mccamy1992((0.31271, 0.32902))  
6504.3893830...
colour.temperature.cct.xy_to_CCT_hernandez1999(xy)[source]

Returns the correlated colour temperature Tcp from given CIE XYZ colourspace xy chromaticity coordinates using Hernandez-Andres, Lee & Romero (1999) method.

Parameters:xy (array_like) – xy chromaticity coordinates.
Returns:Correlated colour temperature Tcp.
Return type:numeric

References

[10]Calculating correlated color temperatures across the entire gamut of daylight and skylight chromaticities, DOI: https://doi.org/10.1364/AO.38.005703

Examples

>>> xy_to_CCT_hernandez1999((0.31271, 0.32902))  
6500.0421533...
colour.temperature.cct.CCT_to_xy_kang2002(CCT)[source]

Returns the CIE XYZ colourspace xy chromaticity coordinates from given correlated colour temperature Tcp using Kang, Moon, Hong, Lee, Cho and Kim (2002) method.

Parameters:CCT (numeric) – Correlated colour temperature Tcp.
Returns:xy chromaticity coordinates.
Return type:tuple
Raises:ValueError – If the correlated colour temperature is not in appropriate domain.

References

[11]Design of Advanced Color - Temperature Control System for HDTV Applications

Examples

>>> CCT_to_xy_kang2002(6504.38938305)  
(0.3134259..., 0.3235959...)
colour.temperature.cct.CCT_to_xy_illuminant_D(CCT)[source]

Converts from the correlated colour temperature Tcp of a CIE Illuminant D Series to the chromaticity of that CIE Illuminant D Series.

Parameters:CCT (numeric) – Correlated colour temperature Tcp.
Returns:xy chromaticity coordinates.
Return type:tuple
Raises:ValueError – If the correlated colour temperature is not in appropriate domain.

References

[12]Wyszecki & Stiles, Color Science - Concepts and Methods Data and Formulae - Second Edition, Wiley Classics Library Edition, published 2000, ISBN-10: 0-471-39918-3, page 145.

Examples

>>> CCT_to_xy_illuminant_D(6504.38938305)  
(0.3127077..., 0.3291128...)
colour.temperature.cct.XY_TO_CCT_METHODS = CaseInsensitiveMapping({u'hernandez1999': <function xy_to_CCT_hernandez1999 at 0x102fdbc80>, u'Hernandez 1999': <function xy_to_CCT_hernandez1999 at 0x102fdbc80>, u'McCamy 1992': <function xy_to_CCT_mccamy1992 at 0x102fdbc08>, u'mccamy1992': <function xy_to_CCT_mccamy1992 at 0x102fdbc08>})

Supported CIE XYZ colourspace xy chromaticity coordinates to correlated colour temperature Tcp computation methods.

XY_TO_CCT_METHODS : dict
(‘McCamy 1992’, ‘Hernandez 1999’)

Aliases:

  • ‘mccamy1992’: ‘McCamy 1992’
  • ‘hernandez1999’: ‘Hernandez 1999’
colour.temperature.cct.xy_to_CCT(xy, method=u'McCamy 1992', **kwargs)[source]

Returns the correlated colour temperature Tcp from given CIE XYZ colourspace xy chromaticity coordinates using given method.

Parameters:
  • xy (array_like) – xy chromaticity coordinates.
  • method (unicode (‘McCamy 1992’, ‘Hernandez 1999’)) – Computation method.
  • **kwargs (**) – Keywords arguments.
Returns:

Correlated colour temperature Tcp.

Return type:

numeric

colour.temperature.cct.CCT_TO_XY_METHODS = CaseInsensitiveMapping({u'cie_d': <function CCT_to_xy_illuminant_D at 0x102fdbd70>, u'CIE Illuminant D Series': <function CCT_to_xy_illuminant_D at 0x102fdbd70>, u'kang2002': <function CCT_to_xy_kang2002 at 0x102fdbcf8>, u'Kang 2002': <function CCT_to_xy_kang2002 at 0x102fdbcf8>})

Supported correlated colour temperature Tcp to CIE XYZ colourspace xy chromaticity coordinates computation methods.

CCT_TO_XY_METHODS : dict
(‘Kang 2002’, ‘CIE Illuminant D Series’)

Aliases:

  • ‘kang2002’: ‘Kang 2002’
  • ‘cie_d’: ‘Hernandez 1999’
colour.temperature.cct.CCT_to_xy(CCT, method=u'Kang 2002')[source]

Returns the CIE XYZ colourspace xy chromaticity coordinates from given correlated colour temperature Tcp using given method.

Parameters:
  • CCT (numeric) – Correlated colour temperature Tcp.
  • method (unicode (‘Kang 2002’, ‘CIE Illuminant D Series’)) – Computation method.
Returns:

xy chromaticity coordinates.

Return type:

tuple