Skip to content

Commit

Permalink
correctly overwrite the range in registry if specified
Browse files Browse the repository at this point in the history
  • Loading branch information
0ctagon committed Jan 11, 2024
1 parent 2457d9e commit bb7e011
Showing 1 changed file with 5 additions and 4 deletions.
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 bb7e011

Please sign in to comment.