scikit-hep/histbook

List of input variables

Closed this issue · 2 comments

For what I am doing, it would be useful if a Hist was able to return the list of basic variables used in all its axis expressions.

For example

Hist(bin("sqrt(x**2 + y**2)", 5, 0, 1), bin("arctan2(y, x)", 3, -math.pi, math.pi))

would return the list ["x", "y"]

>>> h = Hist(bin("sqrt(x**2 + y**2)", 5, 0, 1), bin("arctan2(y, x)", 3, -math.pi, math.pi))
>>> h.fields
['x', 'y']

That was quick :)