Coverage for models/rgb/transfer_functions/linear.py: 8%
12 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-11-16 22:49 +1300
« prev ^ index » next coverage.py v7.11.0, created at 2025-11-16 22:49 +1300
1"""
2Linear Colour Component Transfer Function
3=========================================
5Define the linear encoding / decoding colour component transfer function
6related objects.
8- :func:`colour.linear_function`
9"""
11from __future__ import annotations
13import typing
15if typing.TYPE_CHECKING:
16 from colour.hints import ArrayLike, DTypeFloat, NDArray, NDArrayFloat
18from colour.utilities import as_float
20__author__ = "Colour Developers"
21__copyright__ = "Copyright 2013 Colour Developers"
22__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
23__maintainer__ = "Colour Developers"
24__email__ = "colour-developers@colour-science.org"
25__status__ = "Production"
27__all__ = [
28 "linear_function",
29]
32@typing.overload
33def linear_function(a: float | DTypeFloat) -> DTypeFloat: ...
34@typing.overload
35def linear_function(a: NDArray) -> NDArrayFloat: ...
36@typing.overload
37def linear_function(a: ArrayLike) -> DTypeFloat | NDArrayFloat: ...
38def linear_function(a: ArrayLike) -> DTypeFloat | NDArrayFloat:
39 """
40 Perform pass-through linear encoding/decoding transformation.
42 Implement an identity transformation where the output equals the input,
43 commonly used as a reference or default encoding/decoding function in
44 colour science workflows.
46 Parameters
47 ----------
48 a
49 Array to encode/decode.
51 Returns
52 -------
53 :class:`numpy.ndarray`
54 Encoded/decoded array, identical to input.
56 Examples
57 --------
58 >>> linear_function(0.18) # doctest: +ELLIPSIS
59 0.1799999...
60 """
62 return as_float(a)