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) – Linear value.
  • black_offset (numeric) – Black offset.
  • **kwargs (**, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Cineon value.

Return type:

numeric

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) – Cineon value.
  • black_offset (numeric) – Black offset.
  • **kwargs (**, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Linear value.

Return type:

numeric

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) – Linear value.
  • black_offset (numeric) – Black offset.
  • **kwargs (**, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Panalog value.

Return type:

numeric

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) – Panalog value.
  • black_offset (numeric) – Black offset.
  • **kwargs (**, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Linear value.

Return type:

numeric

Examples

>>> panalog_to_linear(0.37457679138229816)  
0.1...
colour.models.log.linear_to_red_log(value, black_offset=0.009955040995908344, **kwargs)[source]

Defines the linear to REDLog conversion function.

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

REDLog value.

Return type:

numeric

Examples

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

Defines the REDLog to linear conversion function.

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

Linear value.

Return type:

numeric

Examples

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

Defines the linear to ViperLog conversion function.

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

ViperLog value.

Return type:

numeric

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) – ViperLog value.
  • **kwargs (**, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Linear value.

Return type:

numeric

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) – Linear value.
  • log_reference (numeric) – Log reference.
  • linear_reference (numeric) – Linear reference.
  • negative_gamma (numeric) – Negative gamma.
  • density_per_code_value (numeric) – Density per code value.
Returns:

Josh Pines style pivoted log value.

Return type:

numeric

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) – Josh Pines style pivoted log value.
  • log_reference (numeric) – Log reference.
  • linear_reference (numeric) – Linear reference.
  • negative_gamma (numeric) – Negative gamma.
  • density_per_code_value (numeric) – Density per code value.
Returns:

Linear value.

Return type:

numeric

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) – Linear value.
  • **kwargs (**, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Canon Log value.

Return type:

numeric

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) – Canon Log value.
  • **kwargs (**, optional) – Unused parameter provided for signature compatibility with other linear / log conversion objects.
Returns:

Linear value.

Return type:

numeric

Examples

>>> c_log_to_linear(32.795389693580908 / 100)  
0.19999999...
colour.models.log.linear_to_aces_cc(x, **kwargs)
colour.models.log.aces_cc_to_linear(x, **kwargs)
colour.models.log.linear_to_alexa_log_c(x, **kwargs)
colour.models.log.alexa_log_c_to_linear(x, **kwargs)
colour.models.log.linear_to_dci_p3_log(x, **kwargs)
colour.models.log.dci_p3_log_to_linear(x, **kwargs)
colour.models.log.linear_to_s_log(x, **kwargs)
colour.models.log.s_log_to_linear(x, **kwargs)
colour.models.log.linear_to_s_log2(x, **kwargs)
colour.models.log.s_log2_to_linear(x, **kwargs)
colour.models.log.linear_to_s_log3(x, **kwargs)
colour.models.log.s_log3_to_linear(x, **kwargs)
colour.models.log.LINEAR_TO_LOG_METHODS = CaseInsensitiveMapping({u'ACEScc': <function <lambda> at 0x2b437ae89410>, u'REDLog': <function linear_to_red_log at 0x2b437ae89050>, u'DCI-P3': <function <lambda> at 0x2b437ae895f0>, u'Cineon': <function linear_to_cineon at 0x2b437ae6ade8>, u'C-Log': <function linear_to_c_log at 0x2b437ae89320>, u'PLog': <function linear_to_pivoted_log at 0x2b437ae89230>, u'Panalog': <function linear_to_panalog at 0x2b437ae6aed8>, u'ALEXA Log C': <function <lambda> at 0x2b437ae89500>, u'S-Log2': <function <lambda> at 0x2b437ae897d0>, u'S-Log3': <function <lambda> at 0x2b437ae898c0>, u'ViperLog': <function linear_to_viper_log at 0x2b437ae89140>, u'S-Log': <function <lambda> at 0x2b437ae896e0>})

Supported linear to log computations methods.

LINEAR_TO_LOG_METHODS : CaseInsensitiveMapping
{‘Cineon’, ‘Panalog’, ‘REDLog’, ‘ViperLog’, ‘PLog’, ‘C-Log’, ‘ACEScc’, ‘ALEXA Log C’, ‘DCI-P3’, ‘S-Log’, ‘S-Log2’, ‘S-Log3’}
colour.models.log.LOG_TO_LINEAR_METHODS = CaseInsensitiveMapping({u'ACEScc': <function <lambda> at 0x2b437ae89488>, u'REDLog': <function red_log_to_linear at 0x2b437ae890c8>, u'DCI-P3': <function <lambda> at 0x2b437ae89668>, u'Cineon': <function cineon_to_linear at 0x2b437ae6ae60>, u'C-Log': <function c_log_to_linear at 0x2b437ae89398>, u'PLog': <function pivoted_log_to_linear at 0x2b437ae892a8>, u'Panalog': <function panalog_to_linear at 0x2b437ae6af50>, u'ALEXA Log C': <function <lambda> at 0x2b437ae89578>, u'S-Log2': <function <lambda> at 0x2b437ae89848>, u'S-Log3': <function <lambda> at 0x2b437ae89938>, u'ViperLog': <function viper_log_to_linear at 0x2b437ae891b8>, u'S-Log': <function <lambda> at 0x2b437ae89758>})

Supported log to linear computations methods.

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

Converts from linear to log using given method.

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

Log value.

Return type:

numeric

Examples

>>> linear_to_log(0.18)  
0.4573196...
>>> linear_to_log(0.18, method='ACEScc')  
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) – Value.
  • method (unicode, optional) – {‘Cineon’, ‘Panalog’, ‘REDLog’, ‘ViperLog’, ‘PLog’, ‘C-Log’, ‘ACEScc’, ‘ALEXA Log C’, ‘DCI-P3’, ‘S-Log’, ‘S-Log2’, ‘S-Log3’}, Computation method.
  • **kwargs (**) – Keywords arguments.
Returns:

Log value.

Return type:

numeric

Examples

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