scikit-hep / histbook

Versatile, high-performance histogram toolkit for Numpy.
BSD 3-Clause "New" or "Revised" License
109 stars 9 forks source link

List of input variables #35

Closed imandr closed 6 years ago

imandr commented 6 years ago

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"]

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

That was quick :)