"An experimental context-aware acquisition package for a motorized microscope." — the README, rewritten two days after the GUI was deleted, December 2019
This is where deepthought started. 120 commits between December 2018 and May 2020,
originally at pskeshu/deepthought, renamed when the rewrite began. Everything in
ndsystems/deepthought and
ndsystems/hard-link is downstream of the
arguments worked out here.
Superseded, kept for provenance. Not maintained, and not the place to start if you
want the working system — that is deepthought. Read this one for why that system is
shaped the way it is.
| Dec 2018 | A PyQt window bolted onto MMCore. Load devices, drive the shutters and stage from buttons, show the frame in a matplotlib widget. |
| Dec 2019 | After a year's silence: init headless mode deletes the GUI. Two days later the README stops describing a user-interface for an Olympus IX83 and starts describing a context-aware acquisition package for a motorized microscope. Raw TCP sockets arrive — "allowing for one-time loading of hardware." |
| Mar–May 2020 | pymmcore. mcu.py becomes a standalone microscope control unit; a Flask/socket.io bridge fans it out to a React frontend that draws frames as mpld3 figures. |
| Jun 2020 | Work restarts as ndsystems/deepthought; rpyc and bluesky arrive that August. This repository stops. |
The stack at the end:
React :3000 ─socket.io→ Flask (view.py) :5000 ─TCP+pickle→ mcu.py :12345 → pymmcore → scope
Three processes and two protocols to get one image into a browser — and every frame went through matplotlib on the way, serialized to mpld3 JSON for d3 to redraw. The live view was that, ten times a second. It worked, and it was the ceiling.
The device server, and why. design.md is the earliest statement of the idea that
became hard-link, and the reason given is not architectural taste:
"frequently crashing buggy code lead to slow development with the hardware, as there is a high refractory time for the hardware to reboot... Therefore, a client server model seemed like a good idea, with the mcu running as a microservice."
Rebooting a microscope is slow. That is the whole argument. mcu.py implements it with
sockets and pickle; hard-link is the same boundary drawn again with RPyC.
Describing the sample instead of the instrument. example.py is a sketch of an API
that was never built — no classes stand behind it:
experiment = Experiment()
experiment.plate("35mm", scan="default")
experiment.plasmid("H2B-EGFP")
experiment.plasmid("PCNA")
experiment.mag("100")You say what is on the stage, not how to drive the stage. That idea went quiet for
years and came back as the sample geometry model in deepthought.
Concurrent clients with priorities. MultiClientHandler in mcu.py is a docstring
and a block of pseudocode around an __init__ that was never finished. It proposes
several clients sharing one microscope, each with a different urgency: a state monitor
polling in the background, acquisition control carrying user commands, and
auto-mechanisms — autofocus, auto-exposure, auto-track — maintaining the instrument in
between.
That is the closed loop framed as concurrency rather than as a loop inside a single plan, and it is the one idea here that has still not been built.
| Path | What it is |
|---|---|
design.md |
Notes on isolating microscope control as a microservice |
example.py |
The sketched experiment API |
deepthought/mcu.py |
Microscope control unit — pymmcore behind a TCP server |
deepthought/handler.py |
Client giving an MMCore-shaped API over that socket |
deepthought/view.py |
Flask + socket.io bridge between the browser and the mcu |
deepthought/viz.py |
Renders an array to a matplotlib figure with a scale bar, then to mpld3 JSON |
deepthought/events.py |
MMCore property-change callbacks |
deepthought/src/, public/ |
React frontend — camera and shutter panels, mpld3 feed |
deepthought/mmconfigs/ |
Micro-Manager configurations, including demo.cfg for working without hardware |
The frontend needs npm install under deepthought/; the Python side needs
pymmcore, flask, flask-socketio, matplotlib, mpld3 and
matplotlib-scalebar. Neither has been run since 2020.
MIT licensed — see LICENSE.