colour.models.log Module

Log Conversion

Defines various linear to log and log to linear conversion functions:

References

[1]Sony Imageworks. (2012). make.py. Retrieved November 27, 2014, from https://github.com/imageworks/OpenColorIO-Configs/blob/master/nuke-default/make.py
colour.models.log.linear_to_cineon(value, black_offset=0.0107977516232771, **kwargs)[source]

Defines the linear to Cineon conversion function.

Parameters:
  • value (numeric or array_like) – Linear value.
  • black_offset (numeric or array_like) – Black offset.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Cineon value.

Return type:

numeric or ndarray

Examples

>>> linear_to_cineon(0.18)  
0.4573196...
colour.models.log.cineon_to_linear(value, black_offset=0.0107977516232771, **kwargs)[source]

Defines the Cineon to linear conversion function.

Parameters:
  • value (numeric or array_like) – Cineon value.
  • black_offset (numeric or array_like) – Black offset.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Linear value.

Return type:

numeric or ndarray

Examples

>>> cineon_to_linear(0.45731961308541841)  
0.18...
colour.models.log.linear_to_panalog(value, black_offset=0.04077184461038074, **kwargs)[source]

Defines the linear to Panalog conversion function.

Parameters:
  • value (numeric or array_like) – Linear value.
  • black_offset (numeric or array_like) – Black offset.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Panalog value.

Return type:

numeric or ndarray

Examples

>>> linear_to_panalog(0.18)  
0.3745767...
colour.models.log.panalog_to_linear(value, black_offset=0.04077184461038074, **kwargs)[source]

Defines the Panalog to linear conversion function.

Parameters:
  • value (numeric or array_like) – Panalog value.
  • black_offset (numeric or array_like) – Black offset.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Linear value.

Return type:

numeric or ndarray

Examples

>>> panalog_to_linear(0.37457679138229816)  
0.1...
colour.models.log.linear_to_viper_log(value, **kwargs)[source]

Defines the linear to ViperLog conversion function.

Parameters:
  • value (numeric or array_like) – Linear value.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

ViperLog value.

Return type:

numeric or ndarray

Examples

>>> linear_to_viper_log(0.18)  
0.6360080...
colour.models.log.viper_log_to_linear(value, **kwargs)[source]

Defines the ViperLog to linear conversion function.

Parameters:
  • value (numeric or array_like) – ViperLog value.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Linear value.

Return type:

numeric or ndarray

Examples

>>> viper_log_to_linear(0.63600806701041346)  
0.1799999...
colour.models.log.linear_to_pivoted_log(value, log_reference=445, linear_reference=0.18, negative_gamma=0.6, density_per_code_value=0.002)[source]

Defines the linear to Josh Pines style pivoted log conversion function.

Parameters:
  • value (numeric or array_like) – Linear value.
  • log_reference (numeric or array_like) – Log reference.
  • linear_reference (numeric or array_like) – Linear reference.
  • negative_gamma (numeric or array_like) – Negative gamma.
  • density_per_code_value (numeric or array_like) – Density per code value.
Returns:

Josh Pines style pivoted log value.

Return type:

numeric or ndarray

Examples

>>> linear_to_pivoted_log(0.18)  
0.4349951...
colour.models.log.pivoted_log_to_linear(value, log_reference=445, linear_reference=0.18, negative_gamma=0.6, density_per_code_value=0.002)[source]

Defines the Josh Pines style pivoted log to linear conversion function.

Parameters:
  • value (numeric or array_like) – Josh Pines style pivoted log value.
  • log_reference (numeric or array_like) – Log reference.
  • linear_reference (numeric or array_like) – Linear reference.
  • negative_gamma (numeric or array_like) – Negative gamma.
  • density_per_code_value (numeric or array_like) – Density per code value.
Returns:

Linear value.

Return type:

numeric or ndarray

Examples

