coordinates.mixins.core.CoordinateSystemAxesMixin.get_axes_permutation#
- static CoordinateSystemAxesMixin.get_axes_permutation(src_axes: Sequence[str], dst_axes: Sequence[str]) List[int] [source]#
Compute the permutation needed to reorder src_axes into dst_axes.
- Parameters:
- Returns:
Indices describing how to reorder src_axes to match dst_axes.
- Return type:
- Raises:
ValueError – If the two lists are not permutations of each other.
Examples
>>> from pymetric.coordinates import SphericalCoordinateSystem >>> cs = SphericalCoordinateSystem() >>> cs.get_axes_permutation(["theta", "r"], ["r", "theta"]) [1, 0]
If an element is not in one or the other sets, then an error occurs.
>>> cs.get_axes_permutation(["theta", "r", 'phi'], ["r", "theta"]) ValueError: `src_axes` and `dst_axes` must be permutations of each other.