Skip to main content

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

Project description

pymmcore-plus

License PyPI - Python Version PyPI Conda CI docs codecov

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 an impressive library written by Henry Pinkard designed to make it easier to work with and control the Java Micro-manager application using python. As such, it requires Java to be installed and running in the background (either via the micro-manager GUI application directly, or via a headless 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 immediately get the entire existing micro-manager ecosystem and GUI application. With pymmcore-plus you don't need to install Java, and you have direct access to the memory buffers used by the C++ core, but the GUI side of things is far less mature.

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]"

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.8.6.tar.gz (111.8 kB view details)

Uploaded Source

Built Distribution

pymmcore_plus-0.8.6-py3-none-any.whl (113.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pymmcore_plus-0.8.6.tar.gz
  • Upload date:
  • Size: 111.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for pymmcore_plus-0.8.6.tar.gz
Algorithm Hash digest
SHA256 ca4d71a94a8820f53d21aaa88d13ab65b8b1594c02e97e5dcd4b92fdb3fd9a9a
MD5 ae2467d2c6c6855206599de572366977
BLAKE2b-256 ef0d6c3e13ee0e4eabebb5dea52d345a35fe8d4930d8a4433079bbc99bd09b2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymmcore_plus-0.8.6-py3-none-any.whl
Algorithm Hash digest
SHA256 32fc214eb8df29ec8a2462ef4f5f67c47f75d65e28a687940f1a45363a68d6ed
MD5 a8d33763386bf10f4ba8e2e4c3afeac9
BLAKE2b-256 2652295db986873de64fa5ae615fdb73862211cb9d523e8ae9e3f5a50c4579c6

See more details on using hashes here.

Supported by

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