yaw.core.math.shift_histogram#

yaw.core.math.shift_histogram(bins: ndarray[Any, dtype[_ScalarType_co]], counts: ndarray[Any, dtype[_ScalarType_co]], *, A: float = 1.0, dx: float = 0.0) ndarray[Any, dtype[_ScalarType_co]][source]#

Shift a histogram by a fixed value.

The histogram values are recomputed for new bin edges that are shifted by the desired amount using rebin(). The normalisation of the histogram may change if the shifted binning does not cover the full range of the data.

Parameters:
  • bins (NDArray) – The bin edges from which the counts were computed.

  • counts_old (NDArray) – The histogram counts.

Keyword Arguments:
  • A (float, optional) – Scalar amplitude used to rescale the new histgram counts.

  • dx (float, optional) – Amount by which the histogram (i.e. the bin edges) are shifted.

Returns:

The shifted histogram counts.

Return type:

NDArray