List of functions and classes (API)

List of functions and classes (API)#

Attention

This package is still under initial development stage, so public APIs are not expected to be stable. Please stay updated and don’t hesitate to raise feedback or issues through GitHub issues or Slack workspace.

APIs for Basic Usage#

%%{init: {'theme':'neutral'}}%% flowchart TB base_problem(BaseProblem object)-->inversion(Inversion object) inversion_options(InversionOptions object)-->inversion(Inversion object) inversion--".run()"-->inversion_result(InversionResult object)

A typical inversion run in cofi involves the following four objects:

BaseProblem:

base class of all forward problems that includes methods you can use to define a forward problem

InversionOptions:

a holder for you to define how you’d like the inversion problem to be solved

Inversion:

takes in both of above objects and can be thought of as a running engine

InversionResult:

an object returned by Inversion.run() (you won’t need to define this explicitly)

The “object” here is simply a variable, but more flexible and powerful than an integer or string, in the sense that they can have properties and methods attached to them. In the following pages we expand what are available for each of the class object we mention above, and how to use them.

cofi.BaseProblem

Base class for an inversion problem setup.

cofi.InversionOptions

Class for specification on how an inversion will run, including which backend tool to use and solver-specific parameters.

cofi.Inversion

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

cofi.InversionResult

The result class of an inversion run.

APIs for Advanced Usage#

BaseInferenceTool is the base class of all backend inversion tools. To plug in your own inversion tools, simply create a subclass of BaseInferenceTool and implements __init__() and __call__(). Expand the details below for more concrete examples.

cofi.tools.BaseInferenceTool(inv_problem, ...)

Base class for backend inference tool wrappers

CoFI Utils#

Module cofi.utils contains a set of helper classes and routines to enable easier problem definitions.

cofi.utils

Utility classes and functions (e.g. to generate regularization terms and more).