v4 flagship Space (3 tiers) from registry v2 (earlier contents: 906bc45ae05c)
Browse files- geomgnn/app_flagship.py +4 -4
- registry.yaml +3 -1
- tlsq_infer/app_ui.py +11 -4
- tlsq_infer/layout.py +39 -9
geomgnn/app_flagship.py
CHANGED
|
@@ -22,7 +22,7 @@ from tlsq_infer import __version__ as TLSQ_VERSION
|
|
| 22 |
import gradio as gr
|
| 23 |
from tlsq_infer.app_ui import CUSTOM, HEAVY, LAYER_COLS, LIMITS, _eps, _parse_layers, _path, _safe, inspect_fn
|
| 24 |
from tlsq_infer.app_v2 import PURGE_AGE_S, _margin_api, _outdir, _prepare, prepare_fn
|
| 25 |
-
from tlsq_infer.layout import LayoutError, prepare
|
| 26 |
from tlsq_infer.predict import matrix_csv
|
| 27 |
from tlsq_infer.registry import load_registry
|
| 28 |
|
|
@@ -253,11 +253,11 @@ def nets_view(f, table, crop, margin_gaps, margin_um, select, gstate):
|
|
| 253 |
ax = fig.axes[0]
|
| 254 |
if not lay.info.get("ground_detection") and not lay.ground.is_empty:
|
| 255 |
q = lay.ground.representative_point()
|
| 256 |
-
ax.annotate("G", (q.x, q.y), ha="center", va="center", fontsize=11, weight="bold", color=
|
| 257 |
bbox=dict(boxstyle="round,pad=0.2", fc="#e5e7eb", ec="#374151", lw=0.6))
|
| 258 |
-
keys = [Patch(fc="none", ec=
|
| 259 |
if lay.window is not None:
|
| 260 |
-
keys.append(Line2D([], [], ls="--", color=
|
| 261 |
if keys:
|
| 262 |
ax.legend(handles=keys, loc="upper center", bbox_to_anchor=(0.5, -0.11), ncol=len(keys), frameon=False, fontsize=9)
|
| 263 |
fig.tight_layout()
|
|
|
|
| 22 |
import gradio as gr
|
| 23 |
from tlsq_infer.app_ui import CUSTOM, HEAVY, LAYER_COLS, LIMITS, _eps, _parse_layers, _path, _safe, inspect_fn
|
| 24 |
from tlsq_infer.app_v2 import PURGE_AGE_S, _margin_api, _outdir, _prepare, prepare_fn
|
| 25 |
+
from tlsq_infer.layout import INK, UNMODELLED_COLOR, WINDOW_COLOR, LayoutError, prepare
|
| 26 |
from tlsq_infer.predict import matrix_csv
|
| 27 |
from tlsq_infer.registry import load_registry
|
| 28 |
|
|
|
|
| 253 |
ax = fig.axes[0]
|
| 254 |
if not lay.info.get("ground_detection") and not lay.ground.is_empty:
|
| 255 |
q = lay.ground.representative_point()
|
| 256 |
+
ax.annotate("G", (q.x, q.y), ha="center", va="center", fontsize=11, weight="bold", color=INK,
|
| 257 |
bbox=dict(boxstyle="round,pad=0.2", fc="#e5e7eb", ec="#374151", lw=0.6))
|
| 258 |
+
keys = [Patch(fc="none", ec=UNMODELLED_COLOR, hatch="///", label="not modelled")] if lay.extra_metal else []
|
| 259 |
if lay.window is not None:
|
| 260 |
+
keys.append(Line2D([], [], ls="--", color=WINDOW_COLOR, lw=1.0, label="crop window"))
|
| 261 |
if keys:
|
| 262 |
ax.legend(handles=keys, loc="upper center", bbox_to_anchor=(0.5, -0.11), ncol=len(keys), frameon=False, fontsize=9)
|
| 263 |
fig.tight_layout()
|
registry.yaml
CHANGED
|
@@ -1414,7 +1414,9 @@ flagship_hub:
|
|
| 1414 |
substrate: {commit: 4f5e6036f37b21cf9a24f6b5ad4762cbe1341809, date: 2026-11-03, rollback: 6f16a03ab7d2f7a41e66261de3c98d5051960290,
|
| 1415 |
gate: deploy/tests/results/flagship_space_gate_substrate_20261103.json, live: deploy/tests/results/flagship_space_live_substrate_20261103.json,
|
| 1416 |
offstack: deploy/tests/results/flagship_space_live_offstack_20261103.json} # calibrated substrate route (tl_squadds e60c67a; handoff/squadds_integration/reports/calibrated_substrate.md): Accurate solves the prior at the user's stack, Fast rescales + warns; rollback = the live farfield commit
|
| 1417 |
-
ui: {commit:
|
|
|
|
|
|
|
| 1418 |
prior_stacks:
|
| 1419 |
corrected: *stack_corrected # the corrected prior with substrate far field + compiled exact solver (the same stack as the paper Space's model)
|
| 1420 |
|
|
|
|
| 1414 |
substrate: {commit: 4f5e6036f37b21cf9a24f6b5ad4762cbe1341809, date: 2026-11-03, rollback: 6f16a03ab7d2f7a41e66261de3c98d5051960290,
|
| 1415 |
gate: deploy/tests/results/flagship_space_gate_substrate_20261103.json, live: deploy/tests/results/flagship_space_live_substrate_20261103.json,
|
| 1416 |
offstack: deploy/tests/results/flagship_space_live_offstack_20261103.json} # calibrated substrate route (tl_squadds e60c67a; handoff/squadds_integration/reports/calibrated_substrate.md): Accurate solves the prior at the user's stack, Fast rescales + warns; rollback = the live farfield commit
|
| 1417 |
+
ui: {commit: 62310ab6cadc2e12b73a5dbc5c93d840e8b4aa62, date: 2026-11-06, rollback: 4f5e6036f37b21cf9a24f6b5ad4762cbe1341809, source: tl_squadds 8a46d6b,
|
| 1418 |
+
live: deploy/tests/results/flagship_space_live_ui_20261106.json, offstack: deploy/tests/results/flagship_space_live_offstack_ui_20261106.json,
|
| 1419 |
+
examples: deploy/tests/results/flagship_space_live_examples_ui_20261106.json, clicks: deploy/tests/results/ui_redesign/live_20261106/} # UI redesign (passes 1-3, examples cache fix, ground check, physical banner); models and numbers unchanged; rollback = the live substrate commit
|
| 1420 |
prior_stacks:
|
| 1421 |
corrected: *stack_corrected # the corrected prior with substrate far field + compiled exact solver (the same stack as the paper Space's model)
|
| 1422 |
|
tlsq_infer/app_ui.py
CHANGED
|
@@ -21,6 +21,7 @@ from pathlib import Path
|
|
| 21 |
import numpy as np
|
| 22 |
|
| 23 |
from . import __version__
|
|
|
|
| 24 |
from .layout import LayoutError, load_gds, prepare, read_polygons
|
| 25 |
from .predict import intervals_csv, matrix_csv, predict
|
| 26 |
from .registry import load_registry
|
|
@@ -120,12 +121,18 @@ def layer_preview(polys: dict):
|
|
| 120 |
from matplotlib.patches import Polygon as MPoly
|
| 121 |
|
| 122 |
fig, ax = plt.subplots(figsize=(6, 6))
|
| 123 |
-
|
| 124 |
handles = []
|
| 125 |
-
|
| 126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
for p in ps[:5000]:
|
| 128 |
-
ax.add_patch(MPoly(np.asarray(p.exterior.coords), closed=True, fc=col, ec="k", lw=0.2, alpha=0.
|
| 129 |
handles.append(MPoly([[0, 0]], fc=col, ec="k", label=f"{key[0]}/{key[1]} ({len(ps)})"))
|
| 130 |
ax.autoscale_view()
|
| 131 |
ax.set_aspect("equal")
|
|
|
|
| 21 |
import numpy as np
|
| 22 |
|
| 23 |
from . import __version__
|
| 24 |
+
from . import layout as L
|
| 25 |
from .layout import LayoutError, load_gds, prepare, read_polygons
|
| 26 |
from .predict import intervals_csv, matrix_csv, predict
|
| 27 |
from .registry import load_registry
|
|
|
|
| 121 |
from matplotlib.patches import Polygon as MPoly
|
| 122 |
|
| 123 |
fig, ax = plt.subplots(figsize=(6, 6))
|
| 124 |
+
others = [c for c in L.CONDUCTOR_COLORS[3:] + L.CONDUCTOR_COLORS[1:3] if c != L.LIGHT_GOLD] # markers are thin: no light gold
|
| 125 |
handles = []
|
| 126 |
+
k = 0
|
| 127 |
+
for key, ps in sorted(polys.items(), key=lambda kv: (kv[0] != (1, 0), kv[0])): # ground first, underneath
|
| 128 |
+
if key == (1, 0):
|
| 129 |
+
col = L.GROUND_COLOR
|
| 130 |
+
elif key == (1, 10):
|
| 131 |
+
col = L.CONDUCTOR_COLORS[0]
|
| 132 |
+
else:
|
| 133 |
+
col, k = others[k % len(others)], k + 1
|
| 134 |
for p in ps[:5000]:
|
| 135 |
+
ax.add_patch(MPoly(np.asarray(p.exterior.coords), closed=True, fc=col, ec="k", lw=0.2, alpha=0.85 if key != (1, 0) else 1.0))
|
| 136 |
handles.append(MPoly([[0, 0]], fc=col, ec="k", label=f"{key[0]}/{key[1]} ({len(ps)})"))
|
| 137 |
ax.autoscale_view()
|
| 138 |
ax.set_aspect("equal")
|
tlsq_infer/layout.py
CHANGED
|
@@ -19,6 +19,37 @@ N_VALIDATED_SIGNALS = 7 # largest conductor count (plus ground) seen in trainin
|
|
| 19 |
N_MAX_SIGNALS = 30 # practical cap for the free Space (MoM cost); the networks themselves have no limit
|
| 20 |
AUTO_GAPS, AUTO_FRAC, AUTO_MIN_UM = 100.0, 0.5, 150.0 # margin="auto" (see deploy/LIMITS.md: crop study) # the networks are dense over at most 8 conductors including ground
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
class LayoutError(ValueError):
|
| 24 |
"""The layout cannot be turned into a valid capacitance problem (message says why and what to change)."""
|
|
@@ -237,25 +268,24 @@ class PreparedLayout:
|
|
| 237 |
fig, ax = plt.subplots(figsize=figsize)
|
| 238 |
else:
|
| 239 |
fig = ax.figure
|
| 240 |
-
patch(self.ground, facecolor=
|
| 241 |
-
cmap = plt.get_cmap("tab10")
|
| 242 |
gd = self.info.get("ground_detection")
|
| 243 |
fs = 8 if compact else 11
|
| 244 |
-
for
|
| 245 |
-
patch(g, facecolor=
|
| 246 |
p = g.representative_point() if g.area > 0 else g.centroid
|
| 247 |
-
ax.annotate(nm, (p.x, p.y), ha="center", va="center", fontsize=fs, weight="bold", color=
|
| 248 |
-
bbox=dict(boxstyle="round,pad=0.2", fc=
|
| 249 |
for r in (gd or {}).get("pieces", []):
|
| 250 |
if r["role"] != "conductor":
|
| 251 |
x, y = r["label_xy"]
|
| 252 |
ax.annotate(f"{'G' if r['role'] == 'ground' else 'not modelled'} #{r['id']}", (x, y), ha="center", va="center",
|
| 253 |
-
fontsize=fs, weight="bold", color=
|
| 254 |
for lab, g in self.extra_metal.items():
|
| 255 |
-
patch(g, facecolor="none", edgecolor=
|
| 256 |
if show_window and self.window is not None:
|
| 257 |
x0, y0, x1, y1 = self.window
|
| 258 |
-
ax.add_patch(Rectangle((x0, y0), x1 - x0, y1 - y0, fill=False, ls="--", ec=
|
| 259 |
b = shapely.union_all([self.ground, *self.conductors]).bounds
|
| 260 |
pad = 0.03 * max(b[2] - b[0], b[3] - b[1])
|
| 261 |
ax.set_xlim(b[0] - pad, b[2] + pad)
|
|
|
|
| 19 |
N_MAX_SIGNALS = 30 # practical cap for the free Space (MoM cost); the networks themselves have no limit
|
| 20 |
AUTO_GAPS, AUTO_FRAC, AUTO_MIN_UM = 100.0, 0.5, 150.0 # margin="auto" (see deploy/LIMITS.md: crop study) # the networks are dense over at most 8 conductors including ground
|
| 21 |
|
| 22 |
+
# Figure colours = the paper's (MetBrewer Archambault, Hokusai2, OKeeffe1; paper_v4/ml_paper_2026/figures/scripts/_style.py)
|
| 23 |
+
GROUND_COLOR = "#D9D9D9"
|
| 24 |
+
CONDUCTOR_COLORS = ("#AB3329", "#F9D14A", "#381A61", "#88A0DC", "#E78429", "#7C4B73", "#ED968C")
|
| 25 |
+
LIGHT_GOLD = "#F9D14A" # large conductors only: thin ones skip it
|
| 26 |
+
WINDOW_COLOR = "#381A61"
|
| 27 |
+
UNMODELLED_COLOR = "#6B200C"
|
| 28 |
+
INK = "#111827"
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def conductor_colors(areas) -> list[str]:
|
| 32 |
+
"""The paper's per-conductor cycle; a conductor smaller than the median area skips light gold."""
|
| 33 |
+
med = float(np.median(areas)) if len(areas) else 0.0
|
| 34 |
+
out, i = [], 0
|
| 35 |
+
for a in areas:
|
| 36 |
+
if CONDUCTOR_COLORS[i % len(CONDUCTOR_COLORS)] == LIGHT_GOLD and a < med:
|
| 37 |
+
i += 1
|
| 38 |
+
out.append(CONDUCTOR_COLORS[i % len(CONDUCTOR_COLORS)])
|
| 39 |
+
i += 1
|
| 40 |
+
return out
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def _luminance(hex_color: str) -> float:
|
| 44 |
+
lin = [(c / 12.92 if c <= 0.03928 else ((c + 0.055) / 1.055) ** 2.4) for c in (int(hex_color[j:j + 2], 16) / 255 for j in (1, 3, 5))]
|
| 45 |
+
return 0.2126 * lin[0] + 0.7152 * lin[1] + 0.0722 * lin[2]
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def text_color(hex_color: str) -> str:
|
| 49 |
+
"""White or ink, whichever has the higher WCAG contrast on the fill."""
|
| 50 |
+
lum = _luminance(hex_color)
|
| 51 |
+
return "white" if 1.05 / (lum + 0.05) >= (lum + 0.05) / (_luminance(INK) + 0.05) else INK
|
| 52 |
+
|
| 53 |
|
| 54 |
class LayoutError(ValueError):
|
| 55 |
"""The layout cannot be turned into a valid capacitance problem (message says why and what to change)."""
|
|
|
|
| 268 |
fig, ax = plt.subplots(figsize=figsize)
|
| 269 |
else:
|
| 270 |
fig = ax.figure
|
| 271 |
+
patch(self.ground, facecolor=GROUND_COLOR, edgecolor="#8c8c8c", lw=0.4)
|
|
|
|
| 272 |
gd = self.info.get("ground_detection")
|
| 273 |
fs = 8 if compact else 11
|
| 274 |
+
for g, nm, col in zip(self.conductors, self.names, conductor_colors([g.area for g in self.conductors])):
|
| 275 |
+
patch(g, facecolor=col, edgecolor="black", lw=0.4)
|
| 276 |
p = g.representative_point() if g.area > 0 else g.centroid
|
| 277 |
+
ax.annotate(nm, (p.x, p.y), ha="center", va="center", fontsize=fs, weight="bold", color=text_color(col),
|
| 278 |
+
bbox=dict(boxstyle="round,pad=0.2", fc=col, ec="black", lw=0.6))
|
| 279 |
for r in (gd or {}).get("pieces", []):
|
| 280 |
if r["role"] != "conductor":
|
| 281 |
x, y = r["label_xy"]
|
| 282 |
ax.annotate(f"{'G' if r['role'] == 'ground' else 'not modelled'} #{r['id']}", (x, y), ha="center", va="center",
|
| 283 |
+
fontsize=fs, weight="bold", color=INK, bbox=dict(boxstyle="round,pad=0.2", fc="#e5e7eb", ec="#374151", lw=0.6))
|
| 284 |
for lab, g in self.extra_metal.items():
|
| 285 |
+
patch(g, facecolor="none", edgecolor=UNMODELLED_COLOR, hatch="///", lw=0.6)
|
| 286 |
if show_window and self.window is not None:
|
| 287 |
x0, y0, x1, y1 = self.window
|
| 288 |
+
ax.add_patch(Rectangle((x0, y0), x1 - x0, y1 - y0, fill=False, ls="--", ec=WINDOW_COLOR, lw=1.0))
|
| 289 |
b = shapely.union_all([self.ground, *self.conductors]).bounds
|
| 290 |
pad = 0.03 * max(b[2] - b[0], b[3] - b[1])
|
| 291 |
ax.set_xlim(b[0] - pad, b[2] + pad)
|