cofi.Inversion#
- 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 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
BaseProblem
objectDefine an
InversionOptions
objectPass both of the above objects into an
Inversion
Hit that
Inversion.run
method and get the resultInversionResult
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 = inv.run()
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 hypotheticalInversionSolver
concept. This is not only because we want a cleaner workflow, but also because we imagine thisInversion
object 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() cofi._inversion.InversionResult [source]#
Starts the inversion and returns an
InversionResult
object.The inversion will be entirely based on the setup defined in
BaseProblem
andInversionOptions
objects.- Returns
the result of inversion that has attributes
model
/models
andsuccess
minimally. CheckInversionResult
for details.- Return type
- summary()[source]#
Helper method that prints a summary of current
Inversion
object 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)