coordinates.mixins.mathops.CoordinateSystemMathMixin.compute_function_from_coordinates#

CoordinateSystemMathMixin.compute_function_from_coordinates(func: Callable, coordinates: Sequence[_Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]], fixed_axes: Dict[str, float] | None = None, sparse: bool = False) _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str][source]#

Evaluate a function over 1D coordinate arrays with optional fixed axes.

This method creates a broadcasted meshgrid internally from 1D input arrays and evaluates the expression over it.

Parameters:
  • func (callable) – The function being evaluated.

  • coordinates (list of array-like) – 1D arrays representing coordinate values for free axes.

  • fixed_axes (dict of {str: float}, optional) – Dictionary of scalar axis values for fixed axes.

  • sparse (bool, optional) –

    If True the shape of the returned coordinate array for dimension i is reduced from (N1, ..., Ni, ... Nn) to (1, ..., 1, Ni, 1, ..., 1). These sparse coordinate grids are intended to be use with Broadcasting. When all coordinates are used in an expression, broadcasting still leads to a fully-dimensional result array.

    Default is False.

Returns:

The evaluated result over the broadcasted grid.

Return type:

array-like

Raises:
  • KeyError – If the expression is not available.

  • ValueError – If axis names are inconsistent.