Coverage for characterisation/displays.py: 7%

1"""

2 RGB Display Primaries

3=====================

4

5 Define the spectral distribution classes for datasets from the

6:mod:`colour.characterisation.datasets.displays` module.

7

8- :class:`colour.characterisation.RGB_DisplayPrimaries`: Provide support

9 for *RGB* display (such as *CRT* or *LCD*) primaries multi-spectral

10 distributions.

11"""

12

13 from __future__ import annotations

14

15 import typing

16

17 from colour.colorimetry import (

18 MultiSpectralDistributions,

19 SpectralDistribution,

20 SpectralShape,

21)

22

23 if typing.TYPE_CHECKING:

24 from collections.abc import KeysView, ValuesView

25 from colour.continuous import MultiSignals, Signal

26 from colour.hints import (

27 Any,

28 ArrayLike,

29 Sequence,

30 )

31

32 from colour.utilities import is_pandas_installed

33

34 if typing.TYPE_CHECKING or is_pandas_installed():

35 from pandas import DataFrame, Series # pragma: no cover

36 else: # pragma: no cover

37 from unittest import mock

38

39 DataFrame = mock.MagicMock()

40 Series = mock.MagicMock()

41

42 __author__ = "Colour Developers"

43 __copyright__ = "Copyright 2013 Colour Developers"

44 __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"

45 __maintainer__ = "Colour Developers"

46 __email__ = "colour-developers@colour-science.org"

47 __status__ = "Production"

48

49 __all__ = [

50 "RGB_DisplayPrimaries",

51]

52

53

54 class RGB_DisplayPrimaries(MultiSpectralDistributions):

55 """

56 Define a container for *RGB* display primaries as multi-spectral

57 distributions.

58

59 Support *RGB* display technologies (such as *CRT* or *LCD*) by storing

60 their primary colours as multi-spectral distributions for accurate colour

61 science computations.

62

63 Parameters

64 ----------

65 data

66 Data to be stored in the multi-spectral distributions.

67 domain

68 Values to initialise the multiple

69 :class:`colour.SpectralDistribution` class instances

70 :attr:`colour.continuous.Signal.wavelengths` attribute with. If

71 both ``data`` and ``domain`` arguments are defined, the latter will

72 be used to initialise the

73 :attr:`colour.continuous.Signal.wavelengths` property.

74 labels

75 Names to use for the :class:`colour.SpectralDistribution` class

76 instances.

77

78 Other Parameters

79 ----------------

80 extrapolator

81 Extrapolator class type to use as extrapolating function for the

82 :class:`colour.SpectralDistribution` class instances.

83 extrapolator_kwargs

84 Arguments to use when instantiating the extrapolating function of

85 the :class:`colour.SpectralDistribution` class instances.

86 interpolator

87 Interpolator class type to use as interpolating function for the

88 :class:`colour.SpectralDistribution` class instances.

89 interpolator_kwargs

90 Arguments to use when instantiating the interpolating function of

91 the :class:`colour.SpectralDistribution` class instances.

92 name

93 Multi-spectral distributions name.

94 display_labels

95 Multi-spectral distributions labels for figures, default to

96 :attr:`colour.colorimetry.RGB_DisplayPrimaries.labels` property

97 value.

98 """

99

100 def __init__(

101 self,

102 data: (

103 ArrayLike

104 | DataFrame

105 | dict

106 | MultiSignals

107 | MultiSpectralDistributions

108 | Sequence

109 | Series

110 | Signal

111 | SpectralDistribution

112 | ValuesView

113 | None

114 ) = None,

115 domain: ArrayLike | SpectralShape | KeysView | None = None,

116 labels: Sequence | None = None, # noqa: ARG002

117 **kwargs: Any,

118 ) -> None:

119 super().__init__(data, domain, labels=("red", "green", "blue"), **kwargs)