ChooseLattice#
ChooseLattice displays a single 2D image and lets you click an ordered
origin, a1, and a2 on it. The picked pixel coordinates and the derived
lattice vectors u = a1 - origin and v = a2 - origin are exposed for
downstream lattice calculations.
Tip
Run this exact notebook with the Colab badge above, or View or download this notebook on GitHub.
Pick the lattice points#
Click the origin, then a1, then a2 on the image below. Wheel-zoom and
drag-pan to line the click up with a specific feature, then drag an existing
point to nudge it. Use the Clear Points button to start over.
from quantem.widget import ChooseLattice
widget = ChooseLattice(image, cmap="inferno", title="Synthetic atomic lattice")
widget
Read back the picked points#
origin is the first (row, col) click; u and v are the derived lattice
vectors a1 - origin and a2 - origin. Each is None until enough points are
placed. Click the three points above first, then run
the cell below yourself (it is skipped during the automated docs build since
it depends on a live click).
print("origin:", widget.origin)
print("u:", widget.u)
print("v:", widget.v)
widget.points holds the raw (row, col) picks as a list, and the
Clear Points button resets them.