Schema for multi-dimensional microscopy experiments
Project description
useq-schema
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 inMDAEvent
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
- For micro-manager, this
object is most similar (though not that similar) to the events generated by
generate-acq-sequence
in the clojure acquisition engine. - For pycro-manager, this
object is similar to an individual acquisition event
dict
generated bymulti_d_acquisition_events
, (and,useq
provides ato_pycromanager()
method that converts anMDAEvent
into a single pycro-manager event dict) - your object here?...
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
- For micro-manager, this
object is most similar to
org.micromanager.acquisition.SequenceSettings
, (generated by clicking the "Acquire!" button in the Multi-D Acquisition GUI) - For pycro-manager, this
object is similar to the
multi_d_acquisition_events
convenience function, (anduseq
provides ato_pycromanager()
method that converts anMDASequence
to a list of pycro-manager events) - your object here?...
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file useq_schema-0.6.0.tar.gz
.
File metadata
- Download URL: useq_schema-0.6.0.tar.gz
- Upload date:
- Size: 66.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4a38dcf45af13942c5a6bc3239358336832ac18c886721d23a3d9da6ef8f0f2 |
|
MD5 | aa5c25390b0afc4e35adb09c6ed22be4 |
|
BLAKE2b-256 | 984b106cf95fdecd6b17353413fdd90c12b45feea7036a922057e7c42e1d69be |
Provenance
The following attestation bundles were made for useq_schema-0.6.0.tar.gz
:
Publisher:
ci.yml
on pymmcore-plus/useq-schema
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
useq_schema-0.6.0.tar.gz
- Subject digest:
f4a38dcf45af13942c5a6bc3239358336832ac18c886721d23a3d9da6ef8f0f2
- Sigstore transparency entry: 150613467
- Sigstore integration time:
- Predicate type:
File details
Details for the file useq_schema-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: useq_schema-0.6.0-py3-none-any.whl
- Upload date:
- Size: 53.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9114d78742ba093602140ec3ea5f1623a76920b1518c90391c3629ccb70d3f62 |
|
MD5 | eec19cd2d77efdd15b4cde456c0a371a |
|
BLAKE2b-256 | c691c53d45ed051d91461854b802f43bcdd3b81b80f208e29065036851faac49 |
Provenance
The following attestation bundles were made for useq_schema-0.6.0-py3-none-any.whl
:
Publisher:
ci.yml
on pymmcore-plus/useq-schema
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
useq_schema-0.6.0-py3-none-any.whl
- Subject digest:
9114d78742ba093602140ec3ea5f1623a76920b1518c90391c3629ccb70d3f62
- Sigstore transparency entry: 150613469
- Sigstore integration time:
- Predicate type: