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
#