Skip to content

CMMCorePlus

CMMCorePlus(mm_path: str | None = None, adapter_paths: Sequence[str] = ())

Bases: CMMCore

Wrapper for CMMCore with extended functionality.

CMMCorePlus is a subclass of pymmcore.CMMCore with additional functionality, and some overrides for the sake of convenience or fixed behavior. It aims to be a drop-in replacement. Most methods behave as they do in CMMCore, but many return enums or Configuration objects instead of plain integers and SWIG objects, and many setters emit events even when the device adapter doesn't. Additions include an acquisition engine (run_mda) and object-oriented views onto devices, properties and config groups (e.g. getDeviceObject). (registerCallback is disallowed; use events instead.)

Parameters:

Name Type Description Default
mm_path str | None

Path to the Micro-Manager installation. If None (default), will use the return value of pymmcore_plus.find_micromanager.

None
adapter_paths Sequence[str]

Paths to search for device adapters, by default ()

()

Method summary

The table below lists all of the methods of CMMCorePlus, including the ones it inherits unchanged from pymmcore.CMMCore. Use the filters to show only what pymmcore-plus adds or overrides (each override says why it was changed). Deprecated methods are hidden unless you tick "show deprecated".

✨ added by pymmcore-plus  Â·  âž• overridden  Â·  no icon: inherited unchanged from pymmcore.CMMCore

