Skip to content

support units in metrics

metrics are essentially wrapped scikit-hep Hists, and we fill them with astropy.units.Quantities, but there is no unit handling support and the units of the axes are not stored.

  • Metric.fill() should check units, and forbid filling with incompatible ones (and convert if necessary)
  • Metric.plot() should show the axis units

Note hist axes support extra metadata, so this can be stored there:

from hist import axis

r = axis.Regular(100,-2,2, __dict__=dict(unit=u.TeV))

>>> print(r.unit)
TeV

Then this has to be handled in Storable when serializing and deserializing the Metric

Edited by Karl Kosack