colour.models.logarithmic_function_basic#

colour.models.logarithmic_function_basic(x: ArrayLike, style: Literal['log10', 'antiLog10', 'log2', 'antiLog2', 'logB', 'antiLogB'] | str = 'log2', base: int = 2) NDArrayFloat[source]#

Define the basic logarithmic function.

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

  • style (Literal['log10', 'antiLog10', 'log2', 'antiLog2', 'logB', 'antiLogB'] | str) –

    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 (int) – Logarithmic base used for the conversion.

Returns:

Logarithmically converted data.

Return type:

numpy.ndarray

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...