colour.utilities.orient#

colour.utilities.orient(a: ArrayLike, orientation: Literal['Ignore', 'Flip', 'Flop', '90 CW', '90 CCW', '180'] | str = 'Ignore') NDArray[source]#

Orient the specified array \(a\) using the specified orientation.

Parameters:
  • a (ArrayLike) – Array \(a\) to orient.

  • orientation (Literal['Ignore', 'Flip', 'Flop', '90 CW', '90 CCW', '180'] | str) – Orientation to perform.

Returns:

Oriented array.

Return type:

numpy.ndarray

Examples

>>> a = np.tile(np.arange(5), (5, 1))
>>> a
array([[0, 1, 2, 3, 4],
       [0, 1, 2, 3, 4],
       [0, 1, 2, 3, 4],
       [0, 1, 2, 3, 4],
       [0, 1, 2, 3, 4]])
>>> orient(a, "90 CW")
array([[0., 0., 0., 0., 0.],
       [1., 1., 1., 1., 1.],
       [2., 2., 2., 2., 2.],
       [3., 3., 3., 3., 3.],
       [4., 4., 4., 4., 4.]])
>>> orient(a, "Flip")
array([[4., 3., 2., 1., 0.],
       [4., 3., 2., 1., 0.],
       [4., 3., 2., 1., 0.],
       [4., 3., 2., 1., 0.],
       [4., 3., 2., 1., 0.]])