File size: 1,097 Bytes
0a3edb6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""Every marker of one view with why it's there and its item; the masked entities in it."""
import collections, glob, sys
from functional import sample, window, SRC, SNK, C, INT
from measure import CONFIGS
from factorion import items
views = sample(sorted(glob.glob(sys.argv[1])), int(sys.argv[2]), nudge=True)
cfg = CONFIGS[sys.argv[3]]
for i in map(int, sys.argv[4].split(",")):
    r, lab, x0, y0 = views[i]
    w, why = window(r, lab, x0, y0, cfg)
    from functional import thput
    print(f"== #{i}: delivers {thput(w):.2f}/s")
    rows = collections.Counter()
    for (x, y), (kind, how) in why.markers.items():
        gx, gy = x - x0 + 1, y - y0 + 1
        item = items[int(w[C[2], gx, gy])].name if w[C[0], gx, gy] in (SRC, SNK) else "(dropped)"
        rows[(kind, how, item)] += 1
    for (kind, how, item), n in sorted(rows.items()):
        print(f"   {n:3d} x {kind:6s} {item:22s} {how}")
    masked = collections.Counter(n for n, x, y, wd, h in r.masked if x < x0 + INT and x + wd > x0 and y < y0 + INT and y + h > y0)
    print("   masked in view:", dict(masked.most_common(8)))