Download scripts/flow_debug/inspect_view.py from beyarkay/factorio-blueprints: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/datasets/beyarkay/factorio-blueprints/resolve/main/scripts/flow_debug/inspect_view.py
- Command line
-
hf download hf://datasets/beyarkay/factorio-blueprints/scripts/flow_debug/inspect_view.py
-
curl -L -o inspect_view.py https://huggingface.co/datasets/beyarkay/factorio-blueprints/resolve/main/scripts/flow_debug/inspect_view.py
1.1 kB
| """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))) | |