phasorpy.utils#
Utility functions.
The phasorpy.utils
module provides auxiliary and convenience functions
that do not naturally fit into other modules.
- phasorpy.utils.number_threads(num_threads=None, max_threads=None, /)[source]#
Return number of threads for parallel computations across CPU cores.
This function is used to parse
num_threads
parameters.- Parameters:
num_threads (int, optional) – Number of threads to use for parallel computations on CPU cores. If None (default), return 1, disabling multi-threading. If greater than zero, return value up to max_threads if set. If zero, return the value of the
PHASORPY_NUM_THREADS
environment variable if set, else half the CPU cores up to max_threads or 32.max_threads (int, optional) – Maximum number of threads to return.
- Returns:
Number of threads for parallel computations.
- Return type:
int
Examples
>>> number_threads() 1 >>> number_threads(0) 8
- phasorpy.utils.versions(*, sep='\n', dash='-', verbose=False)[source]#
Return version information for PhasorPy and its dependencies.
- Parameters:
sep (str, optional) – Separator between version items. Defaults to newline.
dash (str, optional) – Separator between module name and version. Defaults to dash.
verbose (bool, optional) – Include paths to Python interpreter and modules.
- Returns:
Formatted string containing version information. Format: “<package><dash><version>[<space>(<path>)]<sep>”
- Return type:
str
Example
>>> print(versions()) Python-3... phasorpy-0... numpy-... ...