broadcastable_method#

movement.utils.broadcasting.broadcastable_method(only_broadcastable_along=None, new_dimension_name=None)[source]#

Broadcast a class method along a xarray.DataArray dimension.

This is a convenience wrapper for make_broadcastable(is_classmethod = True), for use when extending class methods that act on coordinates, that we wish to cast across the axes of an xarray.DataArray.

Returns:

Callable with signature (self,) data, *args, broadcast_dimension = str, **kwargs, that applies f along the broadcast_dimension of data. *args and **kwargs match those passed to f, and retain the same interpretations.

Return type:

Callable[[GenericAlias[TypeVar(Self), ParamSpec(P, bound= None), TypeVar(ScalarOr1D, float, int, bool, TypeAliasType)]], GenericAlias[TypeVar(Self), ParamSpec(P, bound= None)]]

See also

make_broadcastable

The aliased decorator function.

Examples using broadcastable_method#

Broadcast functions across multi-dimensional data

Broadcast functions across multi-dimensional data