>>> pivoted_log_to_linear(0.43499511241446726)  
0.1...
colour.models.log.linear_to_c_log(value, **kwargs)[source]

Defines the linear to Canon Log conversion function.

Parameters:
  • value (numeric or array_like) – Linear value.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Canon Log value.

Return type:

numeric or ndarray

References

[2]Thorpe, L. (2012). CANON-LOG TRANSFER CHARACTERISTIC. Retrieved from http://downloads.canon.com/CDLC/Canon-Log_Transfer_Characteristic_6-20-2012.pdf

Examples

>>> linear_to_c_log(0.20) * 100  
32.7953896...
colour.models.log.c_log_to_linear(value, **kwargs)[source]

Defines the Canon Log to linear conversion function. [2]

Parameters:
  • value (numeric or array_like) – Canon Log value.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Linear value.

Return type:

numeric or ndarray

Examples

>>> c_log_to_linear(32.795389693580908 / 100)  
0.19999999...
colour.models.log.linear_to_aces_cc(value, **kwargs)[source]

Defines the linear to ACEScc conversion function.

Parameters:
  • value (numeric or array_like) – Linear value.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

ACEScc value.

Return type:

numeric or ndarray

Examples

>>> linear_to_aces_cc(0.18)  
array(0.4135884...)
colour.models.log.aces_cc_to_linear(value, **kwargs)[source]

Defines the ACEScc to linear conversion function.

Parameters:
  • value (numeric or array_like) – ACEScc value.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Linear value.

Return type:

numeric or ndarray

Examples

>>> aces_cc_to_linear(0.41358840249244228)  
array(0.1800000...)
colour.models.log.linear_to_alexa_log_c(value, **kwargs)[source]

Defines the linear to ALEXA Log C conversion function.

Parameters:
  • value (numeric or array_like) – Linear value.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

ALEXA Log C value.

Return type:

numeric or ndarray

Examples

>>> linear_to_alexa_log_c(0.18)  
array(0.3910068...)
colour.models.log.alexa_log_c_to_linear(value, **kwargs)[source]

Defines the ALEXA Log C to linear conversion function.

Parameters:
  • value (numeric or array_like) – ALEXA Log C value.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Linear value.

Return type:

numeric or ndarray

Examples

>>> alexa_log_c_to_linear(0.39100683203408376)  
array(0.1800000...)
colour.models.log.linear_to_dci_p3_log(value, **kwargs)[source]

Defines the linear to DCI-P3 conversion function.

Parameters:
  • value (numeric or array_like) – Linear value.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

DCI-P3 value.

Return type:

numeric or ndarray

Examples

>>> linear_to_dci_p3_log(0.18)  
461.9922059...
colour.models.log.dci_p3_log_to_linear(value, **kwargs)[source]

Defines the DCI-P3 to linear conversion function.

Parameters:
  • value (numeric or array_like) – DCI-P3 value.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Linear value.

Return type:

numeric or ndarray

Examples

>>> dci_p3_log_to_linear(461.99220597484737)  
0.1800000...
colour.models.log.linear_to_red_log_film(value, black_offset=0.009955040995908344, **kwargs)[source]

Defines the linear to REDLogFilm conversion function.

Parameters:
  • value (numeric or array_like) – Linear value.
  • black_offset (numeric or array_like) – Black offset.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

REDLogFilm value.

Return type:

numeric or ndarray

Examples

>>> linear_to_red_log_film(0.18)  
0.6376218...
colour.models.log.red_log_film_to_linear(value, black_offset=0.009955040995908344, **kwargs)[source]

Defines the REDLogFilm to linear conversion function.

Parameters:
  • value (numeric or array_like) – REDLogFilm value.
  • black_offset (numeric or array_like) – Black offset.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Linear value.

Return type:

numeric or ndarray

Examples

>>> red_log_film_to_linear(0.63762184598817484)  
0.1...
colour.models.log.linear_to_s_log(value, **kwargs)[source]

Defines the linear to S-Log conversion function.

