diff --git a/colour/difference/__init__.py b/colour/difference/__init__.py index 8abf5a00d..e9f12fa0d 100644 --- a/colour/difference/__init__.py +++ b/colour/difference/__init__.py @@ -34,7 +34,7 @@ from __future__ import annotations -from colour.hints import Any, ArrayLike, NDArrayFloat, Literal +from colour.hints import Any, ArrayLike, NDArrayFloat, LiteralDeltaEMethod from colour.utilities import ( CanonicalMapping, filter_kwargs, @@ -127,24 +127,7 @@ def delta_E( a: ArrayLike, b: ArrayLike, - method: ( - Literal[ - "CIE 1976", - "CIE 1994", - "CIE 2000", - "CMC", - "ITP", - "CAM02-LCD", - "CAM02-SCD", - "CAM02-UCS", - "CAM16-LCD", - "CAM16-SCD", - "CAM16-UCS", - "DIN99", - "HyAB", - ] - | str - ) = "CIE 2000", + method: LiteralDeltaEMethod | str = "CIE 2000", **kwargs: Any, ) -> NDArrayFloat: """ diff --git a/colour/hints/__init__.py b/colour/hints/__init__.py index b4b2ba5b8..ad923ccea 100644 --- a/colour/hints/__init__.py +++ b/colour/hints/__init__.py @@ -207,6 +207,7 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102 "Von Kries", "XYZ Scaling", ] + LiteralColourspaceModel = Literal[ "CAM02LCD", "CAM02SCD", @@ -245,6 +246,7 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102 "hdr-CIELAB", "hdr-IPT", ] + LiteralRGBColourspace = Literal[ "ACES2065-1", "ACEScc", @@ -315,6 +317,7 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102 "prophoto", "sRGB", ] + LiteralLogEncoding = Literal[ "ACEScc", "ACEScct", @@ -348,6 +351,7 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102 "V-Log", "ViperLog", ] + LiteralLogDecoding = Literal[ "ACEScc", "ACEScct", @@ -381,6 +385,7 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102 "V-Log", "ViperLog", ] + LiteralOETF = Literal[ "ARIB STD-B67", "Blackmagic Film Generation 5", @@ -395,6 +400,7 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102 "ITU-T H.273 Log Sqrt", "SMPTE 240M", ] + LiteralOETFInverse = Literal[ "ARIB STD-B67", "Blackmagic Film Generation 5", @@ -408,6 +414,7 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102 "ITU-T H.273 Log", "ITU-T H.273 Log Sqrt", ] + LiteralEOTF = Literal[ "DCDM", "DICOM GSDF", @@ -419,6 +426,7 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102 "ST 2084", "sRGB", ] + LiteralEOTFInverse = Literal[ "DCDM", "DICOM GSDF", @@ -429,6 +437,7 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102 "ST 2084", "sRGB", ] + LiteralCCTFEncoding = Literal[ "ACEScc", "ACEScct", @@ -486,6 +495,7 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102 "ViperLog", "sRGB", ] + LiteralCCTFDecoding = Literal[ "ACEScc", "ACEScct", @@ -543,8 +553,11 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102 "ViperLog", "sRGB", ] + LiteralOOTF = Literal["ITU-R BT.2100 HLG", "ITU-R BT.2100 PQ"] + LiteralOOTFInverse = Literal["ITU-R BT.2100 HLG", "ITU-R BT.2100 PQ"] + LiteralLUTReadMethod = Literal[ "Cinespace", "Iridas Cube", @@ -553,6 +566,7 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102 "Sony SPI3D", "Sony SPImtx", ] + LiteralLUTWriteMethod = Literal[ "Cinespace", "Iridas Cube", @@ -561,6 +575,26 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102 "Sony SPI3D", "Sony SPImtx", ] + +LiteralDeltaEMethod = Literal[ + "CAM02-LCD", + "CAM02-SCD", + "CAM02-UCS", + "CAM16-LCD", + "CAM16-SCD", + "CAM16-UCS", + "CIE 1976", + "CIE 1994", + "CIE 2000", + "CMC", + "DIN99", + "HyAB", + "ITP", + "cie1976", + "cie1994", + "cie2000", +] + LiteralFontScaling = Literal[ "xx-small", "x-small", diff --git a/colour/utilities/array.py b/colour/utilities/array.py index 97773d64c..4057dac22 100644 --- a/colour/utilities/array.py +++ b/colour/utilities/array.py @@ -2232,13 +2232,7 @@ def tsplit( a = as_array(a, dtype) - if a.ndim <= 2: - return np.transpose(a) - - return np.transpose( - a, - np.concatenate([[a.ndim - 1], np.arange(0, a.ndim - 1)]), - ) + return np.array([a[..., x] for x in range(a.shape[-1])]) def row_as_diagonal(a: ArrayLike) -> NDArray: diff --git a/docs/colour.hints.rst b/docs/colour.hints.rst index f107c3c2d..5771b9b9a 100644 --- a/docs/colour.hints.rst +++ b/docs/colour.hints.rst @@ -70,7 +70,5 @@ Annotation Type Hints LiteralOOTFInverse LiteralLUTReadMethod LiteralLUTWriteMethod - - - + LiteralDeltaEMethod LiteralFontScaling diff --git a/utilities/literalise.py b/utilities/literalise.py index b071099e8..e7f6b700c 100755 --- a/utilities/literalise.py +++ b/utilities/literalise.py @@ -59,20 +59,37 @@ def literalise(path_module_hints: str = PATH_MODULE_HINTS): # LITERALISE::BEGIN LiteralChromaticAdaptationTransform = \ Literal{sorted(colour.CHROMATIC_ADAPTATION_TRANSFORMS)} + LiteralColourspaceModel = Literal{sorted(colour.COLOURSPACE_MODELS)} + LiteralRGBColourspace = Literal{sorted(colour.RGB_COLOURSPACES.keys())} + LiteralLogEncoding = Literal{sorted(colour.LOG_ENCODINGS)} + LiteralLogDecoding = Literal{sorted(colour.LOG_DECODINGS)} + LiteralOETF = Literal{sorted(colour.OETFS)} + LiteralOETFInverse = Literal{sorted(colour.OETF_INVERSES)} + LiteralEOTF = Literal{sorted(colour.EOTFS)} + LiteralEOTFInverse = Literal{sorted(colour.EOTF_INVERSES)} + LiteralCCTFEncoding = Literal{sorted(colour.CCTF_ENCODINGS)} + LiteralCCTFDecoding = Literal{sorted(colour.CCTF_DECODINGS)} + LiteralOOTF = Literal{sorted(colour.OOTFS)} + LiteralOOTFInverse = Literal{sorted(colour.OOTF_INVERSES)} + LiteralLUTReadMethod = Literal{sorted(colour.io.LUT_READ_METHODS)} + LiteralLUTWriteMethod = Literal{sorted(colour.io.LUT_WRITE_METHODS)} + + LiteralDeltaEMethod = Literal{sorted(colour.DELTA_E_METHODS)} + LiteralFontScaling = Literal{font_scalings} # LITERALISE::END """