nebius/SWE-bench-extra huggingface dataset:
Repository: scikit-hep/cabinetry

Issue:
Warnings about missing post-processed histograms
Warnings like

```
WARNING - cabinetry.histo - the modified histogram histograms/CR-Wy_RECAST_Signal_modified.npz does not exist
WARNING - cabinetry.histo - loading the un-modified histogram instead!
```

appear when `cabinetry.templates.postprocess(config)` is not called. The `WARNING` log level seems a bit high for this, it is really more of an information so should be updated accordingly.

cc @lukasheinrich for raising this (thanks!)

Comments:

Patch:
diff --git a/setup.py b/setup.py
index 4788201..fc7609e 100644
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,7 @@ extras_require["test"] = sorted(
             "mypy",
             "types-tabulate",
             "types-PyYAML",
-            "typeguard>=4.0.0,!=4.0.1,!=4.1.0,!=4.1.1",  # cabinetry#391, cabinetry#428
+            "typeguard>=4.0.0,!=4.0.1,!=4.1.*",  # cabinetry#391, cabinetry#428
             "black",
         ]
     )
diff --git a/src/cabinetry/histo.py b/src/cabinetry/histo.py
index 578591e..5a6d132 100644
--- a/src/cabinetry/histo.py
+++ b/src/cabinetry/histo.py
@@ -79,11 +79,10 @@ class Histogram(bh.Histogram, family=cabinetry):
         if modified:
             histo_path_modified = histo_path.parent / (histo_path.name + "_modified")
             if not histo_path_modified.with_suffix(".npz").exists():
