Bin

class remu.binning.Bin(**kwargs)[source]

A Bin is a container for a value that is defined on a subset of an n-dimensional phase space.

Parameters:
phasespace : PhaseSpace

The PhaseSpace the Bin resides in.

value : float, optional

The initialization value of the bin. Default: 0.0

entries : int, optional

The initialization value of the number of entries. Default: 0

sumw2 : float, optional

The initialization value of the sum of squared weights. Default: value**2

value_array : slice of ndarray, optional

A slice of a numpy array, where the value of the bin will be stored. Default: None

entries_array : slice of ndarray, optional

A slice of a numpy array, where the number entries will be stored. Default: None

sumw2_array : slice of ndarray, optional

A slice of a numpy array, where the squared weights will be stored. Default: None

entries

The number of entries in the bin.

event_in_bin(event)[source]

Check whether the variable combination falls within the bin.

Parameters:
event : dict like

A dictionary (or similar object) with one value of each variable in the binning, e.g.:

{'x': 1.4, 'y': -7.47}
Returns:
bool

Whether or not the variable combination lies within the bin.

fill(weight=1.0)[source]

Add the weight(s) to the bin.

Also increases the number of entries and sum of squared weights accordingly.

Parameters:
weight : float or iterable of floats, optional

Weight(s) to be added to the value of the bin.

sumw2

The sum of squared weights in the bin.

value

The value of the bin.

The sum of weights.