colour.models.logarithmic_function_basic

colour.models.logarithmic_function_basic(x, style='log2', base=2)[source]

Defines the basic logarithmic function.

Parameters
  • x (numeric) – The data to undergo basic logarithmic conversion.

  • style (unicode, optional) –

    {‘log10’, ‘antiLog10’, ‘log2’, ‘antiLog2’, ‘logB’, ‘antiLogB’}, Defines the behaviour for the logarithmic function to operate:

    • log10: Applies a base 10 logarithm to the passed value.

    • antiLog10: Applies a base 10 anti-logarithm to the passed value.

    • log2: Applies a base 2 logarithm to the passed value.

    • antiLog2: Applies a base 2 anti-logarithm to the passed value.

    • logB: Applies an arbitrary base logarithm to the passed value.

    • antiLogB: Applies an arbitrary base anti-logarithm to the passed value.

  • base (numeric, optional) – Logarithmic base used for the conversion.

Returns

Logarithmically converted data.

Return type

numeric or ndarray

Raises

ValueError – If the style is not defined.

Examples

The basic logarithmic function styles operate as follows:

>>> logarithmic_function_basic(0.18)  
-2.4739311...
>>> logarithmic_function_basic(0.18, 'log10')  
-0.7447274...
>>> logarithmic_function_basic(  
...    0.18, 'logB', 3)
-1.5608767...
>>> logarithmic_function_basic(  
...    -2.473931188332412, 'antiLog2')
0.18000000...
>>> logarithmic_function_basic(  
...    -0.7447274948966939, 'antiLog10')
0.18000000...
>>> logarithmic_function_basic(  
...    -1.5608767950073117, 'antiLogB', 3)
0.18000000...