SimPEG.utils.call_hooks#

SimPEG.utils.call_hooks(match, mainFirst=False)[source]#

Wrap a function to an instance of a class.

Use the following syntax:

@call_hooks('doEndIteration')
def doEndIteration(self):
    pass

This will call everything named _doEndIteration at the beginning of the function call. By default the main method (doEndIteration) is run after all of the sub methods (_doEndIteration*). This can be reversed by adding the mainFirst=True kwarg.

Parameters:
matchstr

Name of the function being wrapped to class instance

mainFirstbool, default: False

Main first

Returns:
wrapper

The wrapper