Package: pymmcore
pymmcore: Python bindings for MMCoreThe pymmcore package provides Python 3.x bindings to Micro-Manager's MMCore
(the low-level device control/acquisition interface).Using pymmcore, you can control and acquire images from all of the microscope
devices supported by Micro-Manager, but without the GUI application or a Java
runtime.Not to be confused withpycro-manager, which allows
control of the entire Java Micro-Manager application, including its Java APIs,
and more.You might also be interested inpymmcore-pluswhich wraps this library
and provides extra functionality including an acquisition engine.Note: pymmcore is similar to the legacy MMCorePy module (Python 2.x only),
previously distributed with the Micro-Manager application. However, the Python
package for pymmcore is namedpymmcoreinstead ofMMCorePy. This is in part
to avoid importing the wrong package on systems wherepymmcore(usually
installed viapip) andMMCorePy(installed with the Micro-Manager app or
built by the user) both exist.Because pymmcore is distributed separately from Micro-Manager, it needs to be
"pointed" at an existing Micro-Manager installation to access device adapters.
(See the example below.)InstallingSuports Python 3.8 or later and Windows, macOS, and Linux (all 64-bit).pip install pymmcoreOr install via conda:conda install -c conda-forge pymmcoreYou also need a working installation of the Micro-Manager device adapters.
(for a convenient way to install that programmatically, see
themmcore installcommand in pymmcore plus)Quick exampleimportpymmcoreimportos.pathimportosmm_dir="C:/Program Files/Micro-Manager-2.0.x"mmc=pymmcore.CMMCore()os.environ["PATH"]+=os.pathsep.join(["",mm_dir])# adviseable on Windowsmmc.setDeviceAdapterSearchPaths([mm_dir])mmc.loadSystemConfiguration(os.path.join(mm_dir,"MMConfig_demo.cfg"))mmc.snapImage()mmc.getImage()We do not currently have Python-specific documentation for MMCore, but
thepymmcore-plus documentationincludes thepymmcore.CMMCore class. There is alsoC++
documentation.Matching Micro-Manager and pymmcore versionsThe version number of pymmcore is independent of the Micro-Manager version
number; instead it tracks the MMCore and device interface versions.In order to use a given Micro-Manager installation, thedevice interface
versionmust match between pymmcore and the Micro-Manager device adapters
(mmgr_dal_*.dllon Windows).The device interface version of a given Micro-Manager installation can be
viewed inHelp>About Micro-Manager.The device interface version of a given pymmcore version is the fourth part in
the version number, and can also be viewed as follows:importpymmcorepymmcore.CMMCore().getAPIVersionInfo()Note thatgetAPIVersionInfo()should not be confused withgetVersionInfo(),
which returns the version number of MMCore. (The MMCore version is the first 3
parts of the pymmcore version.)For example, pymmcore10.1.1.69.0is based on MMCore10.1.1and has
device interface version69.The device interface version can change independently of the MMCore version,
although it is less common for the device interface version to be incremented
without a corresponding version change of MMCore.Older versions of pymmcore did not include the device interface version in
their version number.For a list of device interface versions for each pymmcore version, see theReleasespage.Loading device adapters on WindowsThe majority of device adapters should load oncesetDeviceAdapterSearchPaths()has been called with the correct directories,
as in the above example. However, you may have trouble with device adapters
that in turn depend on external DLLs (typically equipment vendor libraries).To fix this,first ensure that the Micro-Manager application can correctly
load all the devicesusing the same configuration file. Then, use one of the
following:Temporarily change the current directory to the Micro-Manager installation
when loading the configuration file (useos.chdir()).Add the Micro-Manager directory to thePATHenvironment variable.The first method mimics how the Micro-Manager application works (it always run
with the current directory set to the installation directory). However, the
second method may be more robust in case the external DLLs in turn load
additional DLLs at a later time.Please report any cases where the Micro-Manager application can load a
configuration but pymmcore cannot, even when using the above methods.Code of ConductThis project is covered by theMicro-Manager Code of Conduct.LicenseThe license for pymmcore itself is LGPL 2.1 (seeLICENSE.txt). The MMCore
component of Micro-Manager (which gets built into pymmcore) is also under the
same license. Other parts of Micro-Manager are under different licenses.