Parameters:
  • value (numeric or array_like) – Linear value.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

S-Log value.

Return type:

numeric or ndarray

Examples

>>> linear_to_s_log(0.18)  
0.3599878...
colour.models.log.s_log_to_linear(value, **kwargs)[source]

Defines the S-Log to linear conversion function.

Parameters:
  • value (numeric or array_like) – S-Log value.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Linear value.

Return type:

numeric or ndarray

Examples

>>> s_log_to_linear(0.35998784642215442)  
0.1...
colour.models.log.linear_to_s_log2(value, **kwargs)[source]

Defines the linear to S-Log2 conversion function.

Parameters:
  • value (numeric or array_like) – Linear value.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

S-Log2 value.

Return type:

numeric or ndarray

Examples

>>> linear_to_s_log2(0.18)  
0.3849708...
colour.models.log.s_log2_to_linear(value, **kwargs)[source]

Defines the S-Log2 to linear conversion function.

Parameters:
  • value (numeric or array_like) – S-Log2 value.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Linear value.

Return type:

numeric or ndarray

Examples

>>> s_log2_to_linear(0.38497081592867027)  
0.1...
colour.models.log.linear_to_s_log3(value, **kwargs)[source]

Defines the linear to S-Log3 conversion function.

Parameters:
  • value (numeric or array_like) – Linear value.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

S-Log3 value.

Return type:

numeric or ndarray

Examples

>>> linear_to_s_log3(0.18)  
array(0.4105571...)
colour.models.log.s_log3_to_linear(value, **kwargs)[source]

Defines the S-Log3 to linear conversion function.

Parameters:
  • value (numeric or array_like) – S-Log3 value.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Linear value.

Return type:

numeric or ndarray

Examples

>>> s_log3_to_linear(0.41055718475073316)  
array(0.1...)
colour.models.log.linear_to_v_log(value, **kwargs)[source]

Defines the linear to V-Log conversion function.

Parameters:
  • value (numeric or array_like) – Linear value.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

V-Log value.

Return type:

numeric or ndarray

Examples

>>> linear_to_v_log(0.18)  
array(0.4233114...)
colour.models.log.v_log_to_linear(value, **kwargs)[source]

Defines the V-Log to linear conversion function.

