shnitsel.core.postprocess.subtract_combinations

subtract_combinations(da, dim, labels=False)

Calculate all possible pairwise differences over a given dimension

Parameters:
  • da (DataArray) – Input DataArray; must contain dimension dim

  • dim (Hashable) – Dimension (of size $n$) to take pairwise differences over

  • labels (bool) – If True, label the pairwise differences based on the index of dim, by default False

  • optional – If True, label the pairwise differences based on the index of dim, by default False

Return type:

A DataArray with the dimension dim replaced by a dimension ‘`dim`comb’ of size $n(n-1)/2$