-                log.warning(
-                    f"the modified histogram {histo_path_modified.with_suffix('.npz')} "
-                    "does not exist"
+                log.info(
+                    f"no modified histogram {histo_path_modified.with_suffix('.npz')} "
+                    "found, loading un-modified histogram"
                 )
-                log.warning("loading the un-modified histogram instead!")
             else:
                 histo_path = histo_path_modified
         histogram_npz = np.load(histo_path.with_suffix(".npz"))


Test patch:
diff --git a/tests/test_histo.py b/tests/test_histo.py
index a1e607f..71a5ea1 100644
--- a/tests/test_histo.py
+++ b/tests/test_histo.py
@@ -122,13 +122,11 @@ def test_Histogram_from_path(tmp_path, caplog, example_histograms, histogram_hel
 
     # try loading a modified one, without success since it does not exist
     h_from_path_modified = histo.Histogram.from_path(tmp_path, modified=True)
-    expected_warning = (
-        f"the modified histogram {str(tmp_path)}_modified.npz does not exist"
+    expected_info = (
+        f"no modified histogram {str(tmp_path)}_modified.npz found, "
+        "loading un-modified histogram"
     )
-    assert expected_warning in [rec.message for rec in caplog.records]
-    assert "loading the un-modified histogram instead!" in [
-        rec.message for rec in caplog.records
-    ]
+    assert expected_info in [rec.message for rec in caplog.records]
     caplog.clear()
 
     # successfully load a modified histogram
Repository: scikit-hep/hist

Issue:
[BUG] Integer axes counts as category for plot
The categorical plotting from #174 tried to trigger on integer axes and breaks.

Comments:

Patch:
diff --git a/src/hist/basehist.py b/src/hist/basehist.py
index a862c51..2158e49 100644
--- a/src/hist/basehist.py
+++ b/src/hist/basehist.py
@@ -343,7 +343,12 @@ class BaseHist(bh.Histogram, metaclass=MetaConstructor, family=hist):
         """
         Plot method for BaseHist object.
         """
-        _has_categorical = np.sum([ax.traits.discrete for ax in self.axes]) == 1
+        _has_categorical = 0
+        if (
+            np.sum(self.axes.traits.ordered) == 1
+            and np.sum(self.axes.traits.discrete) == 1
+        ):
+            _has_categorical = 1
         _project = _has_categorical or overlay is not None
         if self.ndim == 1 or (self.ndim == 2 and _project):
             return self.plot1d(*args, overlay=overlay, **kwargs)


Test patch:
diff --git a/tests/test_mock_plot.py b/tests/test_mock_plot.py
new file mode 100644
index 0000000..7407712
--- /dev/null
+++ b/tests/test_mock_plot.py
@@ -0,0 +1,41 @@
+import numpy as np
+import pytest
+
+from hist import Hist
+
+
+@pytest.fixture(autouse=True)
+def mock_test(monkeypatch):
+    monkeypatch.setattr(Hist, "plot1d", plot1d_mock)
+    monkeypatch.setattr(Hist, "plot2d", plot2d_mock)
+
+
+def plot1d_mock(*args, **kwargs):
+    return "called plot1d"
+
+
+def plot2d_mock(*args, **kwargs):
+    return "called plot2d"
+
+
+def test_categorical_plot():
+    testCat = (
+        Hist.new.StrCat("", name="dataset", growth=True)
+        .Reg(10, 0, 10, name="good", label="y-axis")
+        .Int64()
+    )
+
+    testCat.fill(dataset="A", good=np.random.normal(5, 9, 27))
+
+    assert testCat.plot() == "called plot1d"
+
+
+def test_integer_plot():
+    testInt = (
+        Hist.new.Int(1, 10, name="nice", label="x-axis")
+        .Reg(10, 0, 10, name="good", label="y-axis")
+        .Int64()
+    )
+    testInt.fill(nice=np.random.normal(5, 1, 10), good=np.random.normal(5, 1, 10))
+
+    assert testInt.plot() == "called plot2d"
Repository: scikit-hep/vector

Issue:
`q**2` is always positive for vector.MomentumObject4D
### Vector Version

1.3.1

### Python Version

3.11.4

### OS / Environment

Kubuntu 22.04
vector is installed via pip inside a conda environment

### Describe the bug

When calculating `q**2` of a 4-vector that is created from `vector.obj`, the value is always positive, even when it should not be:
```python
>>> vector.obj(E=1, px=1, py=1, pz=1)**2
2.0000000000000004
```
For numpy vector arrays, the behavior is correct and as expected:
```python
>>> vector.array({"E": [1], "px": [1], "py": [1], "pz": [1]})**2
array([-2.])
```
I have not tested other backends (e.g. awkward).

### Any additional but relevant log output

_No response_

Comments:

Patch:
diff --git a/src/vector/backends/object.py b/src/vector/backends/object.py
index ddc44ca..18a202b 100644
--- a/src/vector/backends/object.py
+++ b/src/vector/backends/object.py
@@ -387,7 +387,7 @@ class VectorObject(Vector):
         return _replace_data(self, numpy.true_divide(self, other))  # type: ignore[call-overload]
 
     def __pow__(self, other: float) -> float:
-        return numpy.power(self, other)  # type: ignore[call-overload]
+        return numpy.square(self) if other == 2 else numpy.power(self, other)  # type: ignore[call-overload]
 
     def __matmul__(self, other: VectorProtocol) -> float:
         return numpy.matmul(self, other)  # type: ignore[call-overload]


Test patch:
diff --git a/tests/compute/test_isclose.py b/tests/compute/test_isclose.py
index 62c9449..a101046 100644
--- a/tests/compute/test_isclose.py
+++ b/tests/compute/test_isclose.py
@@ -62,8 +62,6 @@ def test_spatial_object():
 
     for t1 in "xyz", "xytheta", "xyeta", "rhophiz", "rhophitheta", "rhophieta":
         for t2 in "xyz", "xytheta", "xyeta", "rhophiz", "rhophitheta", "rhophieta":
-            print(t1, t2)
-
             transformed1, transformed2 = (
                 getattr(v1, "to_" + t1)(),
                 getattr(v2, "to_" + t2)(),
diff --git a/tests/test_issues.py b/tests/test_issues.py
index d0be1ce..c1d509e 100644
--- a/tests/test_issues.py
+++ b/tests/test_issues.py
@@ -8,6 +8,7 @@ from __future__ import annotations
 import os
 import pickle
 
+import numpy as np
 import pytest
 
 import vector
@@ -47,3 +48,16 @@ def test_issue_161():
     with open(file_path, "rb") as f:
         a = ak.from_buffers(*pickle.load(f))
     repro(generator_like_jet_constituents=a.constituents)
+
+
+def test_issue_443():
+    ak = pytest.importorskip("awkward")
+    vector.register_awkward()
+
+    assert vector.array({"E": [1], "px": [1], "py": [1], "pz": [1]}) ** 2 == np.array(
+        [-2.0]
+    )
+    assert ak.zip(
+        {"E": [1], "px": [1], "py": [1], "pz": [1]}, with_name="Momentum4D"
+    ) ** 2 == ak.Array([-2])
+    assert vector.obj(E=1, px=1, py=1, pz=1) ** 2 == -2