Skip to content

Commit

Permalink
Merge branch 'feature/v0.4.7' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown committed Nov 2, 2024
2 parents 9c36d3b + 9ba813d commit b089327
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 29 deletions.
21 changes: 2 additions & 19 deletions colour/difference/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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:
"""
Expand Down
34 changes: 34 additions & 0 deletions colour/hints/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102
"Von Kries",
"XYZ Scaling",
]

LiteralColourspaceModel = Literal[
"CAM02LCD",
"CAM02SCD",
Expand Down Expand Up @@ -245,6 +246,7 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102
"hdr-CIELAB",
"hdr-IPT",
]

LiteralRGBColourspace = Literal[
"ACES2065-1",
"ACEScc",
Expand Down Expand Up @@ -315,6 +317,7 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102
"prophoto",
"sRGB",
]

LiteralLogEncoding = Literal[
"ACEScc",
"ACEScct",
Expand Down Expand Up @@ -348,6 +351,7 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102
"V-Log",
"ViperLog",
]

LiteralLogDecoding = Literal[
"ACEScc",
"ACEScct",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -419,6 +426,7 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102
"ST 2084",
"sRGB",
]

LiteralEOTFInverse = Literal[
"DCDM",
"DICOM GSDF",
Expand All @@ -429,6 +437,7 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102
"ST 2084",
"sRGB",
]

LiteralCCTFEncoding = Literal[
"ACEScc",
"ACEScct",
Expand Down Expand Up @@ -486,6 +495,7 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102
"ViperLog",
"sRGB",
]

LiteralCCTFDecoding = Literal[
"ACEScc",
"ACEScct",
Expand Down Expand Up @@ -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",
Expand All @@ -553,6 +566,7 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArray: # noqa: D102
"Sony SPI3D",
"Sony SPImtx",
]

LiteralLUTWriteMethod = Literal[
"Cinespace",
"Iridas Cube",
Expand All @@ -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",
Expand Down
8 changes: 1 addition & 7 deletions colour/utilities/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 1 addition & 3 deletions docs/colour.hints.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,5 @@ Annotation Type Hints
LiteralOOTFInverse
LiteralLUTReadMethod
LiteralLUTWriteMethod



LiteralDeltaEMethod
LiteralFontScaling
17 changes: 17 additions & 0 deletions utilities/literalise.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down

0 comments on commit b089327

Please sign in to comment.