histcmp 0.7.0__py3-none-any.whl → 0.8.1__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,16 @@ class Status(Enum):
41
41
  return icons.failure
42
42
 
43
43
 
44
- ROOT.gInterpreter.Declare(
45
- """
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
-
58
44
 
59
45
  chi2result = collections.namedtuple("chi2result", ["prob", "chi2", "ndf", "igood"])
60
46
 
47
+ def chi2TestX(h1, h2, option="UU"):
48
+ root_chi2 = ctypes.c_double(0)
49
+ root_ndf = ctypes.c_int(0)
50
+ root_igood = ctypes.c_int(0)
51
+ res = ctypes.POINTER(ctypes.c_double)()
52
+ root_prob = h1.Chi2TestX(h2, root_chi2, root_ndf, root_igood, option, res)
53
+ return chi2result(root_prob, root_chi2.value, root_ndf.value, root_igood.value)
61
54
 
62
55
  class CompatCheck(ABC):
63
56
  def __init__(self, disabled: bool = False, suffix: Optional[str] = None):
@@ -225,9 +218,7 @@ class Chi2Test(ScoreThresholdCheck):
225
218
  @functools.cached_property
226
219
  def _result_v(self):
227
220
  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))
221
+ res = chi2TestX(self.item_a, self.item_b, "UUOFUF")
231
222
  return res
232
223
 
233
224
  @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):
@@ -1,9 +1,9 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: histcmp
3
- Version: 0.7.0
3
+ Version: 0.8.1
4
4
  Summary: Compare histograms
5
5
  Author-email: Paul Gessinger <hello@paulgessinger.com>
6
- License: MIT
6
+ License-Expression: MIT
7
7
  Requires-Python: >=3.10
8
8
  Requires-Dist: hist[plot]>=2.8.0
9
9
  Requires-Dist: jinja2>=3.1.4
@@ -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=YImyh_wiXGx8F34Eck3i37TmvhYqt2OaZq8s91460_0,13671
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
@@ -20,7 +20,7 @@ histcmp/static/css/bulma/bulma.css.map,sha256=039vv4Mje70ZS33gGww4tRQgCnEKI2C87R
20
20
  histcmp/static/css/bulma/bulma.min.css,sha256=UDtbUHqpVVfXmdJcQVU_bfDEr9xldf3Dbd0ShD0Uf_Y,206620
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.7.0.dist-info/METADATA,sha256=jKoCtjpoU-85rjHTJuaY2JwexFFI25IIZaMUOCOfwUA,471
24
- histcmp-0.7.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
25
- histcmp-0.7.0.dist-info/entry_points.txt,sha256=FWonuHbW2m7wdqkj2ISHGSGzLD59zo-7P0pBsR8yTTc,44
26
- histcmp-0.7.0.dist-info/RECORD,,
23
+ histcmp-0.8.1.dist-info/METADATA,sha256=wg-cMxbkYDY-0ZnYWCZA8iXzDBalu6cPyctPJi9YqmQ,482
24
+ histcmp-0.8.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
25
+ histcmp-0.8.1.dist-info/entry_points.txt,sha256=FWonuHbW2m7wdqkj2ISHGSGzLD59zo-7P0pBsR8yTTc,44
26
+ histcmp-0.8.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.26.3
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any