Skip to content
Snippets Groups Projects
Verified Commit cdc044dc authored by Frank Sauerburger's avatar Frank Sauerburger
Browse files

Add Coffea integration

parent 7089c901
Branches 58-allow-yaml-files-in-cli-2
Tags 0.4.0
No related merge requests found
Pipeline #3278049 passed
......@@ -46,6 +46,34 @@ The FreeForestML also has a `dedicated example Notebook
<https://freeforestml.readthedocs.io/en/latest/UHepp.html>`_ to illustrate the
uhepp integration.
Coffea
------
The helper method :code:`uhepp.from_coffea()` takes a `Coffea
<https://coffeateam.github.io/coffea/index.html>`_ histogram as input and
converts it into uhepp histogram objects.
.. code-block:: python
import numpy as np
import coffea.hist as hist
import uhepp
# https://coffeateam.github.io/coffea/notebooks/histograms.html
chist = hist.Hist("Counts",
hist.Cat("sample", "sample name"),
hist.Bin("x", "x value", 20, -10, 10),
hist.Bin("y", "y value", 20, -10, 10),
hist.Bin("z", "z value", 20, -10, 10),
)
xyz = np.random.multivariate_normal(mean=[1, 3, 7], cov=np.eye(3), size=10000)
chist.fill(sample="sample 1", x=xyz[:,0], y=xyz[:,1], z=xyz[:,2])
(hx, hy, hz), samples = uhepp.from_coffea(chist)
Latex
-----
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment