cofi.Inversion#
- class cofi.Inversion(inv_problem: BaseProblem, inv_options: InversionOptions)[source]#
The class holder that take in both an inversion problem setup
BaseProblemand inversion solver optionsInversionOptions, and handles the running of an inversion.Recall that we have 4 main steps to define and run an inversion through
cofi:Define a
BaseProblemobjectDefine an
InversionOptionsobjectPass both of the above objects into an
InversionHit that
Inversion.runmethod and get the resultInversionResult
So let’s think of
Inversionas 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 = inv.run()
See our example gallery for more inversion runs.
A future direction?
We seperate out this “inversion”, instead of passing a
BaseProblemobject directly to a hypotheticalInversionSolverconcept. This is not only because we want a cleaner workflow, but also because we imagine thisInversionobject to have more capability:>>> inv = Inversion(inv_problem, inv_options) >>> inv_result = inv.run() >>> inv.save("filename") >>> inv = Inversion.load("filename") >>> inv.analyse("filename")
Reference Details
- run() InversionResult[source]#
Starts the inversion and returns an
InversionResultobject.The inversion will be entirely based on the setup defined in
BaseProblemandInversionOptionsobjects.- Returns:
the result of inversion that has attributes
model/modelsandsuccessminimally. CheckInversionResultfor details.- Return type:
- summary()[source]#
Helper method that prints a summary of current
Inversionobject to consoleThis is essentially a higher level method that calls the
.summary()method on all of the three objects:InversionResult(if the inversion has finished)