ewoksxas.converters.larch.create_groups#

ewoksxas.converters.larch.create_groups(x, y, mode='energy', **kwargs)[source]#

Create one Larch group per spectrum from paired x and y arrays.

Three input shapes are accepted:

  1. Both x and y are 1D with the same length: produces a single group.

  2. When x is 1D and y is 2D: one group is created per row of y, all sharing the same x.

  3. Both x and y are 2D with the same shape: rows are paired positionally, producing one group per row.

The group attribute names are determined by mode.

Args:

x: 1D array shared across all groups, or 2D array with one row per group. y: 1D array for a single group, or 2D array with one row per group. mode: Selects the x/y attribute names written to each group. kwargs: Additional attributes passed unchanged to every group.

Raises:

TypeError: If x or y is not a NumPy array. ValueError: If mode is invalid or the shapes of x and y are incompatible.

Parameters:
  • x (ndarray[tuple[int, ...], dtype[float64]])

  • y (ndarray[tuple[int, ...], dtype[float64]])

  • mode (str)

Return type:

list[Group]