simpeg.utils.requires#

simpeg.utils.requires(var)[source]#

Wrap a function to require a specfic attribute.

Use the following syntax to wrap a funciton:

@requires('prob')
def dpred(self):
    pass

This wrapper will ensure that a problem has been bound to the data. If a problem is not bound an Exception will be raised, and an nice error message printed.

Parameters:
var

Input variable

Returns:
wrapper

The wrapper