BinnedData#

class zfit.data.BinnedData(*args, **kwds)[source]#

Bases: zfit.core.interfaces.ZfitBinnedData

classmethod from_tensor(space, values, variances=None)[source]#

Create a binned dataset defined in space where values are considered to be the counts.

Parameters
  • space (ZfitSpace) – The space of the data. Variables need to match the values dimensions. The space has to be binned and carry the information about the edges.

  • values (znp.array) – Actual counts of the histogram.

  • variances (znp.array | None) – Uncertainties of the histogram values. If True, the uncertainties are taken to be poissonian distributed.

Return type

BinnedData

classmethod from_hist(hist)[source]#

Create a binned dataset from a hist histogram.

Parameters

hist (NamedHist) – A NamedHist. The axes will be used as the binning in zfit.

Return type

BinnedData

with_obs(obs)[source]#

Return a subset of the data in the ordering of obs.

Parameters

obs (Union[str, Iterable[str], Space]) – Which obs to return

Return type

BinnedData

to_hist()[source]#

Convert the binned data to a NamedHist.

While a binned data object can be used inside zfit (PDFs,…), it lacks many convenience features that the hist library offers, such as plots.

Return type

NamedHist

values()[source]#

Values of the histogram as an ndim array.

Compared to hist, zfit does not make a difference between a view and a copy; tensors are immutable. This distinction is made in the traced function by the compilation backend.

Return type

array

Returns

Tensor of shape (nbins0, nbins1, …) with nbins the number of bins in each observable.

variances()[source]#

Variances, if available, of the histogram as an ndim array.

Compared to hist, zfit does not make a difference between a view and a copy; tensors are immutable. This distinction is made in the traced function by the compilation backend.

Return type

None | znp.array

Returns

Tensor of shape (nbins0, nbins1, …) with nbins the number of bins in each observable.

counts()[source]#

Effective counts of the histogram as an ndim array.

Compared to hist, zfit does not make a difference between a view and a copy; tensors are immutable. This distinction is made in the traced function by the compilation backend.

Returns

Tensor of shape (nbins0, nbins1, …) with nbins the number of bins in each observable.