eelbrain.NDVar.bin

NDVar.bin(step=None, start=None, stop=None, func=None, dim=None, name=None, nbins=None, label='center')

Bin the data along a given dimension (default 'time')

Parameters
  • step (scalar) – Time step between bins.

  • start (None | scalar) – Earliest time point (default is from the beginning).

  • stop (None | scalar) – End of the data to use (the default is to use as many whole tstep intervals as fit in the data).

  • func (callable | str) – How to summarize data in each time bin. Can be the name of a numpy function that takes an axis parameter (e.g., ‘sum’, ‘mean’, ‘max’) or ‘extrema’ which selects the value with the maximum absolute value. The default depends on ndvar.info['meas']: ‘p’: minimum; ‘f’: maximum; ‘t’, ‘r’: extrema; otherwise: mean.

  • dim (str) – Dimension over which to bin. If the NDVar has more than one dimension, the default is 'time'.

  • name (str) – Name of the output NDVar (default is the current name).

  • nbins (int) – Instead of specifying step, nbins can be specified to divide dim into an even number of bins.

  • label ('start' | 'center') – How to assign labels to the new bins. For example, with dim='time', the new time axis can assign to each bin either the center or the start time of the bin on the original time axis.

Returns

binned_ndvar – NDVar with data binned along the time axis (i.e., each time point reflects one time bin).

Return type

NDVar