pantea.utils package#
Submodules#
pantea.utils.attribute module#
- pantea.utils.attribute.asarray(data, dtype=None)[source]#
An utility function to cast input data (scalar, array, etc) to Array type with predefined dtype.
- Parameters
value (Any) – input data
dtype (Optional[Dtype], optional) – casted dtype. Default dtype will be used otherwise.
- Returns
casted input
- Return type
Array
- pantea.utils.attribute.set_as_attribute(obj, items, prefix='', postfix='')[source]#
An utility function to set a dictionary of items as the input object attributes.
- Parameters
obj (
Any) – instanceitems (Dict[str, Any]) – dictionary of attributes
prefix (str, optional) – _description_, defaults to “”
postfix (str, optional) – _description_, defaults to “”
- Return type
None
pantea.utils.batch module#
pantea.utils.compare module#
pantea.utils.profiler module#
- class pantea.utils.profiler.Profiler(name='Profiler', sort_by='cumtime')[source]#
Bases:
objectAn implementation of a basic profiler for debugging.
- How to use it:
add profile() as a decorator before each targeted method
use context manager to collect stats from the region of interest
pantea.utils.tokenize module#
Module contents#
- class pantea.utils.Profiler(name='Profiler', sort_by='cumtime')[source]#
Bases:
objectAn implementation of a basic profiler for debugging.
- How to use it:
add profile() as a decorator before each targeted method
use context manager to collect stats from the region of interest