qmat.utils

Utility function for qmat

Classes

Timer

Utility Timer class, that can be used as follow :

Functions

checkOverriding(cls, name[, isProperty])

Check if a class overrides a method with a given name

checkGenericConstr(cls)

Check if a class implement a constructor with a **kwargs generic parameter

storeAlias(cls, dico, alias)

Store a class into a dictionary with a given alias

storeClass(cls, dico)

Store a class into a dictionary

importAll(localVars, __all__, __path__, __name__, ...)

Import all submodules in the current (sub-)package

getClasses(dico[, module])

Retrieve all classes stored into a dictionary, filtering aliases

useQGen(__init__)

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

storeAlias(cls, dico, alias)[source]

Store a class into a dictionary with a given alias

storeClass(cls, dico)[source]

Store a class into a dictionary

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'
start()[source]
stop()[source]