SimPEG.utils.create_wrapper_from_class#

SimPEG.utils.create_wrapper_from_class(input_class, *fun_names)[source]#

Create wrapper class with memory profiler.

Using memory_profiler.profile(), this function creates a wrapper class from the input class and function names specified.

Parameters
input_classclass

Input class being used to create the wrapper

fun_nameslist of str

Names of the functions that will be wrapped to the wrapper class. These names must correspond to methods of the input class.

Returns
class

Wrapper class

Examples

>>> foo_mem = create_wrapper_from_class(foo,['my_func'])
>>> fooi = foo_mem()
>>> for i in range(5):
>>>     fooi.my_func()

Then run it from the command line

python -m memory_profiler exampleMemWrapper.py