Skip to main content

pymmcore superset providing improved APIs, event handling, and a pure python acquisition engine

Project description

pymmcore-plus

License PyPI - Python Version PyPI Conda CI docs codecov Benchmarks

pymmcore-plus extends pymmcore (python bindings for the C++ micro-manager core) with a number of features designed to facilitate working with Micro-manager in pure python/C environments.

  • pymmcore_plus.CMMCorePlus is a drop-in replacement subclass of pymmcore.CMMCore that provides a number of helpful overrides and additional convenience functions beyond the standard CMMCore API. See CMMCorePlus documentation for details.
  • pymmcore-plus includes an acquisition engine that drives micro-manager for conventional multi-dimensional experiments. It accepts an MDASequence from useq-schema for experiment design/declaration.
  • Adds a callback system that adapts the CMMCore callback object to an existing python event loop (such as Qt, or perhaps asyncio/etc...). The CMMCorePlus class also fixes a number of "missed" events that are not currently emitted by the CMMCore API.

Documentation

https://pymmcore-plus.github.io/pymmcore-plus/

Why not just use pymmcore directly?

pymmcore is (and should probably remain) a thin SWIG wrapper for the C++ code at the core of the Micro-Manager project. It is sufficient to control micromanager via python, but lacks some "niceties" that python users are accustomed to. This library:

  • extends the pymmcore.CMMCore object with additional methods
  • fixes emission of a number of events in MMCore.
  • provide proper python interfaces for various objects like Configuration and Metadata.
  • provides an object-oriented API for Devices and their properties.
  • uses more interpretable Enums rather than int for various constants
  • improves docstrings and type annotations.
  • generally feel more pythonic (note however, camelCase method names from the CMMCore API are not substituted with snake_case).

How does this relate to Pycro-Manager?

Pycro-Manager is designed to make it easier to work with and control the Java Micro-manager application (MMStudio) using python. As such, it requires Java to be installed and for MMStudio to be running a server in another process. The python half communicates with the Java half using ZeroMQ messaging.

In brief: while Pycro-Manager provides a python API to control the Java Micro-manager application (which in turn controls the C++ core), pymmcore-plus provides a python API to control the C++ core directly, without the need for Java in the loop. Each has its own advantages and disadvantages! With pycro-manager you retain the entire existing micro-manager ecosystem and GUI application. With pymmcore-plus, the entire thing is python: you don't need to install Java, and you have direct access to the memory buffers used by the C++ core. Work on recreating the gui application in python being done in pymmcore-widgets and pymmcore-gui.

Quickstart

Install

from pip

pip install pymmcore-plus

# or, add the [cli] extra if you wish to use the `mmcore` command line tool:
pip install "pymmcore-plus[cli]"

# add the [io] extra if you wish to use the tiff or zarr writers
pip install "pymmcore-plus[io]"

from conda

conda install -c conda-forge pymmcore-plus

dev version from github

pip install 'pymmcore-plus[cli] @ git+https://github.com/pymmcore-plus/pymmcore-plus'

Usually, you'll then want to install the device adapters. Assuming you've installed with pip install "pymmcore-plus[cli]", you can run:

mmcore install

(you can also download these manually from micro-manager.org)

See installation documentation for more details.

Usage

Then use the core object as you would pymmcore.CMMCore... but with more features :smile:

from pymmcore_plus import CMMCorePlus

core = CMMCorePlus()
...

Examples

See a number of usage examples in the documentation.

You can find some basic python scripts in the examples directory of this repository

Contributing

Contributions are welcome! See contributing guide.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymmcore_plus-0.13.7.tar.gz (170.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pymmcore_plus-0.13.7-py3-none-any.whl (174.1 kB view details)

Uploaded Python 3

File details

Details for the file pymmcore_plus-0.13.7.tar.gz.

File metadata

  • Download URL: pymmcore_plus-0.13.7.tar.gz
  • Upload date:
  • Size: 170.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pymmcore_plus-0.13.7.tar.gz
Algorithm Hash digest
SHA256 bd6d5a76399dfbf59f7938e8ee0268f7579f2b3fa36e5dcda4ae2094fb888076
MD5 7e82f6e05c68418cc8d0e6efee4da76d
BLAKE2b-256 14c7e4b8d2ac8c8b2cc9c8f9e87bf32ecd404b526462cb61aaa338fb567aeb66

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymmcore_plus-0.13.7.tar.gz:

Publisher: ci.yml on pymmcore-plus/pymmcore-plus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pymmcore_plus-0.13.7-py3-none-any.whl.

File metadata

  • Download URL: pymmcore_plus-0.13.7-py3-none-any.whl
  • Upload date:
  • Size: 174.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pymmcore_plus-0.13.7-py3-none-any.whl
Algorithm Hash digest
SHA256 68c90deb2b684b2d51093109eaafe81c137c3f53530ab65c99443e051b101ac9
MD5 6cdd54ec78bf5318e707e6ba93cd3cf6
BLAKE2b-256 d347e0712e03d49eb57a5b9c10147059ead09b5132bb63e0803cbdb679de9778

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymmcore_plus-0.13.7-py3-none-any.whl:

Publisher: ci.yml on pymmcore-plus/pymmcore-plus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page