raw_rearrange#

xarray_einstats.einops.raw_rearrange(da, pattern, **kwargs)[source]#

Crudely wrap einops.rearrange.

Wrapper around einops.rearrange with a very similar syntax. Spaces, parenthesis () and -> are not allowed in dimension names.

Parameters:
daxarray.DataArray

Input array

patternstr

Pattern string. Same syntax as patterns in einops with two caveats:

  • Unless splitting or stacking, you must use the actual dimension names.

  • When splitting or stacking you can use (dim1 dim2)=dim. This is necessary for the left hand side as it identifies the dimension to split, and optional on the right hand side, if omitted the stacked dimension will be given a default name.

kwargsdict, optional

Passed to xarray_einstats.einops.rearrange

Returns:
xarray.DataArray

See also

xarray_einstats.einops.rearrange

More flexible and powerful wrapper over einops.rearrange. It is also more verbose.