From: Dan White Date: Thu, 26 Jun 2025 15:05:17 +0000 (-0500) Subject: TimeSampleHistogram: WIP extract hierarchy counts X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;ds=inline;p=pubbin.git TimeSampleHistogram: WIP extract hierarchy counts --- diff --git a/TimeSampleHistogram b/TimeSampleHistogram index 07eb3fa..0868579 100755 --- a/TimeSampleHistogram +++ b/TimeSampleHistogram @@ -300,6 +300,33 @@ for pat in args: hist = {k: hist[k] for k in keys} + +# +# Create hierarchy of tag subjects +# re.bcon2.antenna -> (re, +# (bcon2, +# (antenna, base, comms) +# ) +# ) +hier = defaultdict(dict) +# nodes are dicts +# end leaves are integers +for tag in hist.keys(): + h = defaultdict(dict) + subtags = tag.split(".") + depth = len(subtags) + # print(f"{tag}: {depth} : {subtags}") + + def update(h, tag, rest): + h[tag] += 1 + if isinstance(rest, list): + return update(h[tag], rest[0], rest[1:]) + else: + return h + + # hier = update(hier, tag, subtags) + + # # Display the histogram #