class cofi.Inversion(inv_problem: cofi.base_problem.BaseProblem, inv_options: cofi.inversion_options.InversionOptions)[source]#

The class holder that take in both an inversion problem setup BaseProblem and inversion solver options InversionOptions, and handles the running of an inversion.

Recall that we have 4 main steps to define and run an inversion through cofi:

  1. Define a BaseProblem object

  2. Define an InversionOptions object

  3. Pass both of the above objects into an Inversion

  4. Hit that method and get the result InversionResult

So let’s think of Inversion as an engine that manages the input and output of an inversion run for you.

Example usage of Inversion

>>> from cofi import BaseProblem, InversionOptions, Inversion
>>> inv_problem = BaseProblem()
>>> inv_problem.set_... # attach info about your problem
>>> inv_options = InversionOptions()
>>> inv_options.set_... # select backend tool and solver-specific parameters
>>> inv = Inversion(inv_problem, inv_options)
>>> inv_result =

See our example gallery for more inversion runs.

A future direction?

We seperate out this “inversion”, instead of passing a BaseProblem object directly to a hypothetical InversionSolver concept. This is not only because we want a cleaner workflow, but also because we imagine this Inversion object to have more capability:

>>> inv = Inversion(inv_problem, inv_options)
>>> inv_result =
>>> inv = Inversion.load("filename")
>>> inv.analyse("filename")

Reference Details

run() cofi.inversion.InversionResult[source]#

Starts the inversion and returns an InversionResult object.

The inversion will be entirely based on the setup defined in BaseProblem and InversionOptions objects.


the result of inversion that has attributes model / models and success minimally. Check InversionResult for details.

Return type



Helper method that prints a summary of current Inversion object to console

This is essentially a higher level method that calls the .summary() method on all of the three objects:

back to top