phasorpy.utils#
Utility functions.
The phasorpy.utils module provides auxiliary and convenience functions
that do not fit naturally into other modules.
- phasorpy.utils.logger()[source]#
Return PhasorPy logger instance.
- Returns:
Logger instance for ‘phasorpy’ namespace.
- Return type:
logging.Logger
Examples
>>> logger().info('This is a log message')
- 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_threadsparameters in the API.- Parameters:
num_threads (int, optional) – Number of threads to use for parallel computations on CPU cores. By default, return 1, disabling multithreading. If greater than zero, return the value, limited to max_threads if set. If zero, return the value of the
PHASORPY_NUM_THREADSenvironment variable if set, otherwise half the number of CPU cores (up to max_threads if specified, or 32 if not).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 # actual value depends on system
- phasorpy.utils.versions(*, sep='\n', dash='-', verbose=False)[source]#
Return version information for PhasorPy and its dependencies.
- Parameters:
sep (str, optional, default: newline) – Separator between version items. The default is newline.
dash (str, optional, default: -) – Separator between module name and version. The default is a dash.
verbose (bool, optional, default: False) – Include paths to Python interpreter and modules.
- Returns:
Formatted string containing version information. Format:
"<package><dash><version>[<space>(<path>)]<sep>"- Return type:
str
Examples
>>> print(versions()) Python-3.14.1 phasorpy-0.8 numpy-2.3.5 ...