Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Running The Servers

startup_scripts/run_servers.py starts the Tango/device side of asyncroscopy. It clears stale processes, starts the Tango database, registers devices, launches device servers, starts the DATA-managed Tiled HTTP server, and starts the microscope or digital twin last.

MCP is started separately with startup_scripts/run_mcp.py; see mcp_server.md.

TL;DR

uv run startup_scripts/run_servers.py
uv run startup_scripts/run_servers.py --microscope dt

uv run startup_scripts/run_servers.py --yaml configs/Spectra300.yaml
uv run startup_scripts/run_servers.py --yaml configs/Spectra300.yaml --microscope dt
uv run startup_scripts/run_servers.py --yaml configs/ThinkPad-utkarsh-covalent-setup.yaml

GUI:

uv run python startup_guis/server_gui.py
uv run startup_scripts/run_mcp.py --yaml configs/mcp.yaml

What It Starts

OrderDevice(s)Tango name
1support devicesasyncroscopy/{camera,corrector,data,eds,flucam,scan,stage}/default
2Tiled HTTP serverstarted through the data device
3microscope or digital twinasyncroscopy/microscope/default

The microscope starts last because it depends on the support devices. The runner writes support-device addresses into Tango database properties before the microscope starts. In real mode it also writes the AutoScript host and port.

Server GUI

startup_guis/server_gui.py is a small YAML launcher for the server stack. It does not start servers directly. It formats the current selections into YAML, writes that YAML to outputs/startup_configs/server_gui.yaml, and runs:

uv run python startup_scripts/run_servers.py --yaml outputs/startup_configs/server_gui.yaml --microscope <real-or-dt>

The GUI includes:

Configs

Server startup configs live in configs/:

FileFor
configs/Spectra300.yamlThe real Spectra 300 stack. This is the default config.
configs/ThinkPad-utkarsh-covalent-setup.yamlA localhost-everywhere setup for local testing.

Each server config has:

Device class_name defaults to the upper-cased key (scan becomes SCAN). microscope.host and microscope.port become the microscope device’s autoscript_host_ip and autoscript_host_port properties.

Set tango.reset_database_file: true to delete a stale local tango_database.db / Tango_database.db before starting the Tango database. The GUI exposes the same setting as Delete tango_database.db before start.

MCP

MCP has its own config: configs/mcp.yaml.

Start the server stack first. Then, from the MCP machine:

uv run startup_scripts/run_mcp.py --yaml configs/mcp.yaml

If MCP runs on a different computer, edit configs/mcp.yaml:

Prompts

Interactive mode is used only when --yaml is omitted. The defaults come from configs/Spectra300.yaml.

PromptWhat it controls
Tango database host / portTANGO_HOST for Tango clients and servers.
Tiled HTTP host / portWhere the DATA device starts Tiled.
Acquisition save pathDirectory written and served by Tiled.
Start Tiled HTTP serverWhether DATA starts its managed Tiled server.
Clear old processes firstFrees stale Tango/Tiled ports and old device servers.
Start Tango databaseStarts the DB or waits for an existing one.
Register devicesAdds device entries and microscope properties to the DB.
Device startup timeout secondsHow long to wait for each device to answer ping().
AutoScript host IP / portReal microscope mode only.

Startup Stages

  1. Clearing old processes frees the database/Tiled ports and kills old device server process groups.

  2. Starting Tango database starts or waits for the database server.

  3. Registering devices writes device entries and microscope properties.

  4. Starting device servers starts support devices, Tiled, and then the microscope or digital twin.

  5. Startup summary prints TANGO_HOST, PIDs, ready times, and the Tiled URI.

Manual Fallback

The runner automates this database-mode flow:

TANGO_HOST=localhost:9094 uv run python -m tango.databaseds.database 2

export TANGO_HOST=localhost:9094
uv run python -m asyncroscopy.instruments.electron_microscope.hardware.scan scan_instance
uv run python -m asyncroscopy.instruments.electron_microscope.auto_script microscope_instance

Manual device startup requires the devices to already be registered in Tango. Let run_servers.py do registration once, then stop and relaunch individual servers as needed.