TimeSampleHistogram: WIP extract hierarchy counts master
authorDan White <dan@whiteaudio.com>
Thu, 26 Jun 2025 15:05:17 +0000 (10:05 -0500)
committerDan White <dan@whiteaudio.com>
Thu, 26 Jun 2025 15:05:17 +0000 (10:05 -0500)
TimeSampleHistogram

index 07eb3faf289f931a3e3cdeda3b16e97c47d4a0a1..08685799ad3fe46e48e42425cc3f0e6586fe7f4c 100755 (executable)
@@ -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
 #