MethodOriginCategoryDescription
addGalvoPolygonVertex(galvoLabel, polygonIndex, x, y)GalvosAdd a vertex to a galvo polygon.
canSequenceEvents(e1, e2, cur_length)✨Hardware sequencingCheck whether two useq.MDAEvent are sequenceable by this core instance.
channelGroup_pattern✨Config groups & presetsThe regex pattern used to identify channel groups.
clearCircularBuffer()Images & bufferRemoves all images from the circular buffer.
clearROI()CamerasSet the region of interest of the current camera to the full frame.
debugLogEnabled()Logging & errorsIndicates if logging of debug messages is enabled
defineConfig(groupName, configName, deviceLabel, propName, value) (2 overloads)➕Config groups & presetsDefines a configuration.
Why override? To emit a configDefined event. Also, if groupName is not a defined group, then defineConfigGroup(groupName) is called.
defineConfigGroup(groupName)Config groups & presetsCreates an empty configuration group.
definePixelSizeConfig(resolutionID) (2 overloads)➕Pixel sizeDefines an empty pixel size entry.
Why override? To emit a pixelSizeChanged event.
defineStateLabel(stateDeviceLabel, state, stateLabel)State devicesDefines a label for the specific state.
deleteConfig(groupName, configName, deviceLabel, propName) (2 overloads)➕Config groups & presetsDelete configName from groupName.
Why override? To emit a configDeleted event.
deleteConfigGroup(groupName)➕Config groups & presetsDeletes an entire configuration group.
Why override? To emit a configGroupDeleted event.
deleteGalvoPolygons(galvoLabel)GalvosRemove all added polygons
deletePixelSizeConfig(resolutionID)➕Pixel sizeDelete the pixel size configuration for the given resolutionID.
Why override? To emit a pixelSizeChanged event.
describe(sort, show_config_groups, show_available)✨GeneralPrint information table with the current configuration.
detectDevice(deviceLabel)➕DevicesTries to communicate to a device through a given serial port.
Why override? The returned pymmcore_plus.DeviceDetectionStatus enum is more interpretable than the raw int returned by pymmcore
deviceBusy(label)DevicesChecks the busy status of the specific device.
deviceTypeBusy(devType)DevicesChecks the busy status for all devices of the specific type.
displaySLMImage(slmLabel)SLMsDisplay the waiting image on the SLM.
enableContinuousFocus(enable)AutofocusEnables or disables the operation of the continuous focusing hardware device.
enableDebugLog(enable)Logging & errorsEnable or disable logging of debug messages.
enableFeature(name, enable)Logging & errorsEnable or disable the given Core feature.
enableStderrLog(enable)Logging & errorsEnables or disables log message display on the standard console.
events✨Acquisition engine & eventsSignaler for core events.
fixImage(img, ncomponents)✨Images & bufferFix img shape/dtype based on self.getNumberOfComponents().
fullFocus()AutofocusPerforms focus acquisition and lock for the one-shot focusing device.
getAdapterObject(library_name)✨DevicesReturn an Adapter object bound to library_name on this core.
getAllowedBinningValues() (2 overloads)CamerasReturns allowed binning values for the current camera.
getAllowedPropertyValues(label, propName)PropertiesReturns all valid values for the specified property.
getAPIVersionInfo()GeneralReturns the module and device interface versions.
getAutoFocusDevice()AutofocusReturns the label of the currently selected auto-focus device.
getAutoFocusOffset()➕AutofocusReturn the current offset of the one-shot focusing device.
Why override? For known autofocus devices with a separate offset device (see setAutoFocusOffset), this returns the position of that offset device.
getAutoShutter()ShuttersReturns the current setting of the auto-shutter option.
getAvailableConfigGroups()Config groups & presetsReturns the names of all defined configuration groups
getAvailableConfigs(configGroup)Config groups & presetsReturns all defined configuration (preset) names in a given group
getAvailableDeviceDescriptions(library)DevicesGet descriptions for available devices from the specified library.
getAvailableDevices(library)DevicesGet available devices from the specified device library.
getAvailableDeviceTypes(library)DevicesGet type information for available devices from the specified library.
getAvailablePixelSizeConfigs()Pixel sizeReturns all defined resolution preset names
getBinning() (2 overloads)CamerasReturns the current binning factor of the camera.
getBufferFreeCapacity()Images & bufferReturns the number of images that can be added to the buffer without overflowing.
getBufferTotalCapacity()Images & bufferReturns the total number of images that can be stored in the buffer
getBytesPerPixel()CamerasHow many bytes for each pixel.
getCameraChannelName(channelNr)CamerasReturns the name of the requested channel as known by the default camera
getCameraChannelNames()✨CamerasConvenience method to call getCameraChannelName for all camera channels.
getCameraDevice()CamerasReturns the label of the currently selected camera device.
getChannelGroup()Config groups & presetsReturns the group determining the channel selection.
getCircularBufferMemoryFootprint()Images & bufferReturns the size of the Circular Buffer in MB
getConfigData(configGroup, configName, native) (2 overloads)➕Config groups & presetsReturn the configuration object for a given configGroup and configName.
Why override? The pymmcore_plus.Configuration object returned when native=False (the default) provides a nicer Mapping interface. Pass native=True to get the original pymmcore.Configuration object.
getConfigGroupObject(group_name, allow_missing)✨Config groups & presetsReturn a ConfigGroup object bound to group_name on this core.
getConfigGroupState(group, native) (2 overloads)➕Config groups & presetsReturn the state of the devices included in the specified group.
Why override? The pymmcore_plus.Configuration object returned when native=False (the default) provides a nicer Mapping interface. Pass native=True to get the original pymmcore.Configuration object.
getConfigGroupStateFromCache(group, native) (2 overloads)➕Config groups & presetsReturn the state of the system cache, for the devices in the specified group.
Why override? The pymmcore_plus.Configuration object returned when native=False (the default) provides a nicer Mapping interface. Pass native=True to get the original pymmcore.Configuration object.
getConfigState(group, config, native)➕Config groups & presetsReturn state of devices included in the specified configuration.
Why override? The pymmcore_plus.Configuration object returned when native=False (the default) provides a nicer Mapping interface. Pass native=True to get the original pymmcore.Configuration object.
getCoreErrorText(code)Logging & errorsReturns a pre-defined error test with the given error code
getCurrentConfig(groupName)Config groups & presetsReturns the current configuration (preset) for a given group.
getCurrentConfigFromCache(groupName)Config groups & presetsReturns the configuration for a given group based on the data in the cache.
getCurrentDeviceOfType(device_type)✨DevicesReturn the current device of type device_type.
getCurrentFocusScore()AutofocusReturns the focus score from the default focusing device measured at the current Z position.
getCurrentPixelSizeConfig() (2 overloads)Pixel sizeGet the current pixel configuration name
getDeviceAdapterNames()DevicesReturn the names of discoverable device adapters.
getDeviceAdapterSearchPaths()DevicesReturn the current device adapter search paths.
getDeviceDelayMs(label)DevicesReports action delay in milliseconds for the specific device.
getDeviceDescription(label)DevicesReturns description text for a given device label. "Description" is determined by the library and is immutable.
getDeviceInitializationState(label)➕DevicesQueries the initialization state of the given device.
Why override? The returned pymmcore_plus.DeviceInitializationState enum is more interpretable than the raw int returned by pymmcore
getDeviceLibrary(label)DevicesReturns device library (aka module, device adapter) name.
getDeviceName(label)DevicesReturns device name for a given device label.
getDeviceObject(device_label, device_type) (17 overloads)✨DevicesReturn a Device object bound to device_label on this core.
getDevicePropertyNames(label)PropertiesReturns all property names supported by the device.
getDeviceSchema(device_label)✨DevicesReturn JSON-schema describing device device_label and its properties.
getDeviceTimeoutMs(label)DevicesReturns the per-device timeout in milliseconds, or the default if not set.
getDeviceType(label)➕DevicesReturn device type for a given device.
Why override? The returned pymmcore_plus.DeviceType enum is more interpretable than the raw int returned by pymmcore
getExposure() (2 overloads)CamerasReturns the current exposure setting of the camera in milliseconds.
getExposureSequenceMaxLength(cameraLabel)Hardware sequencingGets the maximum length of a camera's exposure sequence.
getFocusDevice()StagesReturns the label of the currently selected focus device.
getFocusDirection(stageLabel)➕StagesReturn the focus direction of a stage.
Why override? The returned pymmcore_plus.FocusDirection enum is more interpretable than the raw int returned by pymmcore
getGalvoChannel(galvoLabel)GalvosGet the name of the active galvo channel (for a multi-laser galvo device).
getGalvoDevice()GalvosReturns the label of the currently selected Galvo device.
getGalvoPosition(galvoDevice) (2 overloads)GalvosGet x,y position of the galvo device.
getGalvoXMinimum(galvoLabel)GalvosGet the Galvo x minimum
getGalvoXRange(galvoLabel)GalvosGet the Galvo x range
getGalvoYMinimum(galvoLabel)GalvosGet the Galvo y minimum
getGalvoYRange(galvoLabel)GalvosGet the Galvo y range
getImage(numChannel, fix) (2 overloads)➕Images & bufferReturn the internal image buffer.
Why override? To fix the shape of images with n_components > 1 (like RGB images)
getImageBitDepth()Images & bufferHow many bits of dynamic range are to be expected from the camera.
getImageBufferSize()Images & bufferReturns the size of the internal image buffer.
getImageHeight()Images & bufferVertical dimension of the image buffer in pixels.
getImageProcessorDevice()CamerasReturns the label of the currently selected image processor device.
getImageWidth()Images & bufferHorizontal dimension of the image buffer in pixels.
getInstalledDeviceDescription(hubLabel, peripheralLabel)DevicesReturns description from the specified peripheral on hubLabel device.
getInstalledDevices(hubLabel)DevicesPerforms auto-detection and loading of child devices that are attached to a Hub device.
getLastFocusScore()AutofocusReturns the latest focus score from the focusing device.
getLastImage()Images & bufferGets the last image from the circular buffer.
getLastImageAndMD(channel, slice, fix) (2 overloads)✨Images & bufferReturn last image from the circular buffer along with metadata.
getLastImageMD(channel, slice, md) (2 overloads)Images & bufferReturns a pointer to the pixels of the image that was last inserted into the circular buffer. Also provides all metadata associated with that image
getLoadedDevices()DevicesReturns an array of labels for currently loaded devices.
getLoadedDevicesOfType(devType)DevicesReturns an array of labels for currently loaded devices of specific type.
getLoadedPeripheralDevices(hubLabel)DevicesReturn labels of all loaded peripherals of hubLabel device.
getMagnificationFactor()Pixel sizeReturns the product of all Magnifiers in the system or 1.0 when none is found. This is used internally by GetPixelSizeUm
getMMCoreVersionMajor()General
getMMCoreVersionMinor()General
getMMCoreVersionPatch()General
getMMDeviceDeviceInterfaceVersion()General
getMMDeviceModuleInterfaceVersion()General
getMultiROI()➕CamerasGet multiple ROIs from the current camera device.
Why override? So that the user doesn't need to pass in four empty pymmcore.UnsignedVector() objects.
getNBeforeLastImageAndMD(n, fix)✨Images & bufferReturn image taken n images ago along with associated metadata.
getNBeforeLastImageMD(n, md)Images & bufferReturns a pointer to the pixels of the image that was inserted n images ago. Also provides all metadata associated with that image
getNumberOfCameraChannels()CamerasReturns the number of simultaneous channels the default camera is returning.
getNumberOfComponents()CamerasReturns the number of components the default camera is returning.
getNumberOfStates(stateDeviceLabel)State devicesReturns the total number of available positions (states).
getOrGuessChannelGroup()✨Config groups & presetsGet the channelGroup or find a likely set of candidates.
getParentLabel(peripheralLabel)DevicesReturns parent device. Returns empty string if no parent is found.
getPhysicalCameraDevice(channel_index)✨CamerasReturn the name of the actual camera device for a given channel index.
getPixelSizeAffine() (2 overloads)Pixel sizeReturns the current Affine Transform to related camera pixels with stage movement.
getPixelSizeAffineByID(resolutionID)Pixel sizeReturns the Affine Transform to related camera pixels with stage movement for the requested pixel size group. The raw affine transform without correction for binning and magnification will be returned.
getPixelSizeConfigData(configName, native) (2 overloads)➕Pixel sizeReturn the configuration object for a given pixel size preset configName.
Why override? The pymmcore_plus.Configuration object returned when native=False (the default) provides a nicer Mapping interface. Pass native=True to get the original pymmcore.Configuration object.
getPixelSizedxdz() (3 overloads)Pixel sizeReturns the angle between the camera's x axis and the axis (direction) of the z drive.
getPixelSizedydz() (3 overloads)Pixel sizeReturns the angle between the camera's y axis and the axis (direction) of the z drive.
getPixelSizeOptimalZUm() (3 overloads)Pixel sizeReturns the optimal z step size in um, optionally using cached pixel configuration.
getPixelSizeUm() (2 overloads)Pixel sizeReturns the current pixel size in microns.
getPixelSizeUmByID(resolutionID)Pixel sizeReturns the pixel size in um for the requested pixel size group
getPosition() (2 overloads)StagesReturns the current position of the current FocusDevice in microns.
getPrimaryLogFile()Logging & errorsReturn the name of the primary Core log file.
getPrimaryLogLevel()Logging & errorsReturn the current primary log file level.
getProperty(label, propName)PropertiesReturns the property value for the specified device.
getPropertyFromCache(deviceLabel, propName)PropertiesReturns the cached property value for the specified device.
getPropertyLowerLimit(label, propName)PropertiesReturns the property lower limit value, if the property has limits - 0 otherwise.
getPropertyObject(device_label, property_name)✨PropertiesReturn a DeviceProperty object bound to a device/property on this core.
getPropertySequenceMaxLength(label, propName)Hardware sequencingQueries device property for the maximum number of events that can be put in a sequence
getPropertyType(label, propName)➕PropertiesReturn the intrinsic property type for a given device and property.
Why override? The returned pymmcore_plus.PropertyType enum is more interpretable than the raw int returned by pymmcore
getPropertyUpperLimit(label, propName)PropertiesReturns the property upper limit value, if the property has limits - 0 otherwise.
getPumpFlowrate(pumpLabel)PumpsReturn the flowrate of the pump in uL per second
getPumpMaxVolume(pumpLabel)PumpsReturn max volume of the pump in uL
getPumpPressureKPa(pumpLabel)PumpsReturn the pressure of the pump in kPa.
getPumpVolume(pumpLabel)PumpsReturn the fluid volume in the pump in uL
getRemainingImageCount()Images & bufferReturns number ofimages available in the Circular Buffer
getROI() (2 overloads)CamerasReturn the current hardware region of interest for a camera.
getSerialPortAnswer(portLabel, term)Serial portsContinuously read from the serial port until the terminating sequence is encountered.
getShutterDevice()ShuttersReturns the label of the currently selected shutter device.
getShutterOpen() (2 overloads)ShuttersReturns the state of the currently selected (default) shutter.
getSLMBytesPerPixel(slmLabel)SLMsReturns the number of bytes per SLM pixel
getSLMDevice()SLMsReturns the label of the currently selected SLM device.
getSLMExposure(slmLabel)SLMsReturns the exposure time that will be used by the SLM for illumination
getSLMHeight(slmLabel)SLMsReturns the height (in "pixels") of the SLM
getSLMNumberOfComponents(slmLabel)SLMsReturns the number of components (usually these depict colors) of the SLM.
getSLMSequenceMaxLength(slmLabel)SLMsFor SLMs that support sequences, returns the maximum length of the sequence that can be uploaded to the device
getSLMWidth(slmLabel)SLMsReturns the width (in "pixels") of the SLM
getStageSequenceMaxLength(stageLabel)Hardware sequencingGets the maximum length of a stage's position sequence.
getState(stateDeviceLabel)State devicesReturns the current state (position) on the specific device.
getStateFromLabel(stateDeviceLabel, stateLabel)State devicesObtain the state for a given label.
getStateLabel(stateDeviceLabel)State devicesReturns the current state as the label (string).
getStateLabels(stateDeviceLabel)State devicesReturn labels for all states
getStderrLogLevel()Logging & errorsReturn the current stderr log level.
getSystemState(native)➕System state & config filesReturn the entire system state.
Why override? The pymmcore_plus.Configuration object returned when native=False (the default) provides a nicer Mapping interface. Pass native=True to get the original pymmcore.Configuration object.
getSystemStateCache(native) (2 overloads)➕System state & config filesReturn the entire system state from cache.
Why override? The pymmcore_plus.Configuration object returned when native=False (the default) provides a nicer Mapping interface. Pass native=True to get the original pymmcore.Configuration object.
getTaggedImage(channel_index)✨Images & bufferReturn getImage as named tuple with metadata.
getTags(meta, channel_index)✨Images & bufferReturn a dict of metadata tags for the state of the core.
getTimeoutMs()DevicesGet the timeout for all wait commands.
getVersionInfo()GeneralDisplays core version.
getXPosition() (2 overloads)StagesObtains the current position of the X axis of the XY stage in microns.
getXYPosition() (2 overloads)StagesObtains the current position of the XY stage in microns.
getXYStageDevice()StagesReturns the label of the currently selected XYStage device.
getXYStageSequenceMaxLength(xyStageLabel)Hardware sequencingGets the maximum length of an XY stage's position sequence.
getYPosition() (2 overloads)StagesObtains the current position of the Y axis of the XY stage in microns.
getZPosition()✨StagesObtains the current position of the Z axis of the Z stage in microns.
guessObjectiveDevices()✨State devicesFind any loaded devices that are likely to be an Objective/Nosepiece.
hasDeviceTimeout(label)DevicesReturns True if a per-device timeout has been set for the given device.
hasProperty(label, propName)PropertiesChecks if device has a property with a specified name.
hasPropertyLimits(label, propName)PropertiesQueries device if the specific property has limits.
home(xyOrZStageLabel)StagesPerform a hardware homing operation for an XY or focus/Z stage.
incrementalFocus()AutofocusPerforms incremental focus for the one-shot focusing device.
initializeAllDevices()DevicesCalls Initialize() method for each loaded device.
initializeCircularBuffer()Images & bufferInitialize circular buffer based on the current camera settings.
initializeDevice(label)DevicesInitializes specific device.
instance()✨GeneralReturn the global singleton instance of CMMCorePlus.
invertPumpDirection(pumpLabel, invert)PumpsSets whether the pump direction needs to be inverted
isBufferOverflowed()Images & bufferIndicates whether the circular buffer is overflowed
isConfigDefined(groupName, configName)Config groups & presetsChecks if the configuration already exists within a group.
isContinuousFocusDrive(stageLabel)AutofocusCheck if a stage has continuous focusing capability.
isContinuousFocusEnabled()AutofocusChecks if the continuous focusing hardware device is ON or OFF.
isContinuousFocusLocked()AutofocusReturns the lock-in status of the continuous focusing device.
isExposureSequenceable(cameraLabel)Hardware sequencingQueries camera if exposure can be used in a sequence
isFeatureEnabled(name)Logging & errorsReturn whether the given Core feature is currently enabled.
isGroupDefined(groupName)Config groups & presetsChecks if the group already exists.
isMultiROIEnabled()CamerasQueries the camera to determine if multiple ROIs are currently set.
isMultiROISupported()CamerasQueries the camera to determine if it supports multiple ROIs.
isPixelSizeConfigDefined(resolutionID)Pixel sizeChecks if the Pixel Size Resolution already exists
isPropertyPreInit(label, propName)PropertiesTells us whether the property must be defined prior to initialization.
isPropertyReadOnly(label, propName)PropertiesTells us whether the property can be modified.
isPropertySequenceable(label, propName)Hardware sequencingQueries device if the specified property can be used in a sequence
isPumpDirectionInverted(pumpLabel)PumpsReturn True if pump direction needs to be inverted
isSequenceRunning() (2 overloads)Images & bufferCheck if the current camera is acquiring the sequence.
isStageLinearSequenceable(stageLabel)Hardware sequencingQueries if the stage can be used in a linear sequence.
isStageSequenceable(stageLabel)Hardware sequencingQueries stage if it can be used in a sequence
isStageUsingCallbacks(stageLabel)StagesQueries whether the stage uses callbacks to signal position changes.
isXYStageSequenceable(xyStageLabel)Hardware sequencingQueries XY stage if it can be used in a sequence
isXYStageUsingCallbacks(xyStageLabel)StagesQueries whether the XY stage uses callbacks to signal position changes.
iterConfigGroups()✨Config groups & presetsIterate ConfigGroup objects for all configs.
iterDeviceAdapters(adapter_pattern, as_object) (2 overloads)✨DevicesIterate over all available device adapters.
iterDevices(device_type, device_label, device_adapter, as_object) (2 overloads)✨DevicesIterate over currently loaded devices.
iterProperties(property_type, property_name_pattern, device_type, device_label, has_limits, is_read_only, is_sequenceable, as_object) (2 overloads)✨PropertiesIterate over currently loaded (device_label, property_name) pairs.
loadDevice(label, moduleName, deviceName)➕DevicesLoad a device from the plugin library.
Why override? To add much better error messages in the case of failure.
loadExposureSequence(cameraLabel, exposureSequence_ms)Hardware sequencingTransfer a sequence of exposure times to the camera.
loadGalvoPolygons(galvoLabel)GalvosLoad a set of galvo polygons to the device
loadPropertySequence(label, propName, eventSequence)Hardware sequencingTransfer a sequence of events/states/whatever to the device.
loadSLMSequence(slmLabel, imageSequence)SLMsLoad a sequence of images into the SLM
loadStageSequence(stageLabel, positionSequence)Hardware sequencingTransfer a sequence of events/states/whatever to the device.
loadSystemConfiguration(fileName)➕System state & config filesLoad a system config file conforming to the MM .cfg format.
Why override? This method overrides the default implementation to A) allow loading the MMConfig_demo.cfg file by default, B) to provide more flexible path declarations and C) better error messages when the file cannot be found.
loadSystemState(fileName)System state & config filesLoads the system configuration from the text file conforming to the MM specific format.
loadXYStageSequence(xyStageLabel, xSequence, ySequence)Hardware sequencingTransfer a sequence of stage positions to the xy stage.
log(msg, level) (2 overloads)Logging & errorsLog a message at the given level.
logMessage(msg) (2 overloads)Logging & errorsRecord text message in the log file.
mda✨Acquisition engine & eventsReturn the MDARunner for this CMMCorePlus instance.
noop()GeneralA static method that does nothing.
objective_device_pattern✨State devicesPattern used to guess objective device labels.
pointGalvoAndFire(galvoLabel, x, y, pulseTime_us)GalvosSet the Galvo to an x,y position and fire the laser for a predetermined duration.
popNextImage(fix)➕Images & bufferGets and removes the next image from the circular buffer.
Why override? to add the fix parameter, which reshapes multi-component images (like RGB images) to (w, h, n_components) using fixImage by default.
popNextImageAndMD(channel, slice, fix) (2 overloads)✨Images & bufferGets and removes the next image (and metadata) from the circular buffer.
popNextImageMD(channel, slice, md) (2 overloads)Images & bufferGets and removes the next image (and metadata) from the circular buffer
popNextTaggedImage(channel_index)✨Images & bufferReturn popNextImageAndMD as named tuple with metadata.
prepareSequenceAcquisition(cameraLabel)Images & bufferPrepare the camera for the sequence acquisition to save the time in the
pressurePumpCalibrate(pumpLabel)PumpsCalibrates the pressure pump.
pressurePumpRequiresCalibration(pumpLabel)PumpsReturn True if pump requires calibration before operation.
pressurePumpStop(pumpLabel)PumpsStops the pressure pump.
pumpDispenseDurationSeconds(pumpLabel, seconds)PumpsDispenses for the provided duration (in seconds) at the set flowrate.
pumpDispenseVolumeUl(pumpLabel, microLiter)PumpsDispenses the provided volume (in uL) at the set flowrate.
pumpStart(pumpLabel)PumpsStart dispensing until syringe is empty, or manually stopped.
readFromSerialPort(portLabel)Serial portsReads the contents of the Rx buffer.
register_mda_engine(engine)✨Acquisition engine & eventsSet the MDA Engine to be used on run_mda.
registerCallback()➕Acquisition engine & eventsregisterCallback is disallowed in pymmcore-plus!
renameConfig(groupName, oldConfigName, newConfigName)Config groups & presetsRenames a configuration within a specified group.
renameConfigGroup(oldGroupName, newGroupName)Config groups & presetsRenames a configuration group.
renamePixelSizeConfig(oldConfigName, newConfigName)Pixel sizeRenames a pixel size configuration.
reset()GeneralUnloads all devices from the core, clears all configuration data and property blocks.
run_mda(events, output, block, dimension_overrides)✨Acquisition engine & eventsRun a sequence of useq.MDAEvent on a new thread.
runGalvoPolygons(galvoLabel)GalvosRun a loop of galvo polygons
runGalvoSequence(galvoLabel)GalvosRun a sequence of galvo positions
saveSystemConfiguration(filename)➕System state & config filesSaves the current system configuration to a text file.
Why override? To also save pixel size configurations.
saveSystemState(fileName)System state & config filesSaves the current system state to a text file of the MM specific format.
setAdapterOrigin(newZUm) (2 overloads)StagesEnable software translation of coordinates for the current focus/Z stage.
setAdapterOriginXY(newXUm, newYUm) (2 overloads)StagesEnable software translation of coordinates for the current XY stage.
setAutoFocusDevice(focusLabel)AutofocusSets the current auto-focus device.
setAutoFocusOffset(offset)➕AutofocusApplies offset the one-shot focusing device.
setAutoShutter(state)➕ShuttersSet shutter to automatically open and close when an image is acquired.
Why override? To emit an autoShutterSet event.
setBinning(binning) (2 overloads)CamerasSets the binning factor of the current camera.
setCameraDevice(cameraLabel)CamerasSets the current camera device.
setChannelGroup(channelGroup)➕Config groups & presetsSpecifies the group determining the channel selection.
setCircularBufferMemoryFootprint(sizeMB)Images & bufferReserve memory for the circular buffer.
setConfig(groupName, configName)➕Config groups & presetsApplies a configuration to a group.
Why override? The native onConfigGroupChanged callback is not always called whenever CMMCore.setConfig has been called. We override here to emit a configSet event whenever setConfig is called. See <https://github.com/micro-manager/mmCoreAndDevices/issues/25> for details.
setContext(**kwargs)✨System state & config filesSet core properties in a context restoring the initial values on exit.
setDeviceAdapterSearchPaths(paths)➕DevicesSet the device adapter search paths.
Why override? In cases where MM device adapters use dynamically loaded libraries, the device adapter search paths must also be added to the PATH environment variable (e.g. <https://github.com/micro-manager/pymmcore/issues/28>). This method overrides the default implementation to ensure that the PATH environment variable is updated when the device adapter search paths are changed.
setDeviceDelayMs(label, delayMs)DevicesOverrides the built-in value for the action delay.
setDeviceTimeoutMs(label, timeoutMs)DevicesSets a per-device timeout in milliseconds.
setExposure(exp) (2 overloads)CamerasSets the exposure setting of the current camera in milliseconds.
setFocusDevice(focusLabel)➕StagesSet the current Focus Device and emit a propertyChanged signal.
setFocusDirection(stageLabel, sign)StagesSet the focus direction of a stage.
setGalvoDevice(galvoLabel)GalvosSets the current galvo device.
setGalvoIlluminationState(galvoLabel, on)GalvosSet the galvo's illumination state to on or off
setGalvoPolygonRepetitions(galvoLabel, repetitions)GalvosSet the number of times to loop galvo polygons
setGalvoPosition(galvoLabel, x, y)GalvosSet the Galvo to an x,y position.
setGalvoSpotInterval(galvoLabel, pulseTime_us)GalvosSet the SpotInterval for the specified galvo device.
setImageProcessorDevice(procLabel)CamerasSets the current image processor device.
setMultiROI(xs, ys, widths, heights)CamerasSet multiple ROIs for the current camera device.
setOrigin() (2 overloads)StagesZero the current focus/Z stage's coordinates at the current position.
setOriginX() (2 overloads)StagesZero the given XY stage's X coordinate at the current position.
setOriginXY() (2 overloads)StagesZero the current XY stage's coordinates at the current position.
setOriginY() (2 overloads)StagesZero the given XY stage's Y coordinate at the current position.
setParentLabel(deviceLabel, parentHubLabel)DevicesSets parent device label
setPixelSizeAffine(resolutionID, affine)Pixel sizeSets the raw affine transform for the specific pixel size configuration.
setPixelSizeConfig(resolutionID)Pixel sizeApplies a Pixel Size Configuration.
setPixelSizedxdz(resolutionID, dXdZ)Pixel sizeSets the pixel size in the X direction in microns.
setPixelSizedydz(resolutionID, dYdZ)Pixel sizeSets the pixel size in the Y direction in microns.
setPixelSizeOptimalZUm(resolutionID, optimalZ)Pixel sizeSets the pixel size in the Z direction in microns.
setPixelSizeUm(resolutionID, pixSize)➕Pixel sizeSet pixel size in microns for the specified resolutionID.
Why override? To emit a pixelSizeChanged event.
setPosition(position) (2 overloads)StagesSets the position of the current FocusDevice in microns.
setPrimaryLogFile(filename) (2 overloads)Logging & errorsSet the primary Core log file.
setPrimaryLogFileRotation(maxFileSize, maxBackupCount)Logging & errorsSet the primary log file rotation parameters.
setPrimaryLogLevel(level)Logging & errorsSet the log level for the primary log file.
setProperty(label, propName, propValue)➕PropertiesSet property named propName on device label to propValue.
Why override? In MMCore, the calling of the onPropertyChanged callback is left to the underlying device adapter, which means it is not always called. This method overrides the default implementation to ensure that events.propertyChanged is *always* emitted when setProperty has been called and the property Value has actually changed.
setPumpFlowrate(pumpLabel, volume)PumpsSet the flowrate of the pump in uL per second
setPumpMaxVolume(pumpLabel, volume)PumpsSet the max volume of the pump in uL
setPumpPressureKPa(pumpLabel, pressure)PumpsSets the pressure of the pump in kPa.
setPumpVolume(pumpLabel, volume)PumpsSets the volume of fluid in the pump in uL.
setRelativePosition(d) (2 overloads)StagesSets the relative position of the stage in microns.
setRelativeXYPosition(dx, dy) (2 overloads)StagesSets the relative position of the XY stage in microns.
setRelativeXYZPosition(dx, dy, dz)✨StagesSets the relative XYZ position in microns.
setROI(x, y, width, height) (2 overloads)➕CamerasSet the camera Region of Interest (ROI).
Why override? To emit a roiSet event.
setSerialPortCommand(portLabel, command, term)Serial portsSend string to the serial device and return an answer.
setSerialProperties(portName, answerTimeout, baudRate, delayBetweenCharsMs, handshaking, parity, stopBits)Serial portsSets all com port properties in a single call.
setShutterDevice(shutterLabel)Shuttersthe current shutter device.
setShutterOpen(state) (2 overloads)➕ShuttersOpen or close the currently selected or shutterLabel shutter.
Why override? To emit a propertyChanged event.
setSLMDevice(slmLabel)SLMsSets the current slm device.
setSLMExposure(slmLabel, exposure_ms)SLMsFor SLM devices with build-in light source (such as projectors), this will set the exposure time, but not (yet) start the illumination
setSLMImage(slmLabel, pixels) (2 overloads)SLMsWrite an image to the SLM .
setSLMPixelsTo(slmLabel, intensity) (2 overloads)SLMsSet all SLM pixels to a single 8-bit intensity.
setStageLinearSequence(stageLabel, dZ_um, nSlices)Hardware sequencingLoads a linear sequence (defined by stepsize and nr. of steps) into the device.
setState(stateDeviceLabel, state)➕State devicesSet state (by position) on stateDeviceLabel, with reliable event emission.
Why override? In MMCore, the calling of the onPropertyChanged callback is left to the underlying device adapter, which means it is not always called. This method overrides the default implementation to ensure that events.propertyChanged is *always* emitted when setProperty has been called and the property Value has actually changed.
setStateLabel(stateDeviceLabel, stateLabel)➕State devicesSet state (by label) on stateDeviceLabel, with reliable event emission.
Why override? In MMCore, the calling of the onPropertyChanged callback is left to the underlying device adapter, which means it is not always called. This method overrides the default implementation to ensure that events.propertyChanged is *always* emitted when setProperty has been called and the property Value has actually changed.
setStderrLogLevel(level)Logging & errorsSet the stderr log level.
setSystemState(conf)System state & config filesSets all properties contained in the Configuration object.
setTimeoutMs(timeoutMs)DevicesSets the timeout for all wait commands.
setXYPosition(x, y) (2 overloads)➕StagesSets the position of the XY stage in microns.
Why override? to store the last commanded stage position internally.
setXYStageDevice(xyStageLabel)StagesSets the current XY device.
setZPosition(val)✨StagesSet the position of the current focus device in microns.
sleep(intervalMs)GeneralWaits (blocks the calling thread) for specified time in milliseconds.
snap(numChannel, fix)✨Images & bufferSnap and return an image.
snapImage()➕Images & bufferAcquires a single image with current settings.
Why override? To emit the imageSnapped event after snapping an image, and to emit shutter property changes if getAutoShutter is True.
startContinuousSequenceAcquisition(intervalMs)➕Images & bufferStart a ContinuousSequenceAcquisition.
Why override? To emit the continuousSequenceAcquisitionStarting and continuousSequenceAcquisitionStarted events.
startExposureSequence(cameraLabel)Hardware sequencingStarts an ongoing sequence of triggered exposures in a camera.
startPropertySequence(label, propName)Hardware sequencingStarts an ongoing sequence of triggered events in a property of a device.
startSecondaryLogFile(filename, enableDebug) (3 overloads)Logging & errorsStart capturing logging output into an additional file.
startSequenceAcquisition(numImages, intervalMs, stopOnOverflow) (2 overloads)➕Images & bufferStarts streaming camera sequence acquisition.
Why override? To emit the sequenceAcquisitionStarting and sequenceAcquisitionStarted events.
startSLMSequence(slmLabel)SLMsStarts the sequence previously uploaded to the SLM
startStageSequence(stageLabel)Hardware sequencingStarts an ongoing sequence of triggered events in a stage.
startXYStageSequence(xyStageLabel)Hardware sequencingStarts an ongoing sequence of triggered events in an XY stage.
state(cached, include_time)✨GeneralReturn info on the current state of the core.
stderrLogEnabled()Logging & errorsIndicates whether logging output goes to stdErr
stop(xyOrZStageLabel)StagesStop the XY or focus/Z stage motors
stopExposureSequence(cameraLabel)Hardware sequencingStops an ongoing sequence of triggered exposures in a camera.
stopPropertySequence(label, propName)Hardware sequencingStops an ongoing sequence of triggered events in a property of a device.
stopSecondaryLogFile(handle)Logging & errorsStop capturing logging output into an additional file.
stopSequenceAcquisition(cameraLabel)➕Images & bufferStops streaming camera sequence acquisition.
Why override? To emit a sequenceAcquisitionStopped event.
stopSLMSequence(slmLabel)SLMsStops the SLM sequence if previously started
stopStageSequence(stageLabel)Hardware sequencingStops an ongoing sequence of triggered events in a stage.
stopXYStageSequence(xyStageLabel)Hardware sequencingStops an ongoing sequence of triggered events in an XY stage.
supportsDeviceDetection(deviceLabel)DevicesReturn whether or not the device supports automatic device detection (i.e.
systemBusy()DevicesChecks the busy status of the entire system.
systemConfigurationFile()✨System state & config filesReturn the path to the last loaded system configuration file, or None.
unloadAllDevices()➕DevicesUnload all devices from the core and reset all configuration data.
Why override? To add logging.
unloadDevice(label)DevicesUnloads the device from the core and adjusts all configuration data.
unloadLibrary(moduleName)DevicesForcefully unload a library.
unsetDeviceTimeout(label)DevicesRemoves any per-device timeout, restoring the default.
updateCoreProperties()PropertiesUpdates CoreProperties (currently all Core properties are devices types) with the loaded hardware.
updateSystemStateCache()System state & config filesUpdates the state of the entire hardware.
usesDeviceDelay(label)DevicesSignals if the device will use the delay setting or not.
volumetricPumpHome(pumpLabel)PumpsHomes the volumetric pump.
volumetricPumpRequiresHoming(pumpLabel)PumpsReturn True if the volumetric pump requires homing.
volumetricPumpStop(pumpLabel)PumpsStops the volumetric pump.
waitForConfig(group, configName)Config groups & presetsBlocks until all devices included in the configuration become ready.
waitForDevice(label)DevicesWaits (blocks the calling thread) until the specified device becomes non-busy.
waitForDeviceType(devType)DevicesBlocks until all devices of the specific type become ready (not-busy).
waitForSystem()System state & config filesBlocks until all devices in the system become ready (not-busy).
writeToSerialPort(portLabel, data)Serial portsSends an array of characters to the serial port and returns immediately.

General

describe

describe(
    sort: str | None = None,
    show_config_groups: bool = False,
    show_available: bool = False,
) -> None

Print information table with the current configuration.

Intended to provide a quick overview of the microscope configuration during interactive terminal usage.

getAPIVersionInfo

getAPIVersionInfo() -> str

Returns the module and device interface versions.

getMMCoreVersionMajor staticmethod

getMMCoreVersionMajor() -> int

getMMCoreVersionMinor staticmethod

getMMCoreVersionMinor() -> int

getMMCoreVersionPatch staticmethod

getMMCoreVersionPatch() -> int

getMMDeviceDeviceInterfaceVersion staticmethod

getMMDeviceDeviceInterfaceVersion() -> int

getMMDeviceModuleInterfaceVersion staticmethod

getMMDeviceModuleInterfaceVersion() -> int

getVersionInfo

getVersionInfo() -> str

Displays core version.

instance classmethod

instance() -> CMMCorePlus

Return the global singleton instance of CMMCorePlus.

In many cases, a single instance of CMMCorePlus is all that will be created in a given session. This class method provides a convenient way to access that instance.

Tip

Creating/accessing a CMMCorePlus object using CMMCorePlus.instance() is a convenient way to access the same core instance from multiple places in your code. All widgets in pymmcore-widgets also use CMMCorePlus.instance() by default, so any widgets you use will automatically connect to the same core instance without any additional configuration.

Attempts are made to make it thread-safe. But please open an issue if you find any problems.

noop

noop() -> None

A static method that does nothing.

reset

reset() -> None

Unloads all devices from the core, clears all configuration data and property blocks.

sleep

sleep(intervalMs: float) -> None

Waits (blocks the calling thread) for specified time in milliseconds.

state

state(
    *, cached: bool = True, include_time: bool = False, **_kwargs: Any
) -> SummaryMetaV1

Return info on the current state of the core.

Acquisition engine & events

events property

events: PCoreSignaler

Signaler for core events.

✨ This attribute is new in CMMCorePlus.

This attribute allows connecting callbacks to various events that occur within the core. See pymmcore_plus.core.events.PCoreSignaler documentation for details of the available signals, and how to connect to them.

mda property

mda: MDARunner

Return the MDARunner for this CMMCorePlus instance.

✨ This attribute is new in CMMCorePlus.

register_mda_engine

register_mda_engine(engine: PMDAEngine) -> None

Set the MDA Engine to be used on run_mda.

This will unregister the previous engine and emit an mdaEngineRegistered signal. The current Engine must not be running an MDA in order to register a new engine.

Parameters:

Name Type Description Default
engine PMDAEngine

Any object conforming to the PMDAEngine protocol.

required

registerCallback

registerCallback(*_: Never) -> Never

registerCallback is disallowed in pymmcore-plus!

If you want to connect callbacks to events, use the CMMCorePlus.events property instead.

run_mda

run_mda(
    events: Iterable[MDAEvent],
    *,
    output: SingleOutput | Sequence[SingleOutput] | None = None,
    block: bool = False,
    dimension_overrides: dict[str, DimensionOverride] | None = None,
) -> Thread

Run a sequence of useq.MDAEvent on a new thread.

The currently registered MDAEngine (core.mda.engine) will be responsible for executing the acquisition.

After starting the sequence you can pause or cancel the mda with the mda object's set_paused and cancel methods.

Parameters:

Name Type Description Default
events Iterable[MDAEvent]

An iterable of useq.MDAEvent to execute. This may be an instance of useq.MDASequence, or any other iterable of useq.MDAEvent.

required
output SingleOutput | Sequence[SingleOutput] | None

Where to send the data. If None (the default), nothing is saved. This is passed on to MDARunner.run, which describes the options in detail. In short, it may be:

  • A str or Path ending in .ome.zarr or .ome.tiff, which will be written with ome-writers.
  • An ome_writers.AcquisitionSettings object, for full control over the output.
  • A handler object with a frameReady method (connected to the frameReady signal for the duration of the acquisition).
  • A sequence of the above, containing no more than one path or AcquisitionSettings.

Note that run_mda has no overwrite argument, so an existing path will raise an error. (core.mda.run(..., overwrite=True) accepts one, but it blocks the calling thread.)

None
block bool

If True, block until the sequence is complete, by default False.

False
dimension_overrides dict[str, DimensionOverride] | None

Per-dimension storage overrides, keyed by dimension name. See MDARunner.run for details.

None

Returns:

Type Description
Thread

The thread the sequence is running on. Use thread.join() to block until done, or thread.is_alive() to check if the sequence is complete.

System state & config files

getSystemState

getSystemState(*, native: bool = False) -> Configuration | Configuration

Return the entire system state.

Why Override? The pymmcore_plus.Configuration object returned when native=False (the default) provides a nicer Mapping interface. Pass native=True to get the original pymmcore.Configuration object.

getSystemStateCache

getSystemStateCache(*, native: Literal[True]) -> Configuration
getSystemStateCache(*, native: Literal[False] = False) -> Configuration
getSystemStateCache(*, native: bool = False) -> Configuration | Configuration

Return the entire system state from cache.

Why Override? The pymmcore_plus.Configuration object returned when native=False (the default) provides a nicer Mapping interface. Pass native=True to get the original pymmcore.Configuration object.

loadSystemConfiguration

loadSystemConfiguration(fileName: str | Path = 'MMConfig_demo.cfg') -> None

Load a system config file conforming to the MM .cfg format.

https://micro-manager.org/Micro-Manager_Configuration_Guide#configuration-file-syntax

For relative paths, the current working directory is first checked, then the then device adapter path is checked.

Why Override? This method overrides the default implementation to A) allow loading the MMConfig_demo.cfg file by default, B) to provide more flexible path declarations and C) better error messages when the file cannot be found.

loadSystemState

loadSystemState(fileName: str) -> None

Loads the system configuration from the text file conforming to the MM specific format.

saveSystemConfiguration

saveSystemConfiguration(filename: str) -> None

Saves the current system configuration to a text file.

Why Override? To also save pixel size configurations.

saveSystemState

saveSystemState(fileName: str) -> None

Saves the current system state to a text file of the MM specific format.

setContext

setContext(**kwargs: Unpack[SetContextKwargs]) -> Iterator[None]

Set core properties in a context restoring the initial values on exit.

Parameters:

Name Type Description Default
**kwargs Any

Keyword arguments may be any Name for which get<Name> and set<Name> methods exist (where the first letter in <Name> may be either lower or upper case). For example, setContext(exposure=10) will call setExposure(10) when entering the context and setExposure(<initial>) when exiting the context. If the property is not found, a warning is logged and the property is skipped. If the value is a tuple, it is unpacked and passed to the set<Name> method (but lists are not unpacked).

{}

Examples:

core = CMMCorePlus.instance()

with core.setContext(autoShutter=False):
    assert not core.getAutoShutter()
    # do other stuff
    ...

# autoShutter is restored to its original value when the context exits
assert core.getAutoShutter()

setSystemState

setSystemState(conf: Configuration) -> None

Sets all properties contained in the Configuration object.

systemConfigurationFile

systemConfigurationFile() -> str | None

Return the path to the last loaded system configuration file, or None.

updateSystemStateCache

updateSystemStateCache() -> None

Updates the state of the entire hardware.

waitForSystem

waitForSystem() -> None

Blocks until all devices in the system become ready (not-busy).

Devices

