coordinates.mixins.core.CoordinateSystemAxesMixin.insert_fixed_axes#

CoordinateSystemAxesMixin.insert_fixed_axes(iterable: Sequence[Any], src_axes: Sequence[str], fixed_axes: Dict[str, Any] | None = None) List[Any][source]#

Insert fixed axis values into an iterable of values according to canonical axis order.

This is used to construct a complete value list (e.g., coordinate components) from: - a partial set of values aligned with src_axes, and - a dictionary of fixed scalar values for other axes (fixed_axes).

The result is a new list with one value per coordinate system axis, aligned to self.axes.

Parameters:
  • iterable (list) – Values corresponding to src_axes.

  • src_axes (list of str) – Axis names corresponding to the entries in iterable.

  • fixed_axes (dict of {str: Any}, optional) – A dictionary of fixed axis values to insert into the output.

Returns:

Values reordered and filled to match self.axes.

Return type:

list

Raises:

ValueError – If src_axes and fixed_axes overlap. If any axis in src_axes or fixed_axes is not part of the coordinate system.

Examples

>>> from pymetric.coordinates import SphericalCoordinateSystem
>>> cs = SphericalCoordinateSystem()
>>> cs.axes
['r', 'theta', 'phi']
>>> cs.insert_fixed_axes(["R","PHI"], ['r', 'phi'], fixed_axes={'theta': "THETA"})
['R', 'THETA', 'PHI']

This will also reorder entries that are not in canonical order:

>>> cs.insert_fixed_axes(["PHI","R"], ['phi', 'r'], fixed_axes={'theta': "THETA"})
['R', 'THETA', 'PHI']