colour.utilities.orient

colour.utilities.orient(a: ArrayLike, orientation: Union[Literal['Flip', 'Flop', '90 CW', '90 CCW', '180'], str]) Optional[numpy.ndarray][source]

Orient given array \(a\) according to given orientation.

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

  • orientation (Union[Literal['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]])