Utilities#
pymmcore_plus.find_micromanager(return_first: bool = True) -> str | None | list[str]
#
Locate a Micro-Manager folder (for device adapters).
In order, this will look for:
- An environment variable named
MICROMANAGER_PATH
- A path stored in the
CURRENT_MM_PATH
file (set byuse_micromanager
). -
A
Micro-Manager*
folder in thepymmcore-plus
user data directory (this is the default install location when runningmmcore install
)- Windows: C:\Users\[user]\AppData\Local\pymmcore-plus\pymmcore-plus
- macOS: ~/Library/Application Support/pymmcore-plus
- Linux: ~/.local/share/pymmcore-plus
-
A
Micro-Manager*
folder in thepymmcore_plus
package directory (this is the default install location when runningpython -m pymmcore_plus.install
) -
The default micro-manager install location:
- Windows:
C:/Program Files/
- macOS:
/Applications
- Linux:
/usr/local/lib
- Windows:
Note
This function is used by pymmcore_plus.CMMCorePlus
to locate the
micro-manager device adapters. By default, the output of this function
is passed to
setDeviceAdapterSearchPaths
when creating a new CMMCorePlus
instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
return_first |
bool, optional
|
If True (default), return the first found path. If False, return a list of all found paths. |
True
|
pymmcore_plus.use_micromanager(path: str | Path | None = None, pattern: str | Pattern[str] | None = None) -> Path | None
#
Set the preferred Micro-Manager path.
This sets the preferred micromanager path, and persists across sessions.
This path takes precedence over everything except the MICROMANAGER_PATH
environment variable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str | Path | None
|
Path to an existing directory. This directory should contain micro-manager
device adapters. If |
None
|
pattern |
str Pattern | | None
|
A regex pattern to match against the micromanager paths found by
|
None
|
pymmcore_plus.configure_logging(file: str | Path | None = LOG_FILE, stderr_level: int | str = DEFAULT_LOG_LEVEL, file_level: int | str = logging.DEBUG, log_to_stderr: bool = True, file_rotation: int = 40, file_retention: int = 20) -> None
#
Configure logging for pymmcore-plus.
This function is called automatically once when pymmcore-plus is imported, to set up logging to stderr and a log file. You can call it again to change the logging settings.
You may also configure logging using the following environment variables:
PYMM_LOG_LEVEL
- The log level forstderr
logging. By defaultINFO
.PYMM_LOG_FILE
- The path to the log file. If set to0
,false
,no
, ornone
, logging to file will be disabled.
Note
This function will clear all existing logging handlers and replace them with new ones. So be sure to pass all the settings you want to use each time you call this function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file |
str | Path | None
|
Path to logfile. May also be set with MM_LOG_FILE environment variable.
If |
LOG_FILE
|
stderr_level |
int | str
|
Level for stderr logging.
One of "TRACE", "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL",
or 5, 10, 20, 30, 40, or 50, respectively.
by default |
DEFAULT_LOG_LEVEL
|
file_level |
int | str
|
Level for logging to file, by default |
logging.DEBUG
|
log_to_stderr |
bool
|
Whether to log to stderr, by default True |
True
|
file_rotation |
int
|
When to rollover to the next log file, in MegaBytes, by default |
40
|
file_retention |
int
|
Maximum number of log files to retain, by default |
20
|