Arch
Visualization helpers for :class:~bloqade.lanes.arch.spec.ArchSpec.
These used to live as methods on ArchSpec itself. They were extracted
as part of #464 phase 1 so the core ArchSpec Python wrapper stays
focused on architectural data and validation, keeping matplotlib out of
its import surface.
The primary entry point is the :class:ArchVisualizer class, which
caches bounds computations and provides plot / show methods.
The ArchSpec shims (arch_spec.plot, .show, .x_bounds,
.y_bounds, .path_bounds) create an ArchVisualizer via a
@cached_property so existing call sites keep working.
ArchVisualizer
ArchVisualizer(arch_spec: ArchSpec)
Visualization facade for an :class:ArchSpec.
Construct once from an architecture spec; bounds are cached so
repeated calls to plot or show don't recompute site
positions.
Example::
viz = ArchVisualizer(arch_spec)
viz.plot(ax, show_words=[0, 1], show_word_bus=[0])
print(viz.x_bounds, viz.y_bounds)
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/visualize/arch.py
68 69 | |
x_bounds
cached
property
x_bounds: tuple[float, float]
(x_min, x_max) across every site. Falls back to
(-1.0, 1.0) when no sites are discoverable.
y_bounds
cached
property
y_bounds: tuple[float, float]
(y_min, y_max) across every site. Falls back to
(-1.0, 1.0) when no sites are discoverable.
path_bounds
path_bounds() -> tuple[float, float, float, float]
(x_min, x_max, y_min, y_max) covering every site and
every transport-path waypoint registered on the arch.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/visualize/arch.py
113 114 115 116 117 118 119 120 121 122 123 124 | |
plot
plot(
ax: Axes | None = None,
show_words: Sequence[int] = (),
show_site_bus: Sequence[int] = (),
show_word_bus: Sequence[int] = (),
**scatter_kwargs
) -> Axes
Render the architecture onto a matplotlib axes.
Returns the ax argument (or the auto-resolved current axes)
so callers can chain or further customise the plot.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/visualize/arch.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
show
show(
ax: Axes | None = None,
show_words: Sequence[int] = (),
show_intra: Sequence[int] = (),
show_inter: Sequence[int] = (),
**scatter_kwargs
) -> None
Render and immediately call plt.show().
Convenience for interactive sessions; programmatic callers
should prefer :meth:plot.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/visualize/arch.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | |