inversion_ideas.InversionLog#

class inversion_ideas.InversionLog(columns)#

Log the outputs of an inversion.

Parameters:
columnsdict

Dictionary with specification for the columns of the log table. The keys are the column titles as strings. The values can be callables that will be used to generate the value for each row and column, or Column. Each callable should take two arguments: iteration (an integer with the number of the iteration) and model (the inverted model as a 1d array).

Attributes

columns

Column specifiers.

has_records

Whether the log has recorded values or not.

log

Inversion log.

Methods

add_column(name, column)

Add column to the log.

create_from(objective_function, **kwargs)

Create the standard log for a classic inversion.

to_pandas([index_col])

Generate a pandas.DataFrame out of the log.

update(iteration, model)

Update the log.

Attributes#

InversionLog.columns#

Column specifiers.

InversionLog.has_records#

Whether the log has recorded values or not.

InversionLog.log#

Inversion log.

Methods#

Methods documentation

InversionLog.add_column(name, column)#

Add column to the log.

Parameters:
namestr

Name of the column, used in the InversionLog.log dictionary to access the recorded values.

columnCallable | Column

A callable that takes the iteration and the model as arguments, or a Column.

Returns:
self

classmethod InversionLog.create_from(objective_function, **kwargs)#

Create the standard log for a classic inversion.

Parameters:
objective_functionCombo

Combo objective function with two elements: the data misfit and the regularization (including a trade-off parameter).

kwargsdict

Keyword arguments passed to the constructor of the class.

Returns:
Self

Notes

The objective function should be of the type:

\[\phi(\mathbf{m}) = \phi_d(\mathbf{m}) + \beta \phi_m(\mathbf{m})\]

where \(\phi_d(m)\) is the data misfit term, \(\phi_m(\mathbf{m})\) is the model norm, and \(\beta\) is the trade-off parameter.


InversionLog.to_pandas(index_col=0)#

Generate a pandas.DataFrame out of the log.


InversionLog.update(iteration, model)#

Update the log.