histcmp 0.6.8__py3-none-any.whl → 0.8.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.
histcmp/checks.py CHANGED
@@ -41,23 +41,18 @@ class Status(Enum):
41
41
  return icons.failure
42
42
 
43
43
 
44
- ROOT.gInterpreter.Declare(
45
44
  """
46
- auto MyChi2Test(const TH1* a, const TH1* b, Option_t* option){
47
- Double_t chi2 = 0;
48
- Int_t ndf = 0, igood = 0;
49
- Double_t* res = 0;
50
-
51
- Double_t prob = a->Chi2TestX(b,chi2,ndf,igood,option,res);
52
-
53
- return std::make_tuple(prob, chi2, ndf, igood);
54
- }
55
- """
56
- )
57
45
 
58
46
 
59
47
  chi2result = collections.namedtuple("chi2result", ["prob", "chi2", "ndf", "igood"])
60
48
 
49
+ def chi2TestX(h1, h2, option="UU"):
50
+ root_chi2 = ctypes.c_double(0)
51
+ root_ndf = ctypes.c_int(0)
52
+ root_igood = ctypes.c_int(0)
53
+ res = ctypes.POINTER(ctypes.c_double)()
54
+ root_prob = h1.Chi2TestX(h2, root_chi2, root_ndf, root_igood, option, res)
55
+ return chi2result(root_prob, root_chi2.value, root_ndf.value, root_igood.value)
61
56
 
62
57
  class CompatCheck(ABC):
63
58
  def __init__(self, disabled: bool = False, suffix: Optional[str] = None):
@@ -225,9 +220,7 @@ class Chi2Test(ScoreThresholdCheck):
225
220
  @functools.cached_property
226
221
  def _result_v(self):
227
222
  with push_root_level(ROOT.kWarning):
228
-
229
- t = ROOT.MyChi2Test(self.item_a, self.item_b, "UUOFUF")
230
- res = chi2result(get[0](t), get[1](t), get[2](t), get[3](t))
223
+ res = chi2TestX(self.item_a, self.item_b, "UUOFUF")
231
224
  return res
232
225
 
233
226
  @property
histcmp/cli.py CHANGED
@@ -1,5 +1,5 @@
1
1
  from pathlib import Path
2
- from typing import Optional
2
+ from typing import Optional, Annotated
3
3
 
4
4
  import typer
5
5
  from rich.panel import Panel
@@ -24,18 +24,78 @@ app = typer.Typer()
24
24
 
25
25
  @app.command()
26
26
  def main(
27
- config_path: Path = typer.Option(
28
- None, "--config", "-c", dir_okay=False, exists=True
29
- ),
30
- monitored: Path = typer.Argument(..., exists=True, dir_okay=False),
31
- reference: Path = typer.Argument(..., exists=True, dir_okay=False),
32
- output: Optional[Path] = typer.Option(None, "-o", "--output", dir_okay=False),
33
- plots: Optional[Path] = typer.Option(None, "-p", "--plots", file_okay=False),
34
- label_monitored: Optional[str] = "monitored",
35
- label_reference: Optional[str] = "reference",
36
- title: str = "Histogram comparison",
37
- _filter: str = typer.Option(".*", "-f", "--filter"),
38
- format: str = "pdf",
27
+ monitored: Annotated[
28
+ Path,
29
+ typer.Argument(
30
+ exists=True,
31
+ dir_okay=False,
32
+ help="Path to the monitored histogram file"
33
+ )
34
+ ],
35
+ reference: Annotated[
36
+ Path,
37
+ typer.Argument(
38
+ exists=True,
39
+ dir_okay=False,
40
+ help="Path to the reference histogram file"
41
+ )
42
+ ],
43
+ config_path: Annotated[
44
+ Optional[Path],
45
+ typer.Option(
46
+ "--config", "-c",
47
+ dir_okay=False,
48
+ exists=True,
49
+ help="Path to configuration file"
50
+ )
51
+ ] = None,
52
+ output: Annotated[
53
+ Optional[Path],
54
+ typer.Option(
55
+ "-o", "--output",
56
+ dir_okay=False,
57
+ help="Path to output report file"
58
+ )
59
+ ] = None,
60
+ plots: Annotated[
61
+ Optional[Path],
62
+ typer.Option(
63
+ "-p", "--plots",
64
+ file_okay=False,
65
+ help="Directory to save comparison plots"
66
+ )
67
+ ] = None,
68
+ label_monitored: Annotated[
69
+ str,
70
+ typer.Option(
71
+ help="Label for the monitored dataset in plots and reports"
72
+ )
73
+ ] = "monitored",
74
+ label_reference: Annotated[
75
+ str,
76
+ typer.Option(
77
+ help="Label for the reference dataset in plots and reports"
78
+ )
79
+ ] = "reference",
80
+ title: Annotated[
81
+ str,
82
+ typer.Option(
83
+ help="Title for the comparison report"
84
+ )
85
+ ] = "Histogram comparison",
86
+ _filter: Annotated[
87
+ str,
88
+ typer.Option(
89
+ "-f", "--filter",
90
+ help="Regex filter pattern for histogram selection or path to a file with filters"
91
+ )
92
+ ] = ".*",
93
+ format: Annotated[
94
+ str,
95
+ typer.Option(
96
+ help="Output format for plots (pdf, png, etc.)"
97
+ )
98
+ ] = "pdf",
39
99
  ):
