Skip to main content

useq-schema

License PyPI - Python Version PyPI Conda tests docs codecov

An open, implementation-agnostic schema for describing multi-dimensional microscopy experiments.

Documentation: https://pymmcore-plus.github.io/useq-schema/

Rationale

The useq-schema library defines a structured schema to represent a sequence of microscope acquisition events. By adopting this schema, various microscopy software tools can facilitate interoperability, allowing end users to potentially switch between different control backends with ease. The goal is to encourage a shared standard, making it straightforward for developers to adopt useq-schema and enhance compatibility across tools.

[!IMPORTANT]

Hey developers! :wave: Not convinced? Don't leave yet!

We are particularly interested in feedback from developers of microscopy-control software.

If you are considering supporting useq-schema in your software, but don't see all the fields in MDAEvent that you would need to support your complex use case, please open an issue or pull request to discuss additional features.

:carrot: The carrot for you?

Anyone who is already using useq-schema to describe a sequence of events in some other software (that supports it) can easily try out your solution, with (hopefully) minimal changes to their code.

useq.MDAEvent

The primary "event" object is useq.MDAEvent. This represents a single event that a microscope should perform, including preparation of the hardware, and execution of the event (such as an image acquisition).

from useq import MDAEvent

event = MDAEvent(
    channel="DAPI",
    exposure=100,
    x_pos=100.0,
    y_pos=100.0,
    z_pos=30.0,
    min_start_time=10.0,
    ... # multiple other fields
)

Downstream libraries that aim to support useq-schema should support driving hardware based on an Iterable[MDAEvent]. See useq.MDAEvent documentation for more details.

Similar objects in existing software packages

useq.MDASequence

useq.MDASequence is a declarative representation of an multi-dimensional experiment. It represents a sequence of events: as might be generated by the multidimensional acquisition GUI in most microscope software. It is composed of "plans" for each axis in the experiment (such as a Time Plan, a Z Plan, a list of channels and positions, etc.). A useq.MDASequence object is itself iterable, and yields MDAEvent objects.

See useq.MDASequence documentation for more details.

Similar objects in existing software packages

Example usage

from useq import MDASequence

mda_seq = MDASequence(
    stage_positions=[(100, 100, 30), (200, 150, 35)],
    channels=["DAPI", "FITC"],
    time_plan={'interval': 1, 'loops': 20},
    z_plan={"range": 4, "step": 0.5},
    axis_order='tpcz',
)

The MDASequence object is iterable, yielding MDAEvent objects in the order specified by the axis_order attribute.

>>> events = list(mda_seq)

>>> print(len(events))
720 

>>> print(events[:3])
[MDAEvent(
    channel=Channel(config='DAPI'),
    index=mappingproxy({'t': 0, 'p': 0, 'c': 0, 'z': 0}),
    min_start_time=0.0,
    x_pos=100.0,
    y_pos=100.0,
    z_pos=28.0,
 ),
 MDAEvent(
    channel=Channel(config='DAPI'),
    index=mappingproxy({'t': 0, 'p': 0, 'c': 0, 'z': 1}),
    min_start_time=0.0,
    x_pos=100.0,
    y_pos=100.0,
    z_pos=28.5,
 ),
 MDAEvent(
    channel=Channel(config='DAPI'),
    index=mappingproxy({'t': 0, 'p': 0, 'c': 0, 'z': 2}),
    min_start_time=0.0,
    x_pos=100.0,
    y_pos=100.0,
    z_pos=29.0,
 )]

Both MDAEvent and MDASequence objects are pydantic models, so they can be easily serialized to and from json or yaml.

print(mda_seq.yaml())
axis_order: tpcz
channels:
- config: DAPI
- config: FITC
stage_positions:
- x: 100.0
  y: 100.0
  z: 30.0
- x: 200.0
  y: 150.0
  z: 35.0
time_plan:
  interval: 0:00:01
  loops: 20
z_plan:
  range: 4.0
  step: 0.5

Installation

pip install useq-schema

or, with conda:

conda install -c conda-forge useq-schema

Executing useq-schema experiments with pymmcore-plus

pymmcore-plus implements an acquisition engine that can execute an iterable of MDAEvents using micro-manager in a pure python environment (no Java required).

from pymmcore_plus import CMMCorePlus

core = CMMCorePlus()
core.loadSystemConfiguration()  # loads demo by default

core.mda.run(mda_seq)  # run the experiment

# or, construct a sequence of MDAEvents anyway you like
events = [MDAEvent(...), MDAEvent(...), ...]
core.mda.run(events)

This can be considered a "reference implementation" of an engine that supports useq-schema.

See pymmcore-plus documentation for details.

Metadata

Release files for useq-schema 0.9.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for useq-schema 0.9.2
File Size Uploaded
useq_schema-0.9.2.tar.gz 115.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for useq-schema 0.9.2
File Interpreter ABI Platform
useq_schema-0.9.2-py3-none-any.whl Python 3 none any Details

Total release size: 200.8 kB

Release files / useq_schema-0.9.2.tar.gz

Download URL useq_schema-0.9.2.tar.gz
Size 115.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a84a374f734c0441c63ecb463d150dae4449e215347bfd990c8c13711184bbf1
BLAKE2b-256 checksum
How to use checksums
2c52562f51ba6d7b8b49325d20ead16be79ff3edccdd03fb8cae494bcddd6643
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 1, 2026.

Transparency log

Release files / useq_schema-0.9.2-py3-none-any.whl

Download URL useq_schema-0.9.2-py3-none-any.whl
Size 85.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dbecaebca4898df454a7ec221d9bf265d41ee285d80f0285fb1188d8ec1ecb95
BLAKE2b-256 checksum
How to use checksums
ac3830b313b0b83cc86a343f6ebabcca4d210107513b026d48ae8aa489571b52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.9.2 This release

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.4

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page