ewoksxas.converters.resample.resample_to_common_grid#

ewoksxas.converters.resample.resample_to_common_grid(x_list, y_list, mode=Alignment.INTERPOLATION)[source]#

Resample ragged (x, y) spectra onto one shared x grid.

Args:

x_list: Per-spectrum 1D x arrays (may differ in length). y_list: Per-spectrum 1D y arrays, each paired with x_list. mode: Alignment.INTERPOLATION (default) linearly interpolates

each spectrum onto a grid spanning the overlap of all ranges, so no extrapolation and no NaN. Alignment.REBINNING bins each spectrum onto a grid spanning the union of all ranges, leaving bins with no data for a given spectrum as NaN.

Returns:

(common_x, Y) with Y of shape (len(x_list), common_x.size).

Raises:

ValueError: If x_list is empty or lengths of the two lists differ.

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

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

  • mode (Alignment | str)

Return type:

tuple[ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]]]