detectDevice

detectDevice(deviceLabel: str) -> DeviceDetectionStatus

Tries to communicate to a device through a given serial port.

Used to automate discovery of correct serial port. Also configures the serial port correctly.

Why Override? The returned pymmcore_plus.DeviceDetectionStatus enum is more interpretable than the raw int returned by pymmcore

deviceBusy

deviceBusy(label: DeviceLabel | str) -> bool

Checks the busy status of the specific device.

deviceTypeBusy

deviceTypeBusy(devType: DeviceType) -> bool

Checks the busy status for all devices of the specific type.

getAdapterObject

getAdapterObject(library_name: str) -> DeviceAdapter

Return an Adapter object bound to library_name on this core.

Adapter objects are a convenient object oriented way to interact with device adapters. They allow you to call any method on CMMCore that normally requires a library_name as the first argument as an argument-free method on the Adapter object.

getAvailableDeviceDescriptions

getAvailableDeviceDescriptions(library: AdapterName | str) -> tuple[str, ...]

Get descriptions for available devices from the specified library.

getAvailableDevices

getAvailableDevices(library: AdapterName | str) -> tuple[DeviceName, ...]

Get available devices from the specified device library.

getAvailableDeviceTypes

getAvailableDeviceTypes(library: AdapterName | str) -> tuple[int, ...]

Get type information for available devices from the specified library.

getCurrentDeviceOfType

getCurrentDeviceOfType(
    device_type: DeviceTypesWithCurrent,
) -> DeviceLabel | Literal[""]

Return the current device of type device_type.

Only the following device types have a "current" device: - CameraDevice - ShutterDevice - StageDevice - XYStageDevice - AutoFocusDevice - SLMDevice - GalvoDevice - ImageProcessorDevice

Calling this method with any other device type will raise a ValueError.

Parameters:

Name Type Description Default
device_type DeviceType

The type of device to get the current device for. See DeviceType for a list of device types.

required

Returns:

Type Description
str

The label of the current device of type device_type. If no device of that type is currently set, an empty string is returned.

Raises:

Type Description
ValueError

If the core does not have the concept of a "current" device of the provided device_type.

getDeviceAdapterNames

getDeviceAdapterNames() -> tuple[AdapterName, ...]

Return the names of discoverable device adapters.

getDeviceAdapterSearchPaths

getDeviceAdapterSearchPaths() -> tuple[str, ...]

Return the current device adapter search paths.

getDeviceDelayMs

getDeviceDelayMs(label: DeviceLabel | str) -> float

Reports action delay in milliseconds for the specific device.

getDeviceDescription

getDeviceDescription(label: DeviceLabel | str) -> str

Returns description text for a given device label. "Description" is determined by the library and is immutable.

getDeviceInitializationState

getDeviceInitializationState(label: str) -> DeviceInitializationState

Queries the initialization state of the given device.

Why Override? The returned pymmcore_plus.DeviceInitializationState enum is more interpretable than the raw int returned by pymmcore

getDeviceLibrary

getDeviceLibrary(label: DeviceLabel | str) -> AdapterName

Returns device library (aka module, device adapter) name.

getDeviceName

getDeviceName(label: DeviceLabel | str) -> DeviceName

Returns device name for a given device label.

getDeviceObject

getDeviceObject(
    device_label: str, device_type: Literal[Camera]
) -> CameraDevice
getDeviceObject(device_label: str, device_type: Literal[Stage]) -> StageDevice
getDeviceObject(device_label: str, device_type: Literal[State]) -> StateDevice
getDeviceObject(
    device_label: str, device_type: Literal[Shutter]
) -> ShutterDevice
getDeviceObject(
    device_label: str, device_type: Literal[XYStage]
) -> XYStageDevice
getDeviceObject(
    device_label: str, device_type: Literal[Serial]
) -> SerialDevice
getDeviceObject(
    device_label: str, device_type: Literal[Generic]
) -> GenericDevice
getDeviceObject(
    device_label: str, device_type: Literal[AutoFocus]
) -> AutoFocusDevice
getDeviceObject(
    device_label: str, device_type: Literal[ImageProcessor]
) -> ImageProcessorDevice
getDeviceObject(
    device_label: str, device_type: Literal[SignalIO]
) -> SignalIODevice
getDeviceObject(
    device_label: str, device_type: Literal[Magnifier]
) -> MagnifierDevice
getDeviceObject(device_label: str, device_type: Literal[SLM]) -> SLMDevice
getDeviceObject(device_label: str, device_type: Literal[Hub]) -> HubDevice
getDeviceObject(device_label: str, device_type: Literal[Galvo]) -> GalvoDevice
getDeviceObject(
    device_label: Literal[CoreDevice], device_type: Literal[Core]
) -> CoreDevice
getDeviceObject(device_label: str, device_type: DeviceType = ...) -> Device
getDeviceObject(device_label: str, device_type: type[_DT]) -> _DT
getDeviceObject(
    device_label: str, device_type: type[_DT] | DeviceType = Any
) -> _DT | Device

Return a Device object bound to device_label on this core.

Device objects are a convenient object oriented way to interact with devices. They allow you to call any method on CMMCore that normally requires a deviceLabel as the first argument as an argument-free method on the Device object.

Parameters:

Name Type Description Default
device_label str

Device label to get a device object for.

required

Examples:

>>> core = CMMCorePlus()
>>> cam = core.getDeviceObject("DemoCamera")
>>> cam.isLoaded()
False
>>> cam.load("DemoCamera", "DCam")
>>> cam.isLoaded()
True
>>> cam.initialize()

get the device schema

>>> cam.schema()
{
    'title': 'DCam',
    'description': 'Demo camera',
    'type': 'object',
    'properties': {
        'HubID': {'type': 'string', 'readOnly': True, 'default': ''},
        'MaximumExposureMs': {'type': 'number', 'preInit': True},
        'TransposeCorrection': {'type': 'boolean'},
        'TransposeMirrorX': {'type': 'boolean'},
        'TransposeMirrorY': {'type': 'boolean'},
        'TransposeXY': {'type': 'boolean'}
    }
}

getDeviceSchema

getDeviceSchema(device_label: str) -> DeviceSchema

Return JSON-schema describing device device_label and its properties.

✨ This method is new in CMMCorePlus. It provides a convenient way to get all of the information about a device in a single call.

Returns:

Type Description
DeviceSchema

JSON-schema describing device device_label and its properties.

Examples:

>>> core = CMMCorePlus()
>>> core.loadDevice("DemoCamera", "DemoCamera", "DCam")
>>> core.getDeviceSchema("DemoCamera")
{
    'title': 'DCam',
    'description': 'Demo camera',
    'type': 'object',
    'properties': {
        'HubID': {'type': 'string', 'readOnly': True, 'default': ''},
        'MaximumExposureMs': {'type': 'number', 'preInit': True},
        'TransposeCorrection': {'type': 'boolean'},
        'TransposeMirrorX': {'type': 'boolean'},
        'TransposeMirrorY': {'type': 'boolean'},
        'TransposeXY': {'type': 'boolean'}
    }
}

getDeviceTimeoutMs

getDeviceTimeoutMs(label: DeviceLabel | str) -> int

Returns the per-device timeout in milliseconds, or the default if not set.

getDeviceType

getDeviceType(label: str) -> DeviceType

Return device type for a given device.

Why Override? The returned pymmcore_plus.DeviceType enum is more interpretable than the raw int returned by pymmcore

getInstalledDeviceDescription

getInstalledDeviceDescription(
    hubLabel: DeviceLabel | str, peripheralLabel: DeviceName | str
) -> str

Returns description from the specified peripheral on hubLabel device.

getInstalledDevices

getInstalledDevices(hubLabel: DeviceLabel | str) -> tuple[DeviceName, ...]

Performs auto-detection and loading of child devices that are attached to a Hub device.

Raises RuntimeError if hubLabel is not a hub device.

getLoadedDevices

getLoadedDevices() -> tuple[DeviceLabel, ...]

Returns an array of labels for currently loaded devices.

getLoadedDevicesOfType

getLoadedDevicesOfType(devType: DeviceType) -> tuple[DeviceLabel, ...]

Returns an array of labels for currently loaded devices of specific type.

getLoadedPeripheralDevices

getLoadedPeripheralDevices(
    hubLabel: DeviceLabel | str,
) -> tuple[DeviceLabel, ...]

Return labels of all loaded peripherals of hubLabel device.

Returns empty tuple if hubLabel is not a hub device, or even if hubLabel is not the name of any device.

getParentLabel

getParentLabel(peripheralLabel: DeviceLabel | str) -> DeviceLabel | Literal['']

Returns parent device. Returns empty string if no parent is found.

getTimeoutMs

getTimeoutMs() -> int

Get the timeout for all wait commands.

(Default is 5000 ms)

hasDeviceTimeout

hasDeviceTimeout(label: DeviceLabel | str) -> bool

Returns True if a per-device timeout has been set for the given device.

initializeAllDevices

initializeAllDevices() -> None

Calls Initialize() method for each loaded device.

See ParallelDeviceInitialization feature flag for controlling the order of initialization.

initializeDevice

initializeDevice(label: DeviceLabel | str) -> None

Initializes specific device.

iterDeviceAdapters

iterDeviceAdapters(
    adapter_pattern: str | Pattern | None = ...,
    *,
    as_object: Literal[True] = ...,
) -> Iterator[DeviceAdapter]
iterDeviceAdapters(
    adapter_pattern: str | Pattern | None = ..., *, as_object: Literal[False]
) -> Iterator[str]
iterDeviceAdapters(
    adapter_pattern: str | Pattern | None = None, *, as_object: bool = True
) -> Iterator[DeviceAdapter] | Iterator[str]

Iterate over all available device adapters.

It offers a convenient way to iterate over available device adaptor libraries, optionally filtering adapter library name. It can also yield Adapter objects if as_object is True (the default)

Parameters:

Name Type Description Default
adapter_pattern str | None

Device adapter name or pattern to filter by, by default all device adapters will be yielded.

None
as_object bool

If True, Adapter objects will be yielded instead of library name strings. By default True

True

Yields:

Type Description
Device | str

Device objects (if as_object==True) or device label strings.

iterDevices

iterDevices(
    device_type: int | Iterable[int] | None = ...,
    device_label: str | Pattern | None = ...,
    device_adapter: str | Pattern | None = ...,
    *,
    as_object: Literal[False],
) -> Iterator[str]
iterDevices(
    device_type: int | Iterable[int] | None = ...,
    device_label: str | Pattern | None = ...,
    device_adapter: str | Pattern | None = ...,
    *,
    as_object: Literal[True] = ...,
) -> Iterator[Device]
iterDevices(
    device_type: int | Iterable[int] | None = None,
    device_label: str | Pattern | None = None,
    device_adapter: str | Pattern | None = None,
    *,
    as_object: bool = True,
) -> Iterator[Device] | Iterator[str]

Iterate over currently loaded devices.

It offers a convenient way to iterate over loaded devices, optionally filtering by DeviceType and/or device label. It can also yield Device objects if as_object is True (the default).

Parameters:

Name Type Description Default
device_type DeviceType | None

DeviceType to filter by, by default all device types will be yielded.

None
device_label str | None

Device label to filter by, by default all device labels will be yielded.

None
device_adapter str | None

Device adapter library to filter by, by default devices from all libraries will be yielded.

None
as_object bool

If True, Device objects will be yielded instead of device label strings. By default True

True

Yields:

Type Description
Device | str

Device objects (if as_object==True) or device label strings.

loadDevice

loadDevice(label: str, moduleName: str, deviceName: str) -> None

Load a device from the plugin library.

Why Override? To add much better error messages in the case of failure.

Parameters:

Name Type Description Default
label str

Name to be assigned to the device during this core session.

required
moduleName str

The name of the device adapter module (short name, not full file name). See pymmcore.CMMCore.getDeviceAdapterNames for a list of valid module names.

required
deviceName str

the name of the device. The name must correspond to one of the names recognized by the specific plugin library. See pymmcore.CMMCore.getAvailableDevices for a list of valid device names.

required

setDeviceAdapterSearchPaths

setDeviceAdapterSearchPaths(paths: Sequence[str]) -> None

Set the device adapter search paths.

