Package: useq-schema
useq-schemaAn implementation agnostic schema for describing a sequence of events during a
multi-dimensional imaging acquisition.Documentation:https://pymmcore-plus.github.io/useq-schema/The goal of this repo is to provide a specification (and some python utilities)
for generating event objects that can be consumed by microscope acquisition
engines.  Thehopeis that this will encourage interoperability between
various efforts to drive automated image acquisition.The schematriesto remain agnostic to the specific acquisition engine, though
it was designed around the needs of Micro-Manager. One hope is to solicit
feedback from interested parties regarding limitations and/or potential
extensions to the schema.  Similarly, while the "ideal" schema will support
arbitrary dimensions (i.e. more than the conventional position, time, channel,
z, ...), it also hard to avoid hard-coding some assumptions about dimensionality
in certain places.Any and all feedback is welcome!  Please get in touch if you have any thoughts.MDAEventThe primary "event" object isuseq.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).  This is the simpler,
but more important of the two objects.  Downstream libraries that aim to support
useq schema should support driving hardware based on anIterable[MDAEvent].Formicro-manager, this
object is most similar (though notthatsimilar) to the events generated bygenerate-acq-sequencein the clojure acquisition engine.Forpycro-manager, this
object is similar to an individualacquisition eventdictgenerated bymulti_d_acquisition_events,
(and,useq.MDAEventprovides ato_pycromanager()method that returns a
single pycro-manager event dict)your object here?...Seeuseq.MDAEventdocumentationfor more details.Note:useq-schemausespydanticto
define models, so you can retrieve thejson schemafor theMDAEventobject withMDAEvent.schema_json()MDASequenceuseq.MDASequenceis a declarative representation of an entire 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.).  Auseq.MDASequenceobject is itself iterable, and yieldsMDAEventobjects.Formicro-manager, this
object is most similar toorg.micromanager.acquisition.SequenceSettings,
(generated by clicking the "Acquire!" button in the Multi-D Acquisition GUI)Forpycro-manager, this
object is similar to themulti_d_acquisition_eventsconvenience function, (anduseq.MDASequenceprovides ato_pycromanager()method that returns a list of pycro-manager events)your object here?...Seeuseq.MDASequencedocumentationfor more details.exampleMDASequenceusage:fromuseqimportMDASequencemda_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',)events=list(mda_seq)print(len(events))# 720print(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,#  )]serialize to yaml or jsonprint(mda_seq.yaml())axis_order:tpczchannels:-config:DAPI-config:FITCstage_positions:-x:100.0y:100.0z:30.0-x:200.0y:150.0z:35.0time_plan:interval:0:00:01loops:20z_plan:range:4.0step:0.5Executing useq-schema experiments with pymmcore-pluspymmcore-plusimplements an
acquisition engine that can execute anMDASequenceusing
micro-manager in a pure python environment (no Java required).frompymmcore_plusimportCMMCorePluscore=CMMCorePlus()core.loadSystemConfiguration()# loads demo by defaultcore.mda.run(mda_seq)# run the experiment# or, construct a sequence of MDAEvents anyway you likeevents=[MDAEvent(...),MDAEvent(...),...]core.mda.run(events)Seepymmcore-plus documentationfor details