CartesianProductBin

class remu.binning.CartesianProductBin(binnings, data_indices, **kwargs)[source]

Bases: remu.binning.Bin

A Bin that is part of a CartesianProductBinning.

An event is part of a bin, if it has the right data indices in the constituent binnings.

Parameters
binningsiterable of Binning
data_indicesiterable of int

Specifies the constituent binnings and the respective data indices.

**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

binnings

(tuple of Binning)

data_indices

(tuple of int) Specifies the constituent binnings and the respective data indices.

Methods

clone(**kwargs)

Create a functioning copy of the Bin.

event_in_bin(event)

Check whether an event is within the bin.

fill([weight])

Add the weight(s) to the bin.

from_yaml(loader, node)

Convert a representation node to a Python object.

get_marginal_bins()

Return the corresponding bins on the input binnings of the cartesian product.

get_marginal_subbins()

Return the corresponding subbins on the input binnings of the cartesian product.

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 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)

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_marginal_bins()[source]

Return the corresponding bins on the input binnings of the cartesian product.

Returns
(bin_1, bin_2[, bin_3 …])
get_marginal_subbins()[source]

Return the corresponding subbins on the input binnings of the cartesian product.

This will return a tuple of tuples of subbins. One tuple for each input binning.

Returns
((bin_1, [subbin_1a …]), (bin_2, [subbin_2a …]) [, (bin_3, [subbin_3a …]) …])
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