"""Job 4291: aggregate gate4291.out (idx g7 g11 g13 g17 g19 g23; idx -1 = true T_7 word) into the route-71 step's quantities, and check the depth <= 4 controls against #1820's served gate2810.out (sha e68c2fd3...).""" import json, sys from collections import Counter rows = [list(map(int, l.split())) for l in open('gate4291.out')] true = [r[1:] for r in rows if r[0] == -1][0]; G = [tuple(r[1:]) for r in rows if r[0] >= 0] N = len(G); levels = [7, 11, 13, 17, 19, 23] ref = json.load(open('../4290/gate2810.out')) prefix = {f'n<={n}': len({g[:n + 1] for g in G}) for n in range(6)} fib5 = Counter(G); fib4 = Counter(g[:5] for g in G) sizes5 = Counter(fib5.values()) # how the depth-5 value splits each depth-4 fibre split = Counter() for k4 in fib4: split[len({g for g in fib5 if g[:5] == k4})] += 1 tile = [int(l.split()[3]) for l in open('tile_all.out')] out = {'instrument': 'gate4291.c + agg4291.py', 'job': 4291, 'class': ref['class'], 'dihedral_classes': N, 'levels': levels, 'distinct_gamma_prefix': prefix, 'gate_values_level23': dict(sorted(Counter(g[5] for g in G).items())), 'largest_fibre_depth4': max(fib4.values()), 'largest_fibre_depth5': max(fib5.values()), 'fibre_size_histogram_depth5': dict(sorted(sizes5.items())), 'singletons_depth5': sizes5.get(1, 0), 'depth4_fibres_split_into_k_depth5_fibres': dict(sorted(split.items())), 'true_T7_trajectory': list(true), 'classes_sharing_true_trajectory_depth5': fib5[tuple(true)], 'classes_sharing_true_trajectory_depth4': fib4[tuple(true[:5])], 'true_tile_max_gaps_direct_sieve_7_to_23': tile, 'true_trajectory_ok': list(true) == tile, 'controls_vs_gate2810': { 'prefix_counts_depth_le4_equal': all(prefix[f'n<={n}'] == ref['distinct_gamma_prefix'][f'n<={n}'] for n in range(5)), 'per_level_histograms_7_to_19_equal': all(dict(sorted(Counter(g[i] for g in G).items())) == {int(k): v for k, v in ref['gate_values_per_level'][str(lv)].items()} for i, lv in enumerate(levels[:5])), 'largest_fibre_depth4_equals_513': max(fib4.values()) == ref['largest_gamma_fibre'], 'true_fibre_depth4_equals_81': fib4[tuple(true[:5])] == ref['classes_sharing_true_trajectory']}, 'separates_all_45150': prefix['n<=5'] == N} print(json.dumps(out, indent=1))