Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing error message when using invalid start/stop for logarithmic histograms #567

Open
kratsg opened this issue May 2, 2024 · 1 comment

Comments

@kratsg
Copy link

kratsg commented May 2, 2024

>>> hist.Hist.new.StrCat(["all", "pass", "fail"], name="isEM").Log(1000, 0.0, 2000.0, name="pt", label="$pt_{\gamma}$ [GeV]").Int64()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/kratsg/radiativeDecays/venv/lib/python3.11/site-packages/hist/quick_construct.py", line 113, in Log
    axis.Regular(
  File "/Users/kratsg/radiativeDecays/venv/lib/python3.11/site-packages/hist/axis/__init__.py", line 108, in __init__
    super().__init__(
  File "/Users/kratsg/radiativeDecays/venv/lib/python3.11/site-packages/boost_histogram/_internal/axis.py", line 330, in __init__
    ax = transform._produce(bins, start, stop)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kratsg/radiativeDecays/venv/lib/python3.11/site-packages/boost_histogram/_internal/axis_transform.py", line 146, in _produce
    return self.__class__._type(bins, start, stop, self._this)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: forward transform of start or stop invalid

To an end-user, forward transform is relatively vague and maybe the error message could be more helpful such as "start and stop must be valid inputs for logarithmic" or similar?

@matthewfeickert matthewfeickert transferred this issue from scikit-hep/boost-histogram May 2, 2024
@matthewfeickert
Copy link
Member

matthewfeickert commented May 2, 2024

I transfered this from https://github.com/scikit-hep/boost-histogram, even though this is ultimately a boost-histogram issue as there isn't a minimal reproducer for just boost-histogram yet. Once that is found then a boost-histogram Issue can be opened and then a PR to boost-histogram can close this Issue and the new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants