Data.bin

Data.bin(xcol=None, ycol=None, bins=0.03, mode='log', clone=True, **kargs)

Bin x-y data into new values of x with an error bar.

Parameters:
  • xcol (index) – Index of column of data with X values

  • ycol (index) – Index of column of data with Y values

  • bins (int, float or 1d array) – Number of bins (if integer) or size of bins (if float), or bin edges (if array)

  • mode (string) – “log” or “lin” for logarithmic or linear binning

Keyword Arguments:
  • yerr (index) – Column with y-error data if present.

  • bin_start (float) – Manually override the minimum bin value

  • bin_stop (float) – Manually override the maximum bin value

  • clone (bool) – Return a clone of the current AnalysisMixin with binned data (True) or just the numbers (False).

Returns:

(Stoner.Data or tuple of 4 array-like) – Either a clone of the current data set with the new binned data or tuple of (bin centres, bin values, bin errors, number points/bin), depending on the clone parameter.

Note

Algorithm inspired by MatLab code wbin, Copyright (c) 2012: Michael Lindholm Nielsen

See also

User Guide section (Re)Binning Data