ClearMap.Utils package¶
This sub-package provides utility functions used throughout the package
ClearMap.Utils.ParameterTools module¶
ParameterTools
Provides simple formatting tools to handle / print parameter dictionaries organized as key:value pairs.
-
getParameter
(parameter, key, default=None)[source]¶ Gets a parameter from a dict, returns default value if not defined
Parameters: - parameter (dict) – parameter dictionary
- key (object) – key
- default (object) – deault return value if parameter not defined
Returns: object – parameter value for key
-
writeParameter
(head=None, out=None, **args)[source]¶ Writes parameter settings in a formatted way
Parameters: - head (str or None) – prefix of each line
- out (object or None) – write to a specific output, if None return string
- **args – the parameter values as key=value arguments
Returns: str or None – a formated string with parameter info
ClearMap.Utils.ProcessWriter module¶
Provides simple formatting tools to print text with parallel process header
ClearMap.Utils.Timer module¶
Provides tools for timing
-
class
Timer
(verbose=False)[source]¶ Bases:
object
Class to stop time and print results in formatted way
-
time
¶ float
the time since the timer was started
-
elapsedTime
(head=None, asstring=True)[source]¶ Calculate elapsed time and return as formated string
Parameters: - head (str or None) – prefix to the string
- asstring (bool) – return as string or float
Returns: str or float – elapsed time
-