direction

sisl.utils.direction(d)[source]

Return the index coordinate index corresponding to the Cartesian coordinate system.

Parameters

d ({0, 'X', 'x', 1, 'Y', 'y', 2, 'Z', 'z'}) – returns the integer that corresponds to the coordinate index. If it is an integer, it is returned as is.

Returns

The index of the Cartesian coordinate system.

Return type

int

Examples

>>> direction(0)
0
>>> direction('Y')
1
>>> direction('z')
2
>>> direction('2')
2
>>> direction(' 2')
2
>>> direction('b')
1