colour.models.logarithmic_function_quasilog#

colour.models.logarithmic_function_quasilog(x: ArrayLike, style: Literal['linToLog', 'logToLin'] | str = 'linToLog', base: int = 2, log_side_slope: float = 1, lin_side_slope: float = 1, log_side_offset: float = 0, lin_side_offset: float = 0) NDArrayFloat[source]#

Apply the Quasilog logarithmic function for encoding and decoding.

This function implements a logarithmic transformation with configurable slopes and offsets for both linear and logarithmic sides.

Parameters:
  • x (ArrayLike) – Logarithmically encoded data \(x\).

  • style (Literal['linToLog', 'logToLin'] | str) –

    Specifies the behaviour for the logarithmic function to operate:

    • linToLog: Apply a logarithm to convert linear data to logarithmic data.

    • logToLin: Apply an anti-logarithm to convert logarithmic data to linear data.

  • base (int) – Logarithmic base used for the conversion.

  • log_side_slope (float) – Slope (or gain) applied to the log side of the logarithmic function. The default value is 1.

  • lin_side_slope (float) – Slope of the linear side of the logarithmic function. The default value is 1.

  • log_side_offset (float) – Offset applied to the log side of the logarithmic function. The default value is 0.

  • lin_side_offset (float) – Offset applied to the linear side of the logarithmic function. The default value is 0.

Returns:

Encoded/Decoded data.

Return type:

numpy.ndarray

Examples

>>> logarithmic_function_quasilog(0.18, "linToLog")
np.float64(-2.4739311...)
>>> logarithmic_function_quasilog(
...     -2.473931188332412, "logToLin"
... )
np.float64(0.18000000...)