PyCLM
A modular closed-loop microscopy software in Python.
PyCLM runs many optogenetic experiments at once on one microscope. Each imaging position gets its own light pattern, projected through a DMD, that can be fixed, change over time, follow individual cells, or respond to what the cells are doing.
Using PyCLM with Claude Code
PyCLM ships a plugin for Claude Code that
sets PyCLM up on a microscope and designs, checks, runs, follows and exports
experiments with you, using the pyclm commands below. On the microscope PC,
with Claude Code installed:
claude plugin marketplace add toettchlab/PyCLM
claude plugin install pyclm@pyclm-plugins
claude
Using PyCLM with Claude Code covers setup, launching on a shared microscope PC, each step of a run, Remote Control from a Claude project, and a worked example.
How PyCLM works
Experiments are written as short TOML files, so running a new one needs no programming; a new kind of light rule is a small Python class. Microscope control, segmentation, tracking, pattern generation and saving run as separate processes in parallel, so the microscope rarely waits and the number of simultaneous experiments is limited mainly by the hardware. Data is written as the run goes (OME-Zarr by default), and ImageJ hyperstacks are exported at the end.
Start here
| I want to... | Go to |
|---|---|
| Set up and run experiments with Claude Code | Using PyCLM with Claude Code |
| See what light patterns PyCLM can make | Method zoo: every built-in pattern method on a sample image, with a [pattern] table to copy |
| Try it without a microscope | The demo below |
| Set PyCLM up on my microscope | First-time setup |
| Write an experiment | Experiment TOMLs and the pyclm command |
| Write my own light rule | Custom pattern methods |
| Open the data from a run | Data format and export |
The full documentation is at pyclm.readthedocs.io.
Install and try it yourself
pip install "closed-loop-microscopy[gui]"
pyclm new demo --demo
pyclm run demo --dry --gui
The package is closed-loop-microscopy; the import name and the command are
pyclm. Leave out [gui] for a headless install (checking, previews, dry
runs, reading data). For development, clone the repository and run uv sync.
The demo runs two experiments on the virtual microscope (--dry) with
synthetic cells: a sweeping bar of light, and a closed loop that segments the
cells and lights the outward half of each. Pick a method from the
zoo, paste its
[pattern] table over the one in demo/cells.toml (keep channel = "545",
the demo's channel), and run it again.
Running on a real microscope needs Micro-Manager,
which PyCLM drives through
pymmcore-plus; point
config_path in pyclm_config.toml at your Micro-Manager .cfg file. The
installation page
covers the extras and matching the Micro-Manager device interface.
Citation
If you use PyCLM in your research, please cite:
Oatman HR, Lad BC, Nguyen L, Gubbens JH, Toettcher JE. An optogenetic smart microscopy platform reveals signaling dynamics-dependent control over collective cell migration. Cell Systems 17(9) (2026). doi:10.1016/j.cels.2026.101674
The paper describes version 1.0.1. To record the version you used, also cite
that release: every release has its own DOI on Zenodo, all listed under
doi:10.5281/zenodo.20385964
(which always resolves to the latest). GitHub's "Cite this repository" button
gives both, from CITATION.cff.
Metadata
Release files for closed-loop-microscopy 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| closed_loop_microscopy-1.2.0.tar.gz | 236.0 kB | With provenance | Details for closed_loop_microscopy-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| closed_loop_microscopy-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for closed_loop_microscopy-1.2.0-py3-none-any.whl |
Total release size: 514.6 kB
Release files / closed_loop_microscopy-1.2.0.tar.gz
| Download URL | closed_loop_microscopy-1.2.0.tar.gz |
|---|---|
| Size | 236.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2129ae1f6f7f2a2d12d5aee5626be36d516bf403f81f208d296c145f525ead03
|
|
BLAKE2b-256 checksum How to use checksums |
14b24904adee98e2cd38f128c54f1a31f3558717bdbe0a09b652254316398b31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logRelease files / closed_loop_microscopy-1.2.0-py3-none-any.whl
| Download URL | closed_loop_microscopy-1.2.0-py3-none-any.whl |
|---|---|
| Size | 278.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db12d4fd7747672c5e99682eb414992a3c0e66e86bf13ca8cf8e655074ba3fee
|
|
BLAKE2b-256 checksum How to use checksums |
0198953ec606fedc0851f5f4895fed23e124fc4cc68a96a251884949f6cacb21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logSecurity for closed-loop-microscopy 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for closed_loop_microscopy-1.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.