Parameters:
  • value (numeric or array_like) – V-Log value.
  • **kwargs (dict, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Linear value.

Return type:

numeric or ndarray

Examples

>>> v_log_to_linear(0.42331144876013616)  
array(0.1...)
colour.models.log.LINEAR_TO_LOG_METHODS = CaseInsensitiveMapping({u'ACEScc': <function linear_to_aces_cc at 0x7fa03e53fd70>, u'REDLogFilm': <function linear_to_red_log_film at 0x7fa03e5450c8>, u'V-Log': <function linear_to_v_log at 0x7fa03e545488>, u'DCI-P3': <function linear_to_dci_p3_log at 0x7fa03e53ff50>, u'Cineon': <function linear_to_cineon at 0x7fa03e53f8c0>, u'C-Log': <function linear_to_c_log at 0x7fa03e53fc80>, u'PLog': <function linear_to_pivoted_log at 0x7fa03e53fb90>, u'Panalog': <function linear_to_panalog at 0x7fa03e53f9b0>, u'ALEXA Log C': <function linear_to_alexa_log_c at 0x7fa03e53fe60>, u'S-Log2': <function linear_to_s_log2 at 0x7fa03e5452a8>, u'S-Log3': <function linear_to_s_log3 at 0x7fa03e545398>, u'ViperLog': <function linear_to_viper_log at 0x7fa03e53faa0>, u'S-Log': <function linear_to_s_log at 0x7fa03e5451b8>})

Supported linear to log computations methods.

LINEAR_TO_LOG_METHODS : CaseInsensitiveMapping
{‘Cineon’, ‘Panalog’, ‘ViperLog’, ‘PLog’, ‘C-Log’, ‘ACEScc’, ‘ALEXA Log C’, ‘DCI-P3’, ‘REDLogFilm’, ‘S-Log’, ‘S-Log2’, ‘S-Log3’, ‘V-Log’}
colour.models.log.LOG_TO_LINEAR_METHODS = CaseInsensitiveMapping({u'ACEScc': <function aces_cc_to_linear at 0x7fa03e53fde8>, u'REDLogFilm': <function red_log_film_to_linear at 0x7fa03e545140>, u'V-Log': <function v_log_to_linear at 0x7fa03e545500>, u'DCI-P3': <function dci_p3_log_to_linear at 0x7fa03e545050>, u'Cineon': <function cineon_to_linear at 0x7fa03e53f938>, u'C-Log': <function c_log_to_linear at 0x7fa03e53fcf8>, u'PLog': <function pivoted_log_to_linear at 0x7fa03e53fc08>, u'Panalog': <function panalog_to_linear at 0x7fa03e53fa28>, u'ALEXA Log C': <function alexa_log_c_to_linear at 0x7fa03e53fed8>, u'S-Log2': <function s_log2_to_linear at 0x7fa03e545320>, u'S-Log3': <function s_log3_to_linear at 0x7fa03e545410>, u'ViperLog': <function viper_log_to_linear at 0x7fa03e53fb18>, u'S-Log': <function s_log_to_linear at 0x7fa03e545230>})

Supported log to linear computations methods.

LOG_TO_LINEAR_METHODS : CaseInsensitiveMapping
{‘Cineon’, ‘Panalog’, ‘ViperLog’, ‘PLog’, ‘C-Log’, ‘ACEScc’, ‘ALEXA Log C’, ‘DCI-P3’, ‘REDLogFilm’, ‘S-Log’, ‘S-Log2’, ‘S-Log3’, ‘V-Log’}
colour.models.log.linear_to_log(value, method=u'Cineon', **kwargs)[source]

Converts from linear to log using given method.

Parameters:
  • value (numeric or array_like) – Value.
  • method (unicode, optional) – {‘Cineon’, ‘Panalog’, ‘ViperLog’, ‘PLog’, ‘C-Log’, ‘ACEScc’, ‘ALEXA Log C’, ‘REDLogFilm’, ‘DCI-P3’, ‘S-Log’, ‘S-Log2’, ‘S-Log3’, ‘V-Log’}, Computation method.
  • **kwargs (dict, optional) – Keywords arguments.
Returns:

Log value.

Return type:

numeric or ndarray

Examples

>>> linear_to_log(0.18)  
0.4573196...
>>> linear_to_log(0.18, method='ACEScc')  
array(0.4135884...)
>>> linear_to_log(  
...     0.18, method='PLog', log_reference=400)
0.3910068...
>>> linear_to_log(0.18, method='S-Log')  
0.3599878...
colour.models.log.log_to_linear(value, method=u'Cineon', **kwargs)[source]

Converts from log to linear using given method.

Parameters:
  • value (numeric or array_like) – Value.
  • method (unicode, optional) – {‘Cineon’, ‘Panalog’, ‘ViperLog’, ‘PLog’, ‘C-Log’, ‘ACEScc’, ‘ALEXA Log C’, ‘DCI-P3’, ‘REDLogFilm’, ‘S-Log’, ‘S-Log2’, ‘S-Log3’, ‘V-Log’}, Computation method.
  • **kwargs (dict, optional) – Keywords arguments.
Returns:

Log value.

Return type:

numeric or ndarray

Examples

>>> log_to_linear(0.45731961308541841)  
0.18...
>>> log_to_linear(0.41358840249244228,
...     method='ACEScc')  
array(0.18...)
>>> log_to_linear(  
...     0.39100684261974583, method='PLog', log_reference=400)
0.1...
>>> log_to_linear(  
...     0.35998784642215442, method='S-Log')
0.1799999...