40
100
  try:
41
101
  import ROOT
histcmp/config.py CHANGED
@@ -4,8 +4,7 @@ import pydantic
4
4
 
5
5
 
6
6
  class BaseModel(pydantic.BaseModel):
7
- class Config:
8
- extra = "forbid"
7
+ model_config = pydantic.ConfigDict(extra="forbid")
9
8
 
10
9
 
11
10
  # class CheckList(BaseModel):
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.4
2
+ Name: histcmp
3
+ Version: 0.8.0
4
+ Summary: Compare histograms
5
+ Author-email: Paul Gessinger <hello@paulgessinger.com>
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.10
8
+ Requires-Dist: hist[plot]>=2.8.0
9
+ Requires-Dist: jinja2>=3.1.4
10
+ Requires-Dist: matplotlib>=3.9.2
11
+ Requires-Dist: mplhep>=0.3.55
12
+ Requires-Dist: numpy>=2.1.3
13
+ Requires-Dist: pydantic>=2.10.1
14
+ Requires-Dist: pyyaml>=6.0.2
15
+ Requires-Dist: rich>=13.9.4
16
+ Requires-Dist: scipy>=1.14.1
17
+ Requires-Dist: typer>=0.13.1
@@ -1,8 +1,8 @@
1
1
  histcmp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- histcmp/checks.py,sha256=YspaeDDgX-Bij5C-OTks9OXeLkiEW0loA1XVyDjQMQo,13702
3
- histcmp/cli.py,sha256=cxLAfxEYe_6_StPgEU0X8BmplDyGYNf27mBzJNHY-LE,6167
2
+ histcmp/checks.py,sha256=txvxg4vOk6OBJM0NSvcxUsALUGs9aRKQQ8a_y5LKnXw,13680
3
+ histcmp/cli.py,sha256=00NS8ko-oS5tpnuKEIFNnlUTL_abLzEEPoLRpp_zEe0,7405
4
4
  histcmp/compare.py,sha256=hRGyNAyENqDGYtPZ0Iq8o4uGNW7m_29ovscP8_wxfqI,10662
5
- histcmp/config.py,sha256=50_qpBba9WdINF7wVH4WnXuPW1b_q02f89b2J9Pu_Zk,500
5
+ histcmp/config.py,sha256=Ml0DkWU_983cdn5k_fXI2J3br1xlmkf2j794R5FlEd0,512
6
6
  histcmp/console.py,sha256=fmJMQEAiRTUD5TkjaDH4ZkInnILl1MPqVPtN_SjCr_M,726
7
7
  histcmp/github.py,sha256=RyVGvH11FEzFyEFTZMfqqP-5YQb7OrNQmgQ0nJPIapQ,186
8
8
  histcmp/icons.py,sha256=EAPco9IQJgYXfdDW9eoqySnrnqXJAcyrk3XrQowfZMU,117
@@ -11,16 +11,16 @@ histcmp/report.py,sha256=lTPylmzvda0y_NSZlESQiZPFpOgt8-sKiTYlwuQe2eQ,3773
11
11
  histcmp/root_helpers.py,sha256=9SWKW9gJIXUGRqJwjSMaLw5fgz_0eRtdqDpyt-z1wRQ,5794
12
12
  histcmp/static/alpinejs.intersect.min.js,sha256=VO1OjUyzsV_A9We8L7z25QSZtNou6pqwQdxv60zx0a8,878
13
13
  histcmp/static/alpinejs.min.js,sha256=dLOU6xKqXTxXXqFyJS66bCIJ2DQ3ku8mHv6if1je4WM,37696
