RectangularBin

class remu.binning.RectangularBin(variables, edges, include_lower=True, include_upper=False, **kwargs)[source]

Bases: remu.binning.Bin

A Bin defined by min and max values in all variables.

Parameters
variablesiterable of str

The variables with defined edges.

edgesiterable of (int, int)

lower and upper edges for all variables:

[[x_lower, x_upper], [y_lower, y_upper], ...]
include_lowerbool, optional

Does the bin include the lower edges?

include_upperbool, optional

Does the bin include the upper edges?

**kwargsoptional

Additional keyword arguments are passed to Bin.

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

variables

(tuple of str) The variable names.

edges

(tuple of (int, int)) The bin edges for each variable.

include_lower

(bool) Does the bin include the lower edges?

include_upper

(bool) Does the bin include the upper edges?

Methods

clone(**kwargs)

Create a functioning copy of the Bin.

event_in_bin(event)

Check whether an event is within all bin edges.

fill([weight])

Add the weight(s) to the bin.

from_yaml(loader, node)

Convert a representation node to a Python object.

get_center()

Return the bin center coordinates.

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)

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 an event is within all bin edges.

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)

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)

Convert a representation node to a Python object.

get_center()[source]

Return the bin center coordinates.

Returns
ndarray

The center coordinates for each variable.

is_dummy()

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)

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