General helper functions

Small helper and utilities functions that don’t fit anywhere else.

spectrumkit.lib.util.bin(a: ndarray, bins: ndarray) ndarray[source]

Average array values in bins for easier plotting.

Parameters:
  • a (numpy.ndarray) – The input array to be averaged.

  • bins (numpy.ndarray) – The array containing the indices where each bin begins.

Returns:

The averaged array values.

Return type:

numpy.ndarray

Notes

The “bins” array should contain the INDEX (integer) where each bin begins.