Documentation

Use the app

How it works

Build on it

Get involved

Digital Twin

The Digital Twin is a simulated Thermo Fisher Talos F200X. It speaks the real AutoScript protocol, so a script written for the twin runs on the microscope with a different host and port. The source is tem-alignment-twin, by Manish Kumar and Zhao Meng, pinned as a submodule at vendor/tem-alignment-twin. Its manual, docs/MANUAL.md, is the full reference; this page covers how the app uses it.

What it simulates

Open it

Use any of these:

The twin starts cold, as the real instrument would be: insert the specimen holder, wait for the column vacuum, open the column valves, and switch the beam on.

How the app hosts it

Twin 3 keeps its simulation inside its web page, not in the Python server. Two facts follow:

So the app owns one window for the whole run:

Twin 3 server with its WebSocket link port and AutoScript port

Action What happens
Close the window It hides. The simulation keeps running, with background throttling off.
Open it again The same window and the same simulation
Stop digital twin The server and window end, and the simulation state is lost
Quit the app Same as stop
The page crashes or is destroyed The server stops, an error shows on the Digital twin page, and the next open starts a new simulation

The controller is desktop/twin.mjs, with behaviour pinned by desktop/tests/twin.test.mjs.

Using it from Python

Any AutoScript client can connect. The app chooses the port for each run, so read it from the running process or use the device tools through the assistant.

from autoscript_tem_microscope_client import TemMicroscopeClient

microscope = TemMicroscopeClient()
microscope.connect("localhost", 7524)   # the twin; a real Talos uses its own host and port 7521
print(microscope.service.system.name)

Twin-only calls reveal the hidden state, which is useful for benchmarks:

config = microscope.service.autoscript.server.configuration
config.get_value("twin.randomize=42")   # a new, reproducible misaligned column
config.get_value("twin.metrics")        # the true errors, as JSON

Measured on an Apple Silicon laptop, one step of changing a stigmator and acquiring an image takes about 0.13 s at 512 px and 0.19 s at 1024 px. The simulated exposure time does not add real waiting.

Limits in this app