common.py

Define common operations for PETGEM.

class petgem.common.Dictionary2Object(dictionary)[source]

Turns a dictionary into a class

class petgem.common.InputParameters(params, parEnv)[source]

This class provides a methods to import a yaml parameter file.

Parameters

object (dict) – user params yaml file.

Returns

user parameters as object view.

Return type

object.

class petgem.common.Print(text, color_code=None)[source]

This class provides methods for pretty print.

Parameters

str (object) – string to be printed.

Returns

None.

Return type

None.

classmethod header()[source]

This functions prints the header.

Param

None.

Returns

None.

Return type

None.

classmethod master(text, color_code=None)[source]

If the caller is the master process, this method prints a message.

Param

None.

Returns

None.

Return type

None.

class petgem.common.Timer(elapsed=0)[source]
elapsed = None
reset()[source]
start()[source]
stop()[source]
petgem.common.measure_all_class_methods(Cls)[source]
This function implement a decorator for obtaining execution times for

each method implemented on the decorated class.

Parameters

f (class) – the decorated class

Returns

a class wrap

Return type

class

petgem.common.measure_time(f=None, group=None, split=False)[source]
This function implement a decorator for obtaining the decorated method

execution time.

Parameters
  • f (function) – the decorated function

  • group (str) – the group name

  • split (bool) – decides if all blocks in a group contribute to the same timer

Returns

a function wrap

Return type

function

petgem.common.unitary_test()[source]

Unitary test for common.py script.