You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inspired by #659 (@jlabounty). Currently, the boost-histogram/hist → ROOT TH* conversion takes a categorical axis with n categories as a continuous regular axis of n bins from 0 to n-1 (inclusive). ROOT TH* objects have no notion of categorical axes, but they do have fLabels, which can be set to a list of strings. When this value is set to n strings, ROOT draws these strings under each tick, effectively simulating a categorical axis.
This feature request would be (1) to have boost-histogram/hist → ROOT TH* set fLabels, somewhere here (may have to be expanded to a regular for loop):
And (2) to interpret a TAxis with fLabels is not None and len(fLabels) != 0 as a boost-histogram/hist categorical axis when transforming the other way:
We probably won't be able to preserve the int-ness of IntCategorical (fLabels are strictly strings), but maybe if all strings don't raise ValueError when cast as a Python int, that would be a good indicator.
The text was updated successfully, but these errors were encountered:
Inspired by #659 (@jlabounty). Currently, the boost-histogram/hist → ROOT TH* conversion takes a categorical axis with
n
categories as a continuous regular axis ofn
bins from0
ton-1
(inclusive). ROOT TH* objects have no notion of categorical axes, but they do havefLabels
, which can be set to a list of strings. When this value is set ton
strings, ROOT draws these strings under each tick, effectively simulating a categorical axis.This feature request would be (1) to have boost-histogram/hist → ROOT TH* set
fLabels
, somewhere here (may have to be expanded to a regularfor
loop):uproot5/src/uproot/writing/identify.py
Lines 320 to 331 in c7d7282
And (2) to interpret a TAxis with
fLabels is not None and len(fLabels) != 0
as a boost-histogram/hist categorical axis when transforming the other way:uproot5/src/uproot/behaviors/TH1.py
Lines 17 to 40 in c7d7282
We probably won't be able to preserve the int-ness of IntCategorical (
fLabels
are strictly strings), but maybe if all strings don't raise ValueError when cast as a Pythonint
, that would be a good indicator.The text was updated successfully, but these errors were encountered: