inversion_ideas.InversionLogRich#
- class inversion_ideas.InversionLogRich(columns, **kwargs)#
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 are callables that will be used to generate the value for each row and column. Each callable should take two arguments:
iteration(an integer with the number of the iteration) andmodel(the inverted model as a 1d array).- kwargs
Pass extra options to
rich.table.Table.
Attributes
Column specifiers.
Whether the log has recorded values or not.
Inversion log.
Table for the 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.
live(**kwargs)Context manager for live update of the table.
show()Show log through a Rich console.
to_pandas([index_col])Generate a
pandas.DataFrameout of the log.update(iteration, model)Update the log.
Add row to the table given the latest inverted model.
Attributes#
- InversionLogRich.columns#
Column specifiers.
- InversionLogRich.has_records#
Whether the log has recorded values or not.
- InversionLogRich.log#
Inversion log.
- InversionLogRich.table#
Table for the inversion log.
Methods#
Methods documentation
- InversionLogRich.add_column(name, column)#
Add column to the log.
- Parameters:
- namestr
Name of the column, used in the
InversionLog.logdictionary to access the recorded values.- columnCallable | Column
A callable that takes the
iterationand themodelas arguments, or aColumn.
- Returns:
- self
- classmethod InversionLogRich.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.
- InversionLogRich.live(**kwargs)#
Context manager for live update of the table.
- InversionLogRich.show()#
Show log through a Rich console.
- InversionLogRich.to_pandas(index_col=0)#
Generate a
pandas.DataFrameout of the log.
- InversionLogRich.update(iteration, model)#
Update the log.
- InversionLogRich.update_table()#
Add row to the table given the latest inverted model.
- Parameters:
- model(n_params) array