qmat.utils
Utility function for qmat
Classes
Utility Timer class, that can be used as follow : |
Functions
|
Check if a class overrides a method with a given name |
|
Check if a class implement a constructor with a **kwargs generic parameter |
|
Store a class into a dictionary with a given alias |
|
Store a class into a dictionary |
|
Import all submodules in the current (sub-)package |
|
Retrieve all classes stored into a dictionary, filtering aliases |
|
Wrapper to extract \(Q_\Delta\)-generator parameters from kwargs arguments, |
Module Contents
- checkOverriding(cls, name, isProperty=True)[source]
Check if a class overrides a method with a given name
- checkGenericConstr(cls)[source]
Check if a class implement a constructor with a **kwargs generic parameter
- importAll(localVars, __all__, __path__, __name__, __import__)[source]
Import all submodules in the current (sub-)package
- getClasses(dico, module=None)[source]
Retrieve all classes stored into a dictionary, filtering aliases
- useQGen(__init__)[source]
Wrapper to extract \(Q_\Delta\)-generator parameters from kwargs arguments, using either a \(Q\)-generator qGen or separately given parameters.
- class Timer(name, scale=1, descr='tWall')[source]
Utility Timer class, that can be used as follow :
>>> with Timer("stuff"): # prints "Starting stuff ... >>> # ... do stuff >>> # prints " -- tWall : {tWall}s
The description at the end can be replaced using the descr constructor parameter, and the final wall time can be scaled using the scale parameter. Can also be used like this :
>>> clock = Timer("stuff") >>> clock.start() >>> # ... do stuff >>> clock.stop() >>> tWall = clock.tWall
- name
- scale = 1
- descr = 'tWall'