rootfig 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rootfig/__init__.py +97 -0
- rootfig/_typing.py +21 -0
- rootfig/api.py +1297 -0
- rootfig/errors.py +73 -0
- rootfig/expressions/__init__.py +34 -0
- rootfig/expressions/functions.py +151 -0
- rootfig/expressions/parser.py +462 -0
- rootfig/histograms/__init__.py +67 -0
- rootfig/histograms/build.py +197 -0
- rootfig/histograms/cutflow.py +195 -0
- rootfig/histograms/efficiency.py +214 -0
- rootfig/histograms/normalize.py +124 -0
- rootfig/histograms/pipeline.py +186 -0
- rootfig/histograms/ratio.py +161 -0
- rootfig/histograms/stats.py +183 -0
- rootfig/io/__init__.py +12 -0
- rootfig/io/sources.py +487 -0
- rootfig/model/__init__.py +27 -0
- rootfig/model/binning.py +237 -0
- rootfig/model/cuts.py +85 -0
- rootfig/model/samples.py +284 -0
- rootfig/model/style.py +144 -0
- rootfig/model/units.py +107 -0
- rootfig/model/variables.py +95 -0
- rootfig/plotting/__init__.py +78 -0
- rootfig/plotting/annotations.py +165 -0
- rootfig/plotting/correlation.py +93 -0
- rootfig/plotting/figure.py +458 -0
- rootfig/plotting/hist1d.py +421 -0
- rootfig/plotting/hist2d.py +59 -0
- rootfig/plotting/points.py +78 -0
- rootfig/plotting/ratio.py +163 -0
- rootfig/plotting/result.py +131 -0
- rootfig/plotting/style.py +308 -0
- rootfig/py.typed +0 -0
- rootfig/selection/__init__.py +23 -0
- rootfig/selection/columns.py +479 -0
- rootfig-0.1.0.dist-info/METADATA +202 -0
- rootfig-0.1.0.dist-info/RECORD +41 -0
- rootfig-0.1.0.dist-info/WHEEL +4 -0
- rootfig-0.1.0.dist-info/licenses/LICENSE +21 -0
rootfig/__init__.py
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"""rootfig: publication-quality histograms straight from ROOT trees, without ROOT.
|
|
2
|
+
|
|
3
|
+
The quick path::
|
|
4
|
+
|
|
5
|
+
import rootfig as rf
|
|
6
|
+
|
|
7
|
+
rf.plot("events.root", "Muon_pt", tree="events", selection="Muon_pt > 20", bins=50)
|
|
8
|
+
|
|
9
|
+
The composable path uses :class:`Sample`, :class:`Variable`, :class:`Cut` and
|
|
10
|
+
:class:`Style` objects with the same :func:`plot` function. Lower layers are
|
|
11
|
+
exposed as sub-packages: :mod:`rootfig.io`, :mod:`rootfig.expressions`,
|
|
12
|
+
:mod:`rootfig.selection`, :mod:`rootfig.histograms`, :mod:`rootfig.plotting`.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from rootfig.api import (
|
|
16
|
+
SummaryTable,
|
|
17
|
+
correlation,
|
|
18
|
+
cutflow,
|
|
19
|
+
efficiency,
|
|
20
|
+
histogram,
|
|
21
|
+
histograms,
|
|
22
|
+
load,
|
|
23
|
+
plot,
|
|
24
|
+
plot2d,
|
|
25
|
+
plot_histograms,
|
|
26
|
+
profile,
|
|
27
|
+
summarize,
|
|
28
|
+
)
|
|
29
|
+
from rootfig.errors import (
|
|
30
|
+
BinningError,
|
|
31
|
+
ExpressionError,
|
|
32
|
+
IncompatibleWeightError,
|
|
33
|
+
LuminosityError,
|
|
34
|
+
MissingBranchError,
|
|
35
|
+
RootfigError,
|
|
36
|
+
RootfigWarning,
|
|
37
|
+
SelectionError,
|
|
38
|
+
SourceError,
|
|
39
|
+
)
|
|
40
|
+
from rootfig.expressions import evaluate
|
|
41
|
+
from rootfig.histograms import (
|
|
42
|
+
Cutflow,
|
|
43
|
+
CutflowTable,
|
|
44
|
+
Efficiency,
|
|
45
|
+
Histogram,
|
|
46
|
+
Profile,
|
|
47
|
+
Ratio,
|
|
48
|
+
Summary,
|
|
49
|
+
ratio,
|
|
50
|
+
significance,
|
|
51
|
+
)
|
|
52
|
+
from rootfig.model import Cut, Sample, Style, Variable, log_bins
|
|
53
|
+
from rootfig.plotting import Plot, use_style
|
|
54
|
+
|
|
55
|
+
__version__ = "0.1.0"
|
|
56
|
+
|
|
57
|
+
__all__ = [
|
|
58
|
+
"BinningError",
|
|
59
|
+
"Cut",
|
|
60
|
+
"Cutflow",
|
|
61
|
+
"CutflowTable",
|
|
62
|
+
"Efficiency",
|
|
63
|
+
"ExpressionError",
|
|
64
|
+
"Histogram",
|
|
65
|
+
"IncompatibleWeightError",
|
|
66
|
+
"LuminosityError",
|
|
67
|
+
"MissingBranchError",
|
|
68
|
+
"Plot",
|
|
69
|
+
"Profile",
|
|
70
|
+
"Ratio",
|
|
71
|
+
"RootfigError",
|
|
72
|
+
"RootfigWarning",
|
|
73
|
+
"Sample",
|
|
74
|
+
"SelectionError",
|
|
75
|
+
"SourceError",
|
|
76
|
+
"Style",
|
|
77
|
+
"Summary",
|
|
78
|
+
"SummaryTable",
|
|
79
|
+
"Variable",
|
|
80
|
+
"__version__",
|
|
81
|
+
"correlation",
|
|
82
|
+
"cutflow",
|
|
83
|
+
"efficiency",
|
|
84
|
+
"evaluate",
|
|
85
|
+
"histogram",
|
|
86
|
+
"histograms",
|
|
87
|
+
"load",
|
|
88
|
+
"log_bins",
|
|
89
|
+
"plot",
|
|
90
|
+
"plot2d",
|
|
91
|
+
"plot_histograms",
|
|
92
|
+
"profile",
|
|
93
|
+
"ratio",
|
|
94
|
+
"significance",
|
|
95
|
+
"summarize",
|
|
96
|
+
"use_style",
|
|
97
|
+
]
|
rootfig/_typing.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Shared type aliases."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TYPE_CHECKING, Any, TypeAlias
|
|
6
|
+
|
|
7
|
+
import hist
|
|
8
|
+
import numpy as np
|
|
9
|
+
import numpy.typing as npt
|
|
10
|
+
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
Hist: TypeAlias = hist.Hist[Any]
|
|
13
|
+
"""A ``hist.Hist`` with any storage (``Weight`` in everything rootfig produces)."""
|
|
14
|
+
else:
|
|
15
|
+
Hist = hist.Hist
|
|
16
|
+
|
|
17
|
+
FloatArray: TypeAlias = npt.NDArray[np.float64]
|
|
18
|
+
"""A one-dimensional float array."""
|
|
19
|
+
|
|
20
|
+
AnyArray: TypeAlias = npt.NDArray[Any]
|
|
21
|
+
"""A NumPy array of any dtype."""
|