14
+ histcmp/static/css/main.css,sha256=1ZDflGFMNvsFkf4pSDFYFQ-Ob90i4ahOV0YNXvJUL40,315
14
15
  histcmp/static/css/bulma/bulma-rtl.css,sha256=TUHS7Sxzy8yNpSvZw_kemcmvnax3Js9PHq1cPdo7i7U,244777
15
16
  histcmp/static/css/bulma/bulma-rtl.css.map,sha256=jrQYx00fN25Pxm81v1gPZtcutWE2KvnijIX5nR_V9uc,98265
16
17
  histcmp/static/css/bulma/bulma-rtl.min.css,sha256=LchhQrhf3t9LP_bBuIq1SvOWEIiX8bpgQedoeytbSV0,206763
17
18
  histcmp/static/css/bulma/bulma.css,sha256=QWzsjhiaNlONAp479EIeaY-tQvrt3v1iOYtBMVZ7RJc,244630
18
19
  histcmp/static/css/bulma/bulma.css.map,sha256=039vv4Mje70ZS33gGww4tRQgCnEKI2C87RydZz8KHig,98250
19
20
  histcmp/static/css/bulma/bulma.min.css,sha256=UDtbUHqpVVfXmdJcQVU_bfDEr9xldf3Dbd0ShD0Uf_Y,206620
20
- histcmp/static/css/main.css,sha256=1ZDflGFMNvsFkf4pSDFYFQ-Ob90i4ahOV0YNXvJUL40,315
21
21
  histcmp/templates/base.html.j2,sha256=wz23ttE1NG4zshuC-aYp8DUsVUkHjkwRzfJHC3A0rkg,2088
22
22
  histcmp/templates/main.html.j2,sha256=1if-d2iZs7pZJz2NJzpSjh4jZY1v_PGz3gvA0i4ccxI,2399
23
- histcmp-0.6.8.dist-info/METADATA,sha256=k5a9mk6PPA_B8WnSP-eqG6JcmnjzhyGPc6X4eBYwa8Q,1015
24
- histcmp-0.6.8.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
25
- histcmp-0.6.8.dist-info/entry_points.txt,sha256=zK4mzX2VpqdjZVEDpOJJ3Na2ePGRBz-9x5knQx_EaoI,43
26
- histcmp-0.6.8.dist-info/RECORD,,
23
+ histcmp-0.8.0.dist-info/METADATA,sha256=MrMCdI-spBlQRzL0-lhxX8fl9EigtGqCEheeFZ6BtWQ,482
24
+ histcmp-0.8.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
25
+ histcmp-0.8.0.dist-info/entry_points.txt,sha256=FWonuHbW2m7wdqkj2ISHGSGzLD59zo-7P0pBsR8yTTc,44
26
+ histcmp-0.8.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.0
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ histcmp = histcmp.cli:app
@@ -1,28 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: histcmp
3
- Version: 0.6.8
4
- Summary:
5
- License: MIT
6
- Author: Paul Gessinger
7
- Author-email: hello@paulgessinger.com
8
- Requires-Python: >=3.9
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.9
12
- Classifier: Programming Language :: Python :: 3.10
13
- Classifier: Programming Language :: Python :: 3.11
14
- Classifier: Programming Language :: Python :: 3.12
15
- Requires-Dist: Jinja2 (>=3.0.3,<4.0.0)
16
- Requires-Dist: PyYAML (>=6.0,<7.0)
17
- Requires-Dist: click (>=8.1.4,<9.0.0)
18
- Requires-Dist: hist[plot] (>=2.6.0,<3.0.0)
19
- Requires-Dist: matplotlib (>=3.5.1,<4.0.0)
20
- Requires-Dist: mplhep (>=0.3.26,<0.4.0)
21
- Requires-Dist: numpy (>=1.25.0,<2.0.0)
22
- Requires-Dist: pandas (>=2.0.3,<3.0.0)
23
- Requires-Dist: pydantic (>=2.0.0,<3.0.0)
24
- Requires-Dist: requests (>=2.27.1,<3.0.0)
25
- Requires-Dist: rich (>=13.4.2,<14.0.0)
26
- Requires-Dist: scipy (>=1.9.1,<2.0.0)
27
- Requires-Dist: typer (>=0.9.0,<0.10.0)
28
- Requires-Dist: wasabi (>=0.9.0,<0.10.0)
@@ -1,3 +0,0 @@
1
- [console_scripts]
2
- histcmp=histcmp.cli:app
3
-