common.py

Define common operations for PETGEM.

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

Method 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]

Print 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]

Definition of timer class.

elapsed = None
reset()[source]

Reset timer.

start()[source]

Start timer.

stop()[source]

Stop timer.

petgem.common.measure_all_class_methods(Cls)[source]

“Implement a decorator to measure execution time for each method.

Args:

f: the decorated function

Returns:

a function wrap

petgem.common.measure_time(f=None, group=None, split=False)[source]

“Implement method to measure execution time.

Args:

f: the decorated function group: the group name split: decides if all blocks in a group contribute to the same timer

Returns:

a function wrap

petgem.common.unitary_test()[source]

Unitary test for common.py script.