Skip to content

Commit

Permalink
Merge pull request #99 from cyrraz/hotfix-registry-update-ranges
Browse files Browse the repository at this point in the history
Bugfix: correctly overwrite the range in registry if specified
  • Loading branch information
0ctagon authored Jan 16, 2024
2 parents 5b800f7 + 7c254cd commit 5321642
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ plothist
:target: https://badge.fury.io/py/plothist
.. |Code style: black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
.. |Docs from latest| image:: https://img.shields.io/badge/docs-v1.0.2-blue.svg
.. |Docs from latest| image:: https://img.shields.io/badge/docs-v1.0.3-blue.svg
:target: https://plothist.readthedocs.io/en/latest/
.. |Docs from main| image:: https://img.shields.io/badge/docs-main-blue.svg
:target: https://plothist.readthedocs.io/en/main/
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
author = "Cyrille Praz, Tristan Fillinger"

# The short X.Y version
version = "1.0.2"
version = "1.0.3"
# The full version, including alpha/beta/rc tags
release = "1.0.2"
release = "1.0.3"


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion plothist/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Plot histograms in a scalable way and a beautiful style."""
__version__ = "1.0.2"
__version__ = "1.0.3"

from .plotters import (
create_comparison_figure,
Expand Down
9 changes: 5 additions & 4 deletions plothist/variable_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,11 @@ def update_variable_registry_ranges(
raise RuntimeError(
f"Variable {variable_key} does not have a bins or range property in the registry {path}."
)
if variable["range"] == ["min", "max"] or overwrite:
if overwrite:
range = ["min", "max"]
axis = create_axis(data[variable_key], variable["bins"], variable["range"])

range = ["min", "max"] if overwrite else variable["range"]

if range == ["min", "max"]:
axis = create_axis(data[variable_key], variable["bins"], range)
if isinstance(axis, bh.axis.Regular):
update_variable_registry(
{"range": [float(axis.edges[0]), float(axis.edges[-1])]},
Expand Down

0 comments on commit 5321642

Please sign in to comment.