Why Override? In cases where MM device adapters use dynamically loaded libraries, the device adapter search paths must also be added to the PATH environment variable (e.g. https://github.com/micro-manager/pymmcore/issues/28). This method overrides the default implementation to ensure that the PATH environment variable is updated when the device adapter search paths are changed.

setDeviceDelayMs

setDeviceDelayMs(label: DeviceLabel | str, delayMs: float) -> None

Overrides the built-in value for the action delay.

setDeviceTimeoutMs

setDeviceTimeoutMs(label: DeviceLabel | str, timeoutMs: int) -> None

Sets a per-device timeout in milliseconds.

setParentLabel

setParentLabel(
    deviceLabel: DeviceLabel | str, parentHubLabel: DeviceLabel | str
) -> None

Sets parent device label

setTimeoutMs

setTimeoutMs(timeoutMs: int) -> None

Sets the timeout for all wait commands.

(Default is 5000 ms)

supportsDeviceDetection

supportsDeviceDetection(deviceLabel: DeviceLabel | str) -> bool

Return whether or not the device supports automatic device detection (i.e.

systemBusy

systemBusy() -> bool

Checks the busy status of the entire system.

unloadAllDevices

unloadAllDevices() -> None

Unload all devices from the core and reset all configuration data.

Why Override? To add logging.

unloadDevice

unloadDevice(label: DeviceLabel | str) -> None

Unloads the device from the core and adjusts all configuration data.

unloadLibrary

unloadLibrary(moduleName: AdapterName | str) -> None

Forcefully unload a library.

unsetDeviceTimeout

unsetDeviceTimeout(label: DeviceLabel | str) -> None

Removes any per-device timeout, restoring the default.

usesDeviceDelay

usesDeviceDelay(label: DeviceLabel | str) -> bool

Signals if the device will use the delay setting or not.

waitForDevice

waitForDevice(label: DeviceLabel | str) -> None

Waits (blocks the calling thread) until the specified device becomes non-busy.

waitForDeviceType

waitForDeviceType(devType: DeviceType) -> None

Blocks until all devices of the specific type become ready (not-busy).

Properties

getAllowedPropertyValues

getAllowedPropertyValues(
    label: DeviceLabel | str, propName: PropertyName | str
) -> tuple[str, ...]

Returns all valid values for the specified property.

getDevicePropertyNames

getDevicePropertyNames(label: DeviceLabel | str) -> tuple[PropertyName, ...]

Returns all property names supported by the device.

getProperty

getProperty(label: DeviceLabel | str, propName: PropertyName | str) -> str

Returns the property value for the specified device.

The return value will always be a string. Use getPropertyType to determine the correct type.

getPropertyFromCache

getPropertyFromCache(
    deviceLabel: DeviceLabel | str, propName: PropertyName | str
) -> str

Returns the cached property value for the specified device.

getPropertyLowerLimit

getPropertyLowerLimit(
    label: DeviceLabel | str, propName: PropertyName | str
) -> float

Returns the property lower limit value, if the property has limits - 0 otherwise.

getPropertyObject

getPropertyObject(device_label: str, property_name: str) -> DeviceProperty

Return a DeviceProperty object bound to a device/property on this core.

DeviceProperty objects are a convenient object oriented way to interact with a specific device properties. They allow you to call any method on CMMCore that normally requires a deviceLabel and propertyName as the first two arguments as an argument-free method on the DeviceProperty object.

Parameters:

Name Type Description Default
device_label str

Device label to get a property object for.

required
property_name str

Property name to get a property object for.

required

Examples:

>>> core = CMMCorePlus()
>>> core.loadDevice("DemoCamera", "DemoCamera", "DCam")
>>> core.initializeDevice("DemoCamera")
>>> core.setCameraDevice("DemoCamera")
>>> exposure = core.getPropertyObject("DemoCamera", "Exposure")
>>> exposure.type()
<PropertyType.Float: 2>
>>> exposure.upperLimit()
10000.0

get/set property values easily:

>>> exposure.value
10.0
>>> exposure.value = 5.0
>>> exposure.value
5.0
>>> core.getExposure()  # changes reflected in core
5.0

getPropertyType

getPropertyType(label: str, propName: str) -> PropertyType

Return the intrinsic property type for a given device and property.

Why Override? The returned pymmcore_plus.PropertyType enum is more interpretable than the raw int returned by pymmcore

getPropertyUpperLimit

getPropertyUpperLimit(
    label: DeviceLabel | str, propName: PropertyName | str
) -> float

Returns the property upper limit value, if the property has limits - 0 otherwise.

hasProperty

hasProperty(label: DeviceLabel | str, propName: PropertyName | str) -> bool

Checks if device has a property with a specified name.

hasPropertyLimits

hasPropertyLimits(
    label: DeviceLabel | str, propName: PropertyName | str
) -> bool

Queries device if the specific property has limits.

isPropertyPreInit

isPropertyPreInit(
    label: DeviceLabel | str, propName: PropertyName | str
) -> bool

Tells us whether the property must be defined prior to initialization.

isPropertyReadOnly

isPropertyReadOnly(
    label: DeviceLabel | str, propName: PropertyName | str
) -> bool

Tells us whether the property can be modified.

iterProperties

iterProperties(
    property_type: int | Iterable[int] | None = ...,
    property_name_pattern: str | Pattern | None = ...,
    *,
    device_type: int | Iterable[int] | None = ...,
    device_label: str | Pattern | None = ...,
    has_limits: bool | None = None,
    is_read_only: bool | None = None,
    is_sequenceable: bool | None = None,
    as_object: Literal[False],
) -> Iterator[tuple[str, str]]
iterProperties(
    property_type: int | Iterable[int] | None = ...,
    property_name_pattern: str | Pattern | None = ...,
    *,
    device_type: int | Iterable[int] | None = ...,
    device_label: str | Pattern | None = ...,
    has_limits: bool | None = None,
    is_read_only: bool | None = None,
    is_sequenceable: bool | None = None,
    as_object: Literal[True] = ...,
) -> Iterator[DeviceProperty]
iterProperties(
    property_type: int | Iterable[int] | None = None,
    property_name_pattern: str | Pattern | None = None,
    *,
    device_type: int | Iterable[int] | None = None,
    device_label: str | Pattern | None = None,
    has_limits: bool | None = None,
    is_read_only: bool | None = None,
    is_sequenceable: bool | None = None,
    as_object: bool = True,
) -> Iterator[DeviceProperty] | Iterator[tuple[str, str]]

Iterate over currently loaded (device_label, property_name) pairs.

It offers a convenient way to iterate over loaded devices, optionally filtering by DeviceType and/or device label. It can also yields DeviceProperty objects if as_object is True (the default).

Parameters:

Name Type Description Default
property_type int | Sequence[int] | None

PropertyType (or types) to filter by, by default all property types will be yielded.

None
property_name_pattern str | Pattern | None

Property name to filter by, by default all property names will be yielded. May be a compiled regular expression or a string, in which case it will be compiled with re.IGNORECASE.

None
device_type DeviceType | None

DeviceType to filter by, by default all device types will be yielded.

None
device_label str | None

Device label to filter by, by default all device labels will be yielded.

None
has_limits bool | None

If provided, only properties with hasPropertyLimits matching this value will be yielded.

None
is_read_only bool | None

If provided, only properties with isPropertyReadOnly matching this value will be yielded.

None
is_sequenceable bool | None

If provided only properties with isPropertySequenceable matching this value will be yielded.

None
as_object bool

If True, DeviceProperty objects will be yielded instead of (device_label, property_name) tuples. By default True

True

Yields:

Type Description
DeviceProperty | tuple[str, str]

DeviceProperty objects (if as_object==True) or 2-tuples of (device_name, property_name)

setProperty

setProperty(
    label: str, propName: str, propValue: bool | float | int | str
) -> None

Set property named propName on device label to propValue.

Why Override? In MMCore, the calling of the onPropertyChanged callback is left to the underlying device adapter, which means it is not always called. This method overrides the default implementation to ensure that events.propertyChanged is always emitted when setProperty has been called and the property Value has actually changed.

updateCoreProperties

updateCoreProperties() -> None

Updates CoreProperties (currently all Core properties are devices types) with the loaded hardware.

Config groups & presets

channelGroup_pattern property writable

channelGroup_pattern: Pattern

The regex pattern used to identify channel groups.

It is the regex used by getOrGuessChannelGroup to find a config group likely to be a channel group in getAvailableConfigGroups if getChannelGroup returns None.

By default:

re.compile("(chan{1,2}(el)?|filt(er)?)s?", re.IGNORECASE)

defineConfig

defineConfig(groupName: str, configName: str) -> None
defineConfig(
    groupName: str, configName: str, deviceLabel: str, propName: str, value: str
) -> None
defineConfig(
    groupName: str,
    configName: str,
    deviceLabel: str | None = None,
    propName: str | None = None,
    value: str | None = None,
) -> None

Defines a configuration.

Why Override? To emit a configDefined event. Also, if groupName is not a defined group, then defineConfigGroup(groupName) is called.

defineConfigGroup

defineConfigGroup(groupName: str) -> None

Creates an empty configuration group.

deleteConfig

deleteConfig(groupName: str, configName: str) -> None
deleteConfig(
    groupName: str, configName: str, deviceLabel: str, propName: str
) -> None
deleteConfig(
    groupName: str,
    configName: str,
    deviceLabel: str | None = None,
    propName: str | None = None,
) -> None

Delete configName from groupName.

Why Override? To emit a configDeleted event.

deleteConfigGroup

deleteConfigGroup(groupName: str) -> None

Deletes an entire configuration group.

Why Override? To emit a configGroupDeleted event.

getAvailableConfigGroups

getAvailableConfigGroups() -> tuple[ConfigGroupName, ...]

Returns the names of all defined configuration groups

getAvailableConfigs

getAvailableConfigs(
    configGroup: ConfigGroupName | str,
) -> tuple[ConfigPresetName, ...]

Returns all defined configuration (preset) names in a given group

getChannelGroup

getChannelGroup() -> ConfigGroupName | Literal['']

Returns the group determining the channel selection.

Returns empty string if no channel group is selected.

getConfigData

getConfigData(
    configGroup: str, configName: str, *, native: Literal[True]
) -> Configuration
getConfigData(
    configGroup: str, configName: str, *, native: Literal[False] = False
) -> Configuration
getConfigData(
    configGroup: str, configName: str, *, native: bool = False
) -> Configuration | Configuration

Return the configuration object for a given configGroup and configName.

Why Override? The pymmcore_plus.Configuration object returned when native=False (the default) provides a nicer Mapping interface. Pass native=True to get the original pymmcore.Configuration object.

getConfigGroupObject

getConfigGroupObject(
    group_name: str, allow_missing: bool = False
) -> ConfigGroup

Return a ConfigGroup object bound to group_name on this core.

ConfigGroup objects are a convenient object oriented way to interact with configuration groups (i.e. groups of Configuration Presets in Micro-Manager). They allow you to call any method on CMMCore that normally requires a groupName as the first argument as an argument-free method on the ConfigGroup object.

Parameters:

Name Type Description Default
group_name str

Configuration group name to get a config group object for.

required
allow_missing bool

If False and the ConfigGroup does not exist, a KeyError will be raised. By default False.

False

Returns:

Type Description
ConfigGroup

ConfigGroup object bound to group_name on this core.

getConfigGroupState

getConfigGroupState(group: str, *, native: Literal[True]) -> Configuration
getConfigGroupState(
    group: str, *, native: Literal[False] = False
) -> Configuration
getConfigGroupState(
    group: str, *, native: bool = False
) -> Configuration | Configuration

Return the state of the devices included in the specified group.

Why Override? The pymmcore_plus.Configuration object returned when native=False (the default) provides a nicer Mapping interface. Pass native=True to get the original pymmcore.Configuration object.

getConfigGroupStateFromCache

getConfigGroupStateFromCache(
    group: str, *, native: Literal[True]
) -> Configuration
getConfigGroupStateFromCache(
    group: str, *, native: Literal[False] = False
) -> Configuration
getConfigGroupStateFromCache(
    group: str, *, native: bool = False
) -> Configuration | Configuration

Return the state of the system cache, for the devices in the specified group.

Why Override? The pymmcore_plus.Configuration object returned when native=False (the default) provides a nicer Mapping interface. Pass native=True to get the original pymmcore.Configuration object.

getConfigState

getConfigState(
    group: str, config: str, *, native: bool = False
) -> Configuration | Configuration

Return state of devices included in the specified configuration.

Why Override? The pymmcore_plus.Configuration object returned when native=False (the default) provides a nicer Mapping interface. Pass native=True to get the original pymmcore.Configuration object.

getCurrentConfig

getCurrentConfig(
    groupName: ConfigGroupName | str,
) -> ConfigPresetName | Literal[""]

Returns the current configuration (preset) for a given group.

Returns empty string if no configuration is selected.

getCurrentConfigFromCache

getCurrentConfigFromCache(
    groupName: ConfigGroupName | str,
) -> ConfigPresetName | Literal[""]

Returns the configuration for a given group based on the data in the cache.

getOrGuessChannelGroup

getOrGuessChannelGroup() -> list[str]

Get the channelGroup or find a likely set of candidates.

If the group is not defined via .getChannelGroup then likely candidates will be found by searching for config groups with names that match this object's channelGroup_pattern property. This is a settable property with a default value of:

reg = re.compile("(chan{1,2}(el)?|filt(er)?)s?", re.IGNORECASE)

isConfigDefined

isConfigDefined(groupName: str, configName: str) -> bool

Checks if the configuration already exists within a group.

If either the groupName or configName are not recognized, returns False.

isGroupDefined

isGroupDefined(groupName: str) -> bool

Checks if the group already exists.

iterConfigGroups

iterConfigGroups() -> Iterator[ConfigGroup]

Iterate ConfigGroup objects for all configs.

Yields:

Type Description
ConfigGroup

ConfigGroup objects

renameConfig

renameConfig(
    groupName: ConfigGroupName | str,
    oldConfigName: ConfigPresetName | str,
    newConfigName: str,
) -> None

Renames a configuration within a specified group.

The command will fail if the configuration was not previously defined.

renameConfigGroup

renameConfigGroup(
    oldGroupName: ConfigGroupName | str, newGroupName: str
) -> None

Renames a configuration group.

setChannelGroup

setChannelGroup(channelGroup: str) -> None

Specifies the group determining the channel selection.

...and send a channelGroupChanged signal.

setConfig

setConfig(groupName: str, configName: str) -> None

Applies a configuration to a group.

Why Override? The native onConfigGroupChanged callback is not always called whenever CMMCore.setConfig has been called. We override here to emit a configSet event whenever setConfig is called. See https://github.com/micro-manager/mmCoreAndDevices/issues/25 for details.

waitForConfig

waitForConfig(
    group: ConfigGroupName | str, configName: ConfigPresetName | str
) -> None

Blocks until all devices included in the configuration become ready.

Cameras

clearROI

clearROI() -> None

Set the region of interest of the current camera to the full frame.

getAllowedBinningValues

getAllowedBinningValues() -> tuple[int, ...]
getAllowedBinningValues(label: DeviceLabel | str) -> tuple[int, ...]
getAllowedBinningValues() -> tuple[int, ...]

Returns allowed binning values for the current camera.

getBinning

getBinning() -> int
getBinning(label: DeviceLabel | str) -> int
getBinning() -> int

Returns the current binning factor of the camera.

getBytesPerPixel

getBytesPerPixel() -> int

How many bytes for each pixel.

getCameraChannelName

getCameraChannelName(channelNr: int) -> str

Returns the name of the requested channel as known by the default camera

getCameraChannelNames

getCameraChannelNames() -> tuple[str, ...]

Convenience method to call getCameraChannelName for all camera channels.

getCameraDevice

getCameraDevice() -> DeviceLabel | Literal['']

Returns the label of the currently selected camera device.

Returns empty string if no camera device is selected.

getExposure

getExposure() -> float
getExposure(label: DeviceLabel | str) -> float
getExposure() -> float

Returns the current exposure setting of the camera in milliseconds.

getImageProcessorDevice

getImageProcessorDevice() -> DeviceLabel | Literal['']

Returns the label of the currently selected image processor device.

Returns empty string if no image processor device is selected.

getMultiROI

getMultiROI(*_: Any) -> tuple[list[int], list[int], list[int], list[int]]

Get multiple ROIs from the current camera device.

Will fail if the camera does not support multiple ROIs. Will return empty vectors if multiple ROIs are not currently being used.

Why Override? So that the user doesn't need to pass in four empty pymmcore.UnsignedVector() objects.

getNumberOfCameraChannels

getNumberOfCameraChannels() -> int

Returns the number of simultaneous channels the default camera is returning.

getNumberOfComponents

getNumberOfComponents() -> int

Returns the number of components the default camera is returning.

getPhysicalCameraDevice

getPhysicalCameraDevice(channel_index: int = 0) -> str

Return the name of the actual camera device for a given channel index.

✨ This method is new in CMMCorePlus. It provides a convenience for accessing the name of the actual camera device when using the multi-camera utility.

getROI

getROI() -> Rectangle
getROI(label: DeviceLabel | str) -> Rectangle
getROI() -> Rectangle

Return the current hardware region of interest for a camera.

If multiple ROIs are set, this method instead returns a rectangle that describes the image that the camera will generate. The coordinates are in units of binned pixels. That is, conceptually, binning is applied before the ROI.

Returns [0,0,0,0] if no camera is selected.

isMultiROIEnabled

isMultiROIEnabled() -> bool

Queries the camera to determine if multiple ROIs are currently set.

isMultiROISupported

isMultiROISupported() -> bool

Queries the camera to determine if it supports multiple ROIs.

setBinning

setBinning(binning: int) -> None
setBinning(label: DeviceLabel | str, binning: int) -> None
setBinning(binning: int) -> None

Sets the binning factor of the current camera.

setCameraDevice

setCameraDevice(cameraLabel: DeviceLabel | str) -> None

Sets the current camera device.

setExposure

setExposure(exp: float) -> None
setExposure(cameraLabel: DeviceLabel | str, dExp: float) -> None
setExposure(exp: float) -> None

Sets the exposure setting of the current camera in milliseconds.

setImageProcessorDevice

setImageProcessorDevice(procLabel: DeviceLabel | str) -> None

Sets the current image processor device.

setMultiROI

setMultiROI(
    xs: Sequence[int],
    ys: Sequence[int],
    widths: Sequence[int],
    heights: Sequence[int],
) -> None

Set multiple ROIs for the current camera device.

Will fail if the camera does not support multiple ROIs, any widths or heights are non-positive, or if the vectors do not all have the same length.

setROI

setROI(x: int, y: int, width: int, height: int) -> None
setROI(label: str, x: int, y: int, width: int, height: int) -> None
setROI(*args: Any) -> None

Set the camera Region of Interest (ROI).

Why Override? To emit a roiSet event.

Images & buffer

clearCircularBuffer

clearCircularBuffer() -> None

Removes all images from the circular buffer.

fixImage

fixImage(img: ndarray, ncomponents: int | None = None) -> ndarray

Fix img shape/dtype based on self.getNumberOfComponents().

convert images with n_components > 1 to a shape (w, h, num_components) and dtype img.dtype.itemsize//ncomp

Parameters:

Name Type Description Default
img ndarray

input image

required
ncomponents int

number of components in the image, by default self.getNumberOfComponents()

None

Returns:

Type Description
ndarray

output image (possibly new shape and dtype)

getBufferFreeCapacity

getBufferFreeCapacity() -> int

Returns the number of images that can be added to the buffer without overflowing.

getBufferTotalCapacity

getBufferTotalCapacity() -> int

Returns the total number of images that can be stored in the buffer

getCircularBufferMemoryFootprint

getCircularBufferMemoryFootprint() -> int

Returns the size of the Circular Buffer in MB

getImage

getImage(*, fix: bool = True) -> ndarray
getImage(numChannel: int, *, fix: bool = True) -> ndarray
getImage(numChannel: int | None = None, *, fix: bool = True) -> ndarray

Return the internal image buffer.

Why Override? To fix the shape of images with n_components > 1 (like RGB images)

Parameters:

Name Type Description Default
numChannel int

The camera channel to get the image from. If None, (the default), then Multi-Channel cameras will return the content of the first channel.

None
fix bool

If True (the default), then images with n_components > 1 (like RGB images) will be reshaped to (w, h, n_components) using fixImage.

True

getImageBitDepth

getImageBitDepth() -> int

How many bits of dynamic range are to be expected from the camera.

getImageBufferSize

getImageBufferSize() -> int

Returns the size of the internal image buffer.

getImageHeight

getImageHeight() -> int

Vertical dimension of the image buffer in pixels.

getImageWidth

getImageWidth() -> int

Horizontal dimension of the image buffer in pixels.

getLastImage

getLastImage() -> ndarray

Gets the last image from the circular buffer.

getLastImageAndMD

getLastImageAndMD(
    channel: int, slice: int, *, fix: bool = True
) -> tuple[ndarray, Metadata]
getLastImageAndMD(*, fix: bool = True) -> tuple[ndarray, Metadata]
getLastImageAndMD(
    channel: int | None = None, slice: int | None = None, *, fix: bool = True
) -> tuple[ndarray, Metadata]

Return last image from the circular buffer along with metadata.

This is a convenience method that is very similar to getLastImageMD, except that it doesn't require instantiating a MetaData object first. It returns a tuple containing the image and a pymmcore_plus.Metadata object.

It also adds a fix parameter, which reshapes multi-component images (like RGB images) to (w, h, n_components) using fixImage by default.

Parameters:

Name Type Description Default
channel int

Channel index, by default None

None
slice int

Slice index, by default None

None
fix bool

If True (the default), then images with n_components > 1 (like RGB images) will be reshaped to (w, h, n_components) using fixImage.

True

Returns:

Type Description
tuple[ndarray, Metadata]

Image and metadata

getLastImageMD

getLastImageMD(channel: int, slice: int, md: Metadata) -> ndarray
getLastImageMD(md: Metadata) -> ndarray
getLastImageMD(channel: int, slice: int, md: Metadata) -> ndarray

Returns a pointer to the pixels of the image that was last inserted into the circular buffer. Also provides all metadata associated with that image

getNBeforeLastImageAndMD

getNBeforeLastImageAndMD(
    n: int, *, fix: bool = True
) -> tuple[ndarray, Metadata]

Return image taken n images ago along with associated metadata.

This is a convenience method that is very similar to getNBeforeLastImageMD, except that it doesn't require instantiating a MetaData object first. It returns a tuple containing the image and a pymmcore_plus.Metadata object.

It also adds a fix parameter, which reshapes multi-component images (like RGB images) to (w, h, n_components) using fixImage by default.

Parameters:

Name Type Description Default
n int

The number of images ago to retrieve. 0 is the last image, 1 is the image before that, etc.

required
fix bool

If True (the default), then images with n_components > 1 (like RGB images) will be reshaped to (w, h, n_components) using fixImage.

True

getNBeforeLastImageMD

getNBeforeLastImageMD(n: int, md: Metadata) -> ndarray

Returns a pointer to the pixels of the image that was inserted n images ago. Also provides all metadata associated with that image

getRemainingImageCount

getRemainingImageCount() -> int

Returns number ofimages available in the Circular Buffer

getTaggedImage

getTaggedImage(channel_index: int = 0) -> TaggedImage

Return getImage as named tuple with metadata.

✨ This method is new in CMMCorePlus. It returns an object similar to MMCoreJ.getTaggedImage().

getTags

getTags(
    meta: Metadata | None = None, channel_index: int | None = None
) -> dict[str, Any]

Return a dict of metadata tags for the state of the core.

NOTE: this function is pretty slow, and is potentially called on every frame of an acquisition. It would be nice to determine what is absolutely necessary, and possible allow the user to specify what they want to include.

✨ This method is new in CMMCorePlus. It returns only the .tags attribute of what you would get with getTaggedImage() or popNextTaggedImage().

initializeCircularBuffer

initializeCircularBuffer() -> None

Initialize circular buffer based on the current camera settings.

isBufferOverflowed

isBufferOverflowed() -> bool

Indicates whether the circular buffer is overflowed

isSequenceRunning

isSequenceRunning() -> bool
isSequenceRunning(cameraLabel: DeviceLabel | str) -> bool
isSequenceRunning() -> bool

Check if the current camera is acquiring the sequence.

Returns false when the sequence is done

popNextImage

popNextImage(*, fix: bool = True) -> ndarray

Gets and removes the next image from the circular buffer.

Why Override? to add the fix parameter, which reshapes multi-component images (like RGB images) to (w, h, n_components) using fixImage by default.

Parameters:

Name Type Description Default
fix bool

If True (the default), then images with n_components > 1 (like RGB images) will be reshaped to (w, h, n_components) using fixImage.

True

popNextImageAndMD

popNextImageAndMD(
    channel: int, slice: int, *, fix: bool = True
) -> tuple[ndarray, Metadata]
popNextImageAndMD(*, fix: bool = True) -> tuple[ndarray, Metadata]
popNextImageAndMD(
    channel: int = 0, slice: int = 0, *, fix: bool = True
) -> tuple[ndarray, Metadata]

Gets and removes the next image (and metadata) from the circular buffer.

This is a convenience method that is very similar to popNextImageMD, except that it doesn't require instantiating a MetaData object first. It returns a tuple containing the image and a pymmcore_plus.Metadata object.

It also adds a fix parameter, which reshapes multi-component images (like RGB images) to (w, h, n_components) using fixImage by default.

Parameters:

Name Type Description Default
channel int

Channel index, by default None

0
slice int

Slice index, by default None

0
fix bool

If True (the default), then images with n_components > 1 (like RGB images) will be reshaped to (w, h, n_components) using fixImage.

True

Returns:

Type Description
tuple[ndarray, Metadata]

Image and metadata

popNextImageMD

popNextImageMD(channel: int, slice: int, md: Metadata) -> ndarray
popNextImageMD(md: Metadata) -> ndarray
popNextImageMD(channel: int, slice: int, md: Metadata) -> ndarray

Gets and removes the next image (and metadata) from the circular buffer

popNextTaggedImage

popNextTaggedImage(channel_index: int = 0) -> TaggedImage

Return popNextImageAndMD as named tuple with metadata.

✨ This method is new in CMMCorePlus. It returns an object similar to MMCoreJ.popNextTaggedImage().

prepareSequenceAcquisition

prepareSequenceAcquisition(cameraLabel: DeviceLabel | str) -> None

Prepare the camera for the sequence acquisition to save the time in the

StartSequenceAcqusition() call which is supposed to come next.

setCircularBufferMemoryFootprint

setCircularBufferMemoryFootprint(sizeMB: int) -> None

Reserve memory for the circular buffer.

snap

snap(numChannel: int | None = None, *, fix: bool = True) -> ndarray

Snap and return an image.

Convenience for calling self.snapImage() followed by returning the value of self.getImage().

Parameters:

Name Type Description Default
numChannel int

The camera channel to get the image from. If None, (the default), then Multi-Channel cameras will return the content of the first channel.

None
fix bool

If True (the default), then images with n_components > 1 (like RGB images) will be reshaped to (w, h, n_components) using fixImage.

True

Returns:

Name Type Description
img ndarray

snapImage

snapImage() -> None

Acquires a single image with current settings.

Why Override? To emit the imageSnapped event after snapping an image, and to emit shutter property changes if getAutoShutter is True.

startContinuousSequenceAcquisition

startContinuousSequenceAcquisition(intervalMs: float = 0) -> None

Start a ContinuousSequenceAcquisition.

Why Override? To emit the continuousSequenceAcquisitionStarting and continuousSequenceAcquisitionStarted events.

startSequenceAcquisition

startSequenceAcquisition(
    numImages: int, intervalMs: float, stopOnOverflow: bool
) -> None
startSequenceAcquisition(
    cameraLabel: str, numImages: int, intervalMs: float, stopOnOverflow: bool
) -> None
startSequenceAcquisition(*args: Any) -> None

Starts streaming camera sequence acquisition.

This command does not block the calling thread for the duration of the acquisition.

Why Override? To emit the sequenceAcquisitionStarting and sequenceAcquisitionStarted events.

stopSequenceAcquisition

stopSequenceAcquisition(cameraLabel: str | None = None) -> None

Stops streaming camera sequence acquisition.

(for a specified camera if cameraLabel is provided.)

Why Override? To emit a sequenceAcquisitionStopped event.

Stages

getFocusDevice

getFocusDevice() -> DeviceLabel | Literal['']

Returns the label of the currently selected focus device.

Returns empty string if no focus device is selected.

getFocusDirection

getFocusDirection(stageLabel: str) -> FocusDirection

Return the focus direction of a stage.

Why Override? The returned pymmcore_plus.FocusDirection enum is more interpretable than the raw int returned by pymmcore

getPosition

getPosition() -> float
getPosition(stageLabel: DeviceLabel | str) -> float
getPosition() -> float

Returns the current position of the current FocusDevice in microns.

getXPosition

getXPosition() -> float
getXPosition(xyStageLabel: DeviceLabel | str) -> float
getXPosition() -> float

Obtains the current position of the X axis of the XY stage in microns.

getXYPosition

getXYPosition() -> Sequence[float]
getXYPosition(xyStageLabel: DeviceLabel | str) -> Sequence[float]
getXYPosition() -> Sequence[float]

Obtains the current position of the XY stage in microns.

getXYStageDevice

getXYStageDevice() -> DeviceLabel | Literal['']

Returns the label of the currently selected XYStage device.

Returns empty string if no XYStage device is selected.

getYPosition

getYPosition() -> float
getYPosition(xyStageLabel: DeviceLabel | str) -> float
getYPosition() -> float

Obtains the current position of the Y axis of the XY stage in microns.

getZPosition

getZPosition() -> float

Obtains the current position of the Z axis of the Z stage in microns.

✨ This method is new in CMMCorePlus: added to complement getXPosition and getYPosition

Note

This is simply an alias for getPosition], which returns the position of the current focus device when called without arguments.

home

home(xyOrZStageLabel: DeviceLabel | str) -> None

Perform a hardware homing operation for an XY or focus/Z stage.

isStageUsingCallbacks

isStageUsingCallbacks(stageLabel: DeviceLabel | str) -> bool

Queries whether the stage uses callbacks to signal position changes.

isXYStageUsingCallbacks

isXYStageUsingCallbacks(xyStageLabel: DeviceLabel | str) -> bool

Queries whether the XY stage uses callbacks to signal position changes.

setAdapterOrigin

setAdapterOrigin(newZUm: float) -> None
setAdapterOrigin(stageLabel: DeviceLabel | str, newZUm: float) -> None
setAdapterOrigin(newZUm: float) -> None

Enable software translation of coordinates for the current focus/Z stage.

setAdapterOriginXY

setAdapterOriginXY(newXUm: float, newYUm: float) -> None
setAdapterOriginXY(
    xyStageLabel: DeviceLabel | str, newXUm: float, newYUm: float
) -> None
setAdapterOriginXY(newXUm: float, newYUm: float) -> None

Enable software translation of coordinates for the current XY stage.

The current position of the stage becomes (newXUm, newYUm). It is recommended that setOriginXY() be used instead where available.

setFocusDevice

setFocusDevice(focusLabel: str) -> None

Set the current Focus Device and emit a propertyChanged signal.

setFocusDirection

setFocusDirection(stageLabel: DeviceLabel | str, sign: int) -> None

Set the focus direction of a stage.

setOrigin

setOrigin() -> None
setOrigin(stageLabel: DeviceLabel | str) -> None
setOrigin() -> None

Zero the current focus/Z stage's coordinates at the current position.

setOriginX

setOriginX() -> None
setOriginX(xyStageLabel: DeviceLabel | str) -> None
setOriginX() -> None

Zero the given XY stage's X coordinate at the current position.

setOriginXY

setOriginXY() -> None
setOriginXY(xyStageLabel: DeviceLabel | str) -> None
setOriginXY() -> None

Zero the current XY stage's coordinates at the current position.

setOriginY

setOriginY() -> None
setOriginY(xyStageLabel: DeviceLabel | str) -> None
setOriginY() -> None

Zero the given XY stage's Y coordinate at the current position.

setPosition

setPosition(position: float) -> None
setPosition(stageLabel: DeviceLabel | str, position: float) -> None
setPosition(position: float) -> None

Sets the position of the current FocusDevice in microns.

setRelativePosition

setRelativePosition(d: float) -> None
setRelativePosition(stageLabel: DeviceLabel | str, d: float) -> None
setRelativePosition(d: float) -> None

Sets the relative position of the stage in microns.

setRelativeXYPosition

setRelativeXYPosition(dx: float, dy: float) -> None
setRelativeXYPosition(
    xyStageLabel: DeviceLabel | str, dx: float, dy: float
) -> None
setRelativeXYPosition(dx: float, dy: float) -> None

Sets the relative position of the XY stage in microns.

setRelativeXYZPosition

setRelativeXYZPosition(dx: float = 0, dy: float = 0, dz: float = 0) -> None

Sets the relative XYZ position in microns.

This is a convenience method that calls setXYPosition and setZPosition with the current position as the starting point.

Parameters:

Name Type Description Default
dx float

The relative change in X position, by default 0

0
dy float

The relative change in Y position, by default 0

0
dz float

The relative change in Z position, by default 0

0

setXYPosition

setXYPosition(x: float, y: float) -> None
setXYPosition(xyStageLabel: str, x: float, y: float) -> None
setXYPosition(*args: Any) -> None

Sets the position of the XY stage in microns.

Why Override? to store the last commanded stage position internally.

setXYStageDevice

setXYStageDevice(xyStageLabel: DeviceLabel | str) -> None

Sets the current XY device.

setZPosition

setZPosition(val: float) -> None

Set the position of the current focus device in microns.

✨ This method is new in CMMCorePlus: added to complement setXYPosition

Note

This is simply an alias for setPosition, which returns the position of the current focus device when called with a single argument.

stop

stop(xyOrZStageLabel: DeviceLabel | str) -> None

Stop the XY or focus/Z stage motors

Shutters

getAutoShutter

getAutoShutter() -> bool

Returns the current setting of the auto-shutter option.

getShutterDevice

getShutterDevice() -> DeviceLabel | Literal['']

Returns the label of the currently selected shutter device.

Returns empty string if no shutter device is selected.

getShutterOpen

getShutterOpen() -> bool
getShutterOpen(shutterLabel: DeviceLabel | str) -> bool
getShutterOpen() -> bool

Returns the state of the currently selected (default) shutter.

setAutoShutter

setAutoShutter(state: bool) -> None

Set shutter to automatically open and close when an image is acquired.

Why Override? To emit an autoShutterSet event.

setShutterDevice

setShutterDevice(shutterLabel: DeviceLabel | str) -> None

the current shutter device.

setShutterOpen

setShutterOpen(state: bool) -> None
setShutterOpen(shutterLabel: str, state: bool) -> None
setShutterOpen(*args: Any) -> None

Open or close the currently selected or shutterLabel shutter.

Why Override? To emit a propertyChanged event.

State devices

defineStateLabel

defineStateLabel(
    stateDeviceLabel: DeviceLabel | str, state: int, stateLabel: str
) -> None

Defines a label for the specific state.

getNumberOfStates

getNumberOfStates(stateDeviceLabel: DeviceLabel | str) -> int

Returns the total number of available positions (states).

getState

getState(stateDeviceLabel: DeviceLabel | str) -> int

Returns the current state (position) on the specific device.

getStateFromLabel

getStateFromLabel(
    stateDeviceLabel: DeviceLabel | str, stateLabel: StateLabel | str
) -> int

Obtain the state for a given label.

getStateLabel

getStateLabel(stateDeviceLabel: DeviceLabel | str) -> StateLabel

Returns the current state as the label (string).

getStateLabels

getStateLabels(stateDeviceLabel: DeviceLabel | str) -> tuple[StateLabel, ...]

Return labels for all states

guessObjectiveDevices

guessObjectiveDevices() -> list[str]

Find any loaded devices that are likely to be an Objective/Nosepiece.

Likely matches are loaded StateDevices with names that match this object's objective_device_pattern property. This is a settable property with a default value of::

re.compile("(.+)?(nosepiece|obj(ective)?)(turret)?s?", re.IGNORECASE)

objective_device_pattern property writable

objective_device_pattern: Pattern

Pattern used to guess objective device labels.

It is the regex used by guessObjectiveDevices to find any devices that are likely to be objective devices.

By default:

re.compile("(.+)?(nosepiece|obj(ective)?)(turret)?s?", re.IGNORECASE)

setState

setState(stateDeviceLabel: str, state: int) -> None

Set state (by position) on stateDeviceLabel, with reliable event emission.

Why Override? In MMCore, the calling of the onPropertyChanged callback is left to the underlying device adapter, which means it is not always called. This method overrides the default implementation to ensure that events.propertyChanged is always emitted when setProperty has been called and the property Value has actually changed.

setStateLabel

setStateLabel(stateDeviceLabel: str, stateLabel: str) -> None

Set state (by label) on stateDeviceLabel, with reliable event emission.

Why Override? In MMCore, the calling of the onPropertyChanged callback is left to the underlying device adapter, which means it is not always called. This method overrides the default implementation to ensure that events.propertyChanged is always emitted when setProperty has been called and the property Value has actually changed.

Autofocus

enableContinuousFocus

enableContinuousFocus(enable: bool) -> None

Enables or disables the operation of the continuous focusing hardware device.

fullFocus

fullFocus() -> None

Performs focus acquisition and lock for the one-shot focusing device.

getAutoFocusDevice

getAutoFocusDevice() -> DeviceLabel | Literal['']

Returns the label of the currently selected auto-focus device.

Returns empty string if no auto-focus device is selected.

getAutoFocusOffset

getAutoFocusOffset() -> float

Return the current offset of the one-shot focusing device.

Why Override? For known autofocus devices with a separate offset device (see setAutoFocusOffset), this returns the position of that offset device.

getCurrentFocusScore

getCurrentFocusScore() -> float

Returns the focus score from the default focusing device measured at the current Z position.

getLastFocusScore

getLastFocusScore() -> float

Returns the latest focus score from the focusing device.

incrementalFocus

incrementalFocus() -> None

Performs incremental focus for the one-shot focusing device.

isContinuousFocusDrive

isContinuousFocusDrive(stageLabel: DeviceLabel | str) -> bool

Check if a stage has continuous focusing capability.

(positions can be set while continuous focus runs).

isContinuousFocusEnabled

isContinuousFocusEnabled() -> bool

Checks if the continuous focusing hardware device is ON or OFF.

isContinuousFocusLocked

isContinuousFocusLocked() -> bool

Returns the lock-in status of the continuous focusing device.

setAutoFocusDevice

setAutoFocusDevice(focusLabel: DeviceLabel | str) -> None

Sets the current auto-focus device.

setAutoFocusOffset

setAutoFocusOffset(offset: float) -> None

Applies offset the one-shot focusing device.

In micro-manager, there is some variability in the way that autofocus devices are implemented. Some have a separate offset device, while others can directly set the offset of an associated device. As a result, calling setAutoFocusOffset, may or may not do anything depending on the current autofocus device.

This method attempts to detect known autofocus devices that have a separate offset device, and for those it also sets the position of the offset device.

Pixel size

definePixelSizeConfig

definePixelSizeConfig(resolutionID: str) -> None
definePixelSizeConfig(
    resolutionID: str, deviceLabel: str, propName: str, value: str
) -> None
definePixelSizeConfig(*args: str, **kwargs: str) -> None

Defines an empty pixel size entry.

Why Override? To emit a pixelSizeChanged event.

deletePixelSizeConfig

deletePixelSizeConfig(resolutionID: str) -> None

Delete the pixel size configuration for the given resolutionID.

Why Override? To emit a pixelSizeChanged event.

getAvailablePixelSizeConfigs

getAvailablePixelSizeConfigs() -> tuple[PixelSizeConfigName, ...]

Returns all defined resolution preset names

getCurrentPixelSizeConfig

getCurrentPixelSizeConfig() -> PixelSizeConfigName
getCurrentPixelSizeConfig(cached: bool) -> PixelSizeConfigName
getCurrentPixelSizeConfig() -> PixelSizeConfigName

Get the current pixel configuration name

getMagnificationFactor

getMagnificationFactor() -> float

Returns the product of all Magnifiers in the system or 1.0 when none is found. This is used internally by GetPixelSizeUm

getPixelSizeAffine

getPixelSizeAffine() -> AffineTuple
getPixelSizeAffine(cached: bool) -> AffineTuple
getPixelSizeAffine() -> AffineTuple

Returns the current Affine Transform to related camera pixels with stage movement.

getPixelSizeAffineByID

getPixelSizeAffineByID(resolutionID: PixelSizeConfigName | str) -> AffineTuple

Returns the Affine Transform to related camera pixels with stage movement for the requested pixel size group. The raw affine transform without correction for binning and magnification will be returned.

getPixelSizeConfigData

getPixelSizeConfigData(
    configName: str, *, native: Literal[True]
) -> Configuration
getPixelSizeConfigData(
    configName: str, *, native: Literal[False] = False
) -> Configuration
getPixelSizeConfigData(
    configName: str, *, native: bool = False
) -> Configuration | Configuration

Return the configuration object for a given pixel size preset configName.

Why Override? The pymmcore_plus.Configuration object returned when native=False (the default) provides a nicer Mapping interface. Pass native=True to get the original pymmcore.Configuration object.

getPixelSizedxdz

getPixelSizedxdz() -> float
getPixelSizedxdz(cached: bool) -> float
getPixelSizedxdz(resolutionID: PixelSizeConfigName | str) -> float
getPixelSizedxdz() -> float

Returns the angle between the camera's x axis and the axis (direction) of the z drive.

This angle is dimensionless (i.e. the ratio of the translation in x caused by a translation in z, i.e. dx / dz). This angle can be different for different z drives (if there are multiple Z drives in the system, please add the Core-Focus device to the pixel size configuration). See: https://github.com/micro-manager/micro-manager/issues/1984

getPixelSizedydz

getPixelSizedydz() -> float
getPixelSizedydz(cached: bool) -> float
getPixelSizedydz(resolutionID: PixelSizeConfigName | str) -> float
getPixelSizedydz() -> float

Returns the angle between the camera's y axis and the axis (direction) of the z drive.

This angle is dimensionless (i.e. the ratio of the translation in x caused by a translation in z, i.e. dy / dz). This angle can be different for different z drives (if there are multiple Z drives in the system, please add the Core-Focus device to the pixel size configuration). See: https://github.com/micro-manager/micro-manager/issues/1984

getPixelSizeOptimalZUm

getPixelSizeOptimalZUm() -> float
getPixelSizeOptimalZUm(cached: bool) -> float
getPixelSizeOptimalZUm(resolutionID: PixelSizeConfigName | str) -> float
getPixelSizeOptimalZUm() -> float

Returns the optimal z step size in um, optionally using cached pixel configuration.

There is no magic to this number, but lets the system configuration communicate to the end user what the optimal Z step size is for this pixel size configuration

getPixelSizeUm

getPixelSizeUm() -> float
getPixelSizeUm(cached: bool) -> float
getPixelSizeUm() -> float

Returns the current pixel size in microns.

getPixelSizeUmByID

getPixelSizeUmByID(resolutionID: PixelSizeConfigName | str) -> float

Returns the pixel size in um for the requested pixel size group

isPixelSizeConfigDefined

isPixelSizeConfigDefined(resolutionID: str) -> bool

Checks if the Pixel Size Resolution already exists

renamePixelSizeConfig

renamePixelSizeConfig(
    oldConfigName: PixelSizeConfigName | str, newConfigName: str
) -> None

Renames a pixel size configuration.

setPixelSizeAffine

setPixelSizeAffine(
    resolutionID: PixelSizeConfigName | str, affine: Sequence[float]
) -> None

Sets the raw affine transform for the specific pixel size configuration.

The affine transform consists of the first two rows of a 3x3 matrix, the third row is always assumed to be 0.0 0.0 1.0.

setPixelSizeConfig

setPixelSizeConfig(resolutionID: PixelSizeConfigName | str) -> None

Applies a Pixel Size Configuration.

setPixelSizedxdz

setPixelSizedxdz(resolutionID: PixelSizeConfigName | str, dXdZ: float) -> None

Sets the pixel size in the X direction in microns.

setPixelSizedydz

setPixelSizedydz(resolutionID: PixelSizeConfigName | str, dYdZ: float) -> None

Sets the pixel size in the Y direction in microns.

setPixelSizeOptimalZUm

setPixelSizeOptimalZUm(
    resolutionID: PixelSizeConfigName | str, optimalZ: float
) -> None

Sets the pixel size in the Z direction in microns.

setPixelSizeUm

setPixelSizeUm(resolutionID: str, pixSize: float) -> None

Set pixel size in microns for the specified resolutionID.

Why Override? To emit a pixelSizeChanged event.

Hardware sequencing

canSequenceEvents

canSequenceEvents(e1: MDAEvent, e2: MDAEvent, cur_length: int = -1) -> bool

Check whether two useq.MDAEvent are sequenceable by this core instance.

Deprecated

canSequenceEvents is deprecated. To see how this core will combine a list of events into SequencedEvent objects, use iter_sequenced_events: list(iter_sequenced_events(core, [e1, e2])).

Micro-Manager calls hardware triggering "sequencing". Two events can be sequenced if all device properties that are changing between the first and second event support sequencing.

If cur_length is provided, it is used to determine if the sequence is "full" (i.e. the sequence is already at the maximum length) as determined by the ...SequenceMaxLength() method corresponding to the device property.

See: https://micro-manager.org/Hardware-based_Synchronization_in_Micro-Manager

Parameters:

Name Type Description Default
e1 MDAEvent

The first event.

required
e2 MDAEvent

The second event.

required
cur_length int

The current length of the sequence. Used when checking .get<...>SequenceMaxLength for a given property. If the current length is greater than the max length, the events cannot be sequenced. By default -1, which means the current length is not checked.

-1

Returns:

Type Description
bool

True if the events can be sequenced, False otherwise.

Examples:

Note

The results here will depend on the current state of the core and devices.

>>> from useq import MDAEvent
>>> core = CMMCorePlus.instance()
>>> core.loadSystemConfiguration()
>>> core.canSequenceEvents(MDAEvent(), MDAEvent())
True
>>> core.canSequenceEvents(MDAEvent(x_pos=1), MDAEvent(x_pos=2))
False
>>> core.canSequenceEvents(
...     MDAEvent(channel={'config': 'DAPI'}),
...     MDAEvent(channel={'config': 'FITC'})
... )
False

getExposureSequenceMaxLength

getExposureSequenceMaxLength(cameraLabel: DeviceLabel | str) -> int

Gets the maximum length of a camera's exposure sequence.

getPropertySequenceMaxLength

getPropertySequenceMaxLength(
    label: DeviceLabel | str, propName: PropertyName | str
) -> int

Queries device property for the maximum number of events that can be put in a sequence

getStageSequenceMaxLength

getStageSequenceMaxLength(stageLabel: DeviceLabel | str) -> int

Gets the maximum length of a stage's position sequence.

getXYStageSequenceMaxLength

getXYStageSequenceMaxLength(xyStageLabel: DeviceLabel | str) -> int

Gets the maximum length of an XY stage's position sequence.

isExposureSequenceable

isExposureSequenceable(cameraLabel: DeviceLabel | str) -> bool

Queries camera if exposure can be used in a sequence

isPropertySequenceable

isPropertySequenceable(
    label: DeviceLabel | str, propName: PropertyName | str
) -> bool

Queries device if the specified property can be used in a sequence

isStageLinearSequenceable

isStageLinearSequenceable(stageLabel: DeviceLabel | str) -> bool

Queries if the stage can be used in a linear sequence.

A linear sequence is defined by a stepsize and number of slices

isStageSequenceable

isStageSequenceable(stageLabel: DeviceLabel | str) -> bool

Queries stage if it can be used in a sequence

isXYStageSequenceable

isXYStageSequenceable(xyStageLabel: DeviceLabel | str) -> bool

Queries XY stage if it can be used in a sequence

loadExposureSequence

loadExposureSequence(
    cameraLabel: DeviceLabel | str, exposureSequence_ms: Sequence[float]
) -> None

Transfer a sequence of exposure times to the camera.

loadPropertySequence

loadPropertySequence(
    label: DeviceLabel | str,
    propName: PropertyName | str,
    eventSequence: Sequence[str],
) -> None

Transfer a sequence of events/states/whatever to the device.

This should only be called for device-properties that are sequenceable

loadStageSequence

loadStageSequence(
    stageLabel: DeviceLabel | str, positionSequence: Sequence[float]
) -> None

Transfer a sequence of events/states/whatever to the device.

This should only be called for device-properties that are sequenceable

loadXYStageSequence

loadXYStageSequence(
    xyStageLabel: DeviceLabel | str,
    xSequence: Sequence[float],
    ySequence: Sequence[float],
) -> None

Transfer a sequence of stage positions to the xy stage.

xSequence and ySequence must have the same length. This should only be called for XY stages that are sequenceable

setStageLinearSequence

setStageLinearSequence(
    stageLabel: DeviceLabel | str, dZ_um: float, nSlices: int
) -> None

Loads a linear sequence (defined by stepsize and nr. of steps) into the device.

startExposureSequence

startExposureSequence(cameraLabel: DeviceLabel | str) -> None

Starts an ongoing sequence of triggered exposures in a camera.

This should only be called for cameras where exposure time is sequenceable

startPropertySequence

startPropertySequence(
    label: DeviceLabel | str, propName: PropertyName | str
) -> None

Starts an ongoing sequence of triggered events in a property of a device.

This should only be called for device-properties that are sequenceable

startStageSequence

startStageSequence(stageLabel: DeviceLabel | str) -> None

Starts an ongoing sequence of triggered events in a stage.

This should only be called for stages

startXYStageSequence

startXYStageSequence(xyStageLabel: DeviceLabel | str) -> None

Starts an ongoing sequence of triggered events in an XY stage.

This should only be called for stages

stopExposureSequence

stopExposureSequence(cameraLabel: DeviceLabel | str) -> None

Stops an ongoing sequence of triggered exposures in a camera.

This should only be called for cameras where exposure time is sequenceable

stopPropertySequence

stopPropertySequence(
    label: DeviceLabel | str, propName: PropertyName | str
) -> None

Stops an ongoing sequence of triggered events in a property of a device.

This should only be called for device-properties that are sequenceable

stopStageSequence

stopStageSequence(stageLabel: DeviceLabel | str) -> None

Stops an ongoing sequence of triggered events in a stage.

This should only be called for stages that are sequenceable

stopXYStageSequence

stopXYStageSequence(xyStageLabel: DeviceLabel | str) -> None

Stops an ongoing sequence of triggered events in an XY stage.

This should only be called for stages that are sequenceable

Logging & errors

debugLogEnabled

debugLogEnabled() -> bool

Indicates if logging of debug messages is enabled

enableDebugLog

enableDebugLog(enable: bool) -> None

Enable or disable logging of debug messages.

enableFeature

enableFeature(name: FeatureFlag | str, enable: bool) -> None

Enable or disable the given Core feature.

Core features control whether experimental functionality (which is subject to breaking changes) is exposed, or whether stricter API usage is enforced.

Currently switchable features:

  • "StrictInitializationChecks" (default: disabled) When enabled, an exception is thrown when an operation requiring an initialized device is attempted on a device that is not successfully initialized. When disabled, no exception is thrown and a warning is logged (and the operation may potentially cause incorrect behavior or a crash).
  • "ParallelDeviceInitialization" (default: enabled) When enabled, serial ports are initialized in serial order, and all other devices are in parallel, using multiple threads, one per device module. Early testing shows this to be reliable, but switch this off when issues are encountered during device initialization.

enableStderrLog

enableStderrLog(enable: bool) -> None

Enables or disables log message display on the standard console.

getCoreErrorText

getCoreErrorText(code: int) -> str

Returns a pre-defined error test with the given error code

getPrimaryLogFile

getPrimaryLogFile() -> str

Return the name of the primary Core log file.

getPrimaryLogLevel

getPrimaryLogLevel() -> LogLevel

Return the current primary log file level.

getStderrLogLevel

getStderrLogLevel() -> LogLevel

Return the current stderr log level.

isFeatureEnabled

isFeatureEnabled(name: str) -> bool

Return whether the given Core feature is currently enabled.

See enableFeature() for the available features.

Raises RuntimeError if the feature name is not recognized.

log

log(msg: str, level: LogLevel) -> None
log(msg: str, level: LogLevel, loggerName: str) -> None
log(msg: str, level: LogLevel) -> None

Log a message at the given level.

logMessage

logMessage(msg: str) -> None
logMessage(msg: str, debugOnly: bool) -> None
logMessage(msg: str) -> None

Record text message in the log file.

setPrimaryLogFile

setPrimaryLogFile(filename: str) -> None
setPrimaryLogFile(filename: str, truncate: bool) -> None
setPrimaryLogFile(filename: str) -> None

Set the primary Core log file.

setPrimaryLogFileRotation

setPrimaryLogFileRotation(maxFileSize: int, maxBackupCount: int) -> None

Set the primary log file rotation parameters.

setPrimaryLogLevel

setPrimaryLogLevel(level: LogLevel) -> None

Set the log level for the primary log file.

setStderrLogLevel

setStderrLogLevel(level: LogLevel) -> None

Set the stderr log level.

startSecondaryLogFile

startSecondaryLogFile(filename: str, enableDebug: bool) -> int
startSecondaryLogFile(filename: str, enableDebug: bool, truncate: bool) -> int
startSecondaryLogFile(
    filename: str, enableDebug: bool, truncate: bool, synchronous: bool
) -> int
startSecondaryLogFile(filename: str, enableDebug: bool) -> int

Start capturing logging output into an additional file.

stderrLogEnabled

stderrLogEnabled() -> bool

Indicates whether logging output goes to stdErr

stopSecondaryLogFile

stopSecondaryLogFile(handle: int) -> None

Stop capturing logging output into an additional file.

SLMs

displaySLMImage

displaySLMImage(slmLabel: DeviceLabel | str) -> None

Display the waiting image on the SLM.

getSLMBytesPerPixel

getSLMBytesPerPixel(slmLabel: DeviceLabel | str) -> int

Returns the number of bytes per SLM pixel

getSLMDevice

getSLMDevice() -> DeviceLabel | Literal['']

Returns the label of the currently selected SLM device.

Returns empty string if no SLM device is selected.

getSLMExposure

getSLMExposure(slmLabel: DeviceLabel | str) -> float

Returns the exposure time that will be used by the SLM for illumination

getSLMHeight

getSLMHeight(slmLabel: DeviceLabel | str) -> int

Returns the height (in "pixels") of the SLM

getSLMNumberOfComponents

getSLMNumberOfComponents(slmLabel: DeviceLabel | str) -> int

Returns the number of components (usually these depict colors) of the SLM.

For instance, an RGB projector will return 3, but a grey scale SLM returns 1

getSLMSequenceMaxLength

getSLMSequenceMaxLength(slmLabel: DeviceLabel | str) -> int

For SLMs that support sequences, returns the maximum length of the sequence that can be uploaded to the device

getSLMWidth

getSLMWidth(slmLabel: DeviceLabel | str) -> int

Returns the width (in "pixels") of the SLM

loadSLMSequence

loadSLMSequence(
    slmLabel: DeviceLabel | str, imageSequence: list[bytes]
) -> None

Load a sequence of images into the SLM

setSLMDevice

setSLMDevice(slmLabel: DeviceLabel | str) -> None

Sets the current slm device.

setSLMExposure

setSLMExposure(slmLabel: DeviceLabel | str, exposure_ms: float) -> None

For SLM devices with build-in light source (such as projectors), this will set the exposure time, but not (yet) start the illumination

setSLMImage

setSLMImage(slmLabel: DeviceLabel | str, pixels: NDArray[uint8]) -> None
setSLMImage(slmLabel: DeviceLabel | str, pixels: Any) -> None
setSLMImage(slmLabel: DeviceLabel | str, pixels: NDArray[uint8]) -> None

Write an image to the SLM .

When passing a numpy array, pixels must be one of the following:

  • a 2D numpy array [h,w] of uint8s, representing a grayscale image to write to the SLM.
  • a 3D numpy array [h,w,3] of uint8s with 3 color channels [R,G,B], representing an imgRGB32 image to write to the SLM.

In both cases, the dimensions of the array should match the width and height of the SLM.

Warning

SLM might convert grayscale to binary internally.

setSLMPixelsTo

setSLMPixelsTo(slmLabel: DeviceLabel | str, intensity: int) -> None
setSLMPixelsTo(
    slmLabel: DeviceLabel | str, red: int, green: int, blue: int
) -> None
setSLMPixelsTo(slmLabel: DeviceLabel | str, intensity: int) -> None

Set all SLM pixels to a single 8-bit intensity.

startSLMSequence

startSLMSequence(slmLabel: DeviceLabel | str) -> None

Starts the sequence previously uploaded to the SLM

stopSLMSequence

stopSLMSequence(slmLabel: DeviceLabel | str) -> None

Stops the SLM sequence if previously started

Galvos

addGalvoPolygonVertex

addGalvoPolygonVertex(
    galvoLabel: str, polygonIndex: int, x: float, y: float
) -> None

Add a vertex to a galvo polygon.

deleteGalvoPolygons

deleteGalvoPolygons(galvoLabel: DeviceLabel | str) -> None

Remove all added polygons

getGalvoChannel

getGalvoChannel(galvoLabel: DeviceLabel | str) -> str

Get the name of the active galvo channel (for a multi-laser galvo device).

getGalvoDevice

getGalvoDevice() -> DeviceLabel | Literal['']

Returns the label of the currently selected Galvo device.

Returns empty string if no Galvo device is selected.

getGalvoPosition

getGalvoPosition(galvoDevice: DeviceLabel | str) -> list[float]
getGalvoPosition(
    galvoLabel: DeviceLabel | str,
    x_stage: Sequence[float],
    y_stage: Sequence[float],
) -> None
getGalvoPosition(galvoDevice: DeviceLabel | str) -> list[float]

Get x,y position of the galvo device.

getGalvoXMinimum

getGalvoXMinimum(galvoLabel: DeviceLabel | str) -> float

Get the Galvo x minimum

getGalvoXRange

getGalvoXRange(galvoLabel: DeviceLabel | str) -> float

Get the Galvo x range

getGalvoYMinimum

getGalvoYMinimum(galvoLabel: DeviceLabel | str) -> float

Get the Galvo y minimum

getGalvoYRange

getGalvoYRange(galvoLabel: DeviceLabel | str) -> float

Get the Galvo y range

loadGalvoPolygons

loadGalvoPolygons(galvoLabel: DeviceLabel | str) -> None

Load a set of galvo polygons to the device

pointGalvoAndFire

pointGalvoAndFire(
    galvoLabel: DeviceLabel | str, x: float, y: float, pulseTime_us: float
) -> None

Set the Galvo to an x,y position and fire the laser for a predetermined duration.

runGalvoPolygons

runGalvoPolygons(galvoLabel: DeviceLabel | str) -> None

Run a loop of galvo polygons

runGalvoSequence

runGalvoSequence(galvoLabel: DeviceLabel | str) -> None

Run a sequence of galvo positions

setGalvoDevice

setGalvoDevice(galvoLabel: DeviceLabel | str) -> None

Sets the current galvo device.

setGalvoIlluminationState

setGalvoIlluminationState(galvoLabel: DeviceLabel | str, on: bool) -> None

Set the galvo's illumination state to on or off

setGalvoPolygonRepetitions

setGalvoPolygonRepetitions(
    galvoLabel: DeviceLabel | str, repetitions: int
) -> None

Set the number of times to loop galvo polygons

setGalvoPosition

setGalvoPosition(galvoLabel: DeviceLabel | str, x: float, y: float) -> None

Set the Galvo to an x,y position.

setGalvoSpotInterval

setGalvoSpotInterval(
    galvoLabel: DeviceLabel | str, pulseTime_us: float
) -> None

Set the SpotInterval for the specified galvo device.

Serial ports

getSerialPortAnswer

getSerialPortAnswer(portLabel: str, term: str) -> str

Continuously read from the serial port until the terminating sequence is encountered.

readFromSerialPort

readFromSerialPort(portLabel: str) -> list[str]

Reads the contents of the Rx buffer.

setSerialPortCommand

setSerialPortCommand(portLabel: str, command: str, term: str) -> None

Send string to the serial device and return an answer.

setSerialProperties

setSerialProperties(
    portName: str,
    answerTimeout: str,
    baudRate: str,
    delayBetweenCharsMs: str,
    handshaking: str,
    parity: str,
    stopBits: str,
) -> None

Sets all com port properties in a single call.

writeToSerialPort

writeToSerialPort(portLabel: str, data: bytes) -> None

Sends an array of characters to the serial port and returns immediately.

Pumps

getPumpFlowrate

getPumpFlowrate(pumpLabel: str) -> float

Return the flowrate of the pump in uL per second

getPumpMaxVolume

getPumpMaxVolume(pumpLabel: str) -> float

Return max volume of the pump in uL

getPumpPressureKPa

getPumpPressureKPa(pumpLabel: str) -> float

Return the pressure of the pump in kPa.

getPumpVolume

getPumpVolume(pumpLabel: str) -> float

Return the fluid volume in the pump in uL

invertPumpDirection

invertPumpDirection(pumpLabel: str, invert: bool) -> None

Sets whether the pump direction needs to be inverted

isPumpDirectionInverted

isPumpDirectionInverted(pumpLabel: str) -> bool

Return True if pump direction needs to be inverted

pressurePumpCalibrate

pressurePumpCalibrate(pumpLabel: str) -> None

Calibrates the pressure pump.

pressurePumpRequiresCalibration

pressurePumpRequiresCalibration(pumpLabel: str) -> bool

Return True if pump requires calibration before operation.

pressurePumpStop

pressurePumpStop(pumpLabel: str) -> None

Stops the pressure pump.

pumpDispenseDurationSeconds

pumpDispenseDurationSeconds(pumpLabel: str, seconds: float) -> None

Dispenses for the provided duration (in seconds) at the set flowrate.

pumpDispenseVolumeUl

pumpDispenseVolumeUl(pumpLabel: str, microLiter: float) -> None

Dispenses the provided volume (in uL) at the set flowrate.

pumpStart

pumpStart(pumpLabel: str) -> None

Start dispensing until syringe is empty, or manually stopped.

(whichever occurs first).

setPumpFlowrate

setPumpFlowrate(pumpLabel: str, volume: float) -> None

Set the flowrate of the pump in uL per second

setPumpMaxVolume

setPumpMaxVolume(pumpLabel: str, volume: float) -> None

Set the max volume of the pump in uL

setPumpPressureKPa

setPumpPressureKPa(pumpLabel: str, pressure: float) -> None

Sets the pressure of the pump in kPa.

setPumpVolume

setPumpVolume(pumpLabel: str, volume: float) -> None

Sets the volume of fluid in the pump in uL.

Note it does not withdraw upto this amount. It is merely to inform MM of the volume in a prefilled pump.

volumetricPumpHome

volumetricPumpHome(pumpLabel: str) -> None

Homes the volumetric pump.

volumetricPumpRequiresHoming

volumetricPumpRequiresHoming(pumpLabel: str) -> bool

Return True if the volumetric pump requires homing.

volumetricPumpStop

volumetricPumpStop(pumpLabel: str) -> None

Stops the volumetric pump.

Typed dictionaries

These are the return types of getDeviceSchema.

DeviceSchema

Bases: TypedDict

JSON schema dict describing a device.

title

title: str

description

description: str

type

type: str

properties

properties: dict[str, PropertySchema]

PropertySchema

Bases: TypedDict

JSON schema dict describing a device property.

type

type: str

maximum

maximum: float

minimum

minimum: float

enum

enum: list

readOnly

readOnly: bool

default

default: Any

sequenceable

sequenceable: bool

sequenceMaxLength

sequenceMaxLength: int

preInit

preInit: bool