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
phasespacePhaseSpace

The PhaseSpace the Bin resides in.

valuefloat, optional

The initialization value of the bin. Default: 0.0

entriesint, optional

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

sumw2float, optional

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

value_arrayslice of ndarray, optional

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

entries_arrayslice of ndarray, optional

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

sumw2_arrayslice of ndarray, optional

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

dummybool, optional

Do not create a any arrays to store the data. Default: False

Attributes

value

(float) The value of the bin.

entries

(int) The number of entries in the bin.

sumw2

(float) The sum of squared weights in the bin.

phasespace

(PhaseSpace) The PhaseSpace the bin is defined on

Methods

clone(**kwargs)

Create a functioning copy of the Bin.

event_in_bin(event)

Check whether the variable combination falls within the bin.

fill([weight])

Add the weight(s) to the bin.

from_yaml(loader, node)

Convert a representation node to a Python object.

is_dummy()

Return True if there is no data array linked to this bin.

to_yaml(dumper, obj)

Convert a Python object to a representation node.

yaml_dumper

yaml_loader

clone(**kwargs)[source]

Create a functioning copy of the Bin.

Can specify additional kwargs for the initialisation of the new Binning.

property entries

(int) The number of entries in the bin.

event_in_bin(event)[source]

Check whether the variable combination falls within the bin.

Parameters
eventdict 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
weightfloat or iterable of floats, optional

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

classmethod from_yaml(loader, node)[source]

Convert a representation node to a Python object.

is_dummy()[source]

Return True if there is no data array linked to this bin.

property sumw2

(float) The sum of squared weights in the bin.

classmethod to_yaml(dumper, obj)[source]

Convert a Python object to a representation node.

property value

(float) The value of the bin.

The sum of weights.

yaml_loader

alias of yaml.loader.FullLoader