Reconstruction Problems
An EITProblem bundles everything a reconstruction needs — discretization, forward model, data term, objective (data misfit plus regularization, optionally in parameters σ = P θ), the current iterate and the history of the runs — and reconstruct! runs an optimizer on it. Repeated calls continue from the current iterate, e.g. a cheap method first and a more accurate one after it, or more iterations after inspecting the result. With a noise model, every run stops by the discrepancy principle on the data misfit.
using ModularEIT, ModularEITFerrite, Ferrite
disc = FerriteDiscretization(generate_grid(Triangle, (32, 32)))
prob = EITProblem(disc, CompleteElectrodeModel(angular_electrodes(disc, 16), 0.05), currents, voltages;
noise = RelativeGaussianNoise(0.01),
regularization = (1e-4 => TotalVariationRegularizer(disc; ε = 1e-2),))
reconstruct!(prob, LBFGS(); maxiter = 20) # coarse start
reconstruct!(prob, GaussNewton(); maxiter = 30) # continues from there
σ = solution(prob)The problem acts as an objective in its unknowns: objective_value(prob, θ) and value_and_gradient!(g, prob, θ) evaluate the full objective, and with ChainRulesCore loaded objective_value(prob, θ) has the same reverse differentiation rule as the objective (see Automatic differentiation).
ModularEIT.EITProblem — Type
EITProblem(disc, model, currents, voltages; noise = nothing, τ = 1.1, regularization = (),
parametrization = nothing, initial = 1.0, lower = 0.05, upper = nothing,
solver = DirectSolver(), misfit = SquaredEuclidean(), grounding = :integral)A complete EIT reconstruction problem: the discretization disc, the forward model of the electrode model model (or a ForwardModel passed as model), the measured voltages for the injected currents, and the current iterate.
noise: noise model of the data. Sets the discrepancy targetτ² E[misfit of exact data](fieldtarget,NaNwithout a noise model), at whichreconstruct!stops.regularization: termsα => Radded to the data misfit (RegularizedObjective).parametrization: unknownsθwithσ = P θ(e.g.SubspaceParametrizationor the pixels of a back end); bounds,initialand regularizers then refer toθ.initial: initial iterate (a number for a constant, or a vector).lower,upper: bounds of the iterate.solver,misfit,grounding: passed to theAdjointStateObjectiveand the forward model.
Fields: disc, forward, data (data term in the unknowns), objective (full objective), parametrization, θ (current iterate), target, lower, upper, history (the OptimizationState of every run).
See reconstruct!, solution and data_misfit. objective_value(prob, θ) and value_and_gradient!(g, prob, θ) evaluate the full objective, so a problem can be passed wherever an objective is used; objective_value(prob) evaluates it at the current iterate.
ModularEIT.reconstruct! — Function
reconstruct!(prob::EITProblem, method = GaussNewton(); maxiter = 50, callback = nothing, kwargs...)Minimize the objective of prob with method (any AbstractOptimizer), starting from the current iterate (a warm start, so repeated calls continue where the last one stopped), store the result as the new iterate, append the OptimizationState to prob.history and return it. kwargs are passed to minimize.
With a noise model the run stops by the discrepancy principle, as soon as the data misfit is below prob.target (status :ftarget); with regularization terms this is checked on the data misfit alone, at the cost of one forward solve per iteration. Proximal methods (ProximalGradient, ADMM) carry their non-smooth term themselves and minimize the data term prob.data.
ModularEIT.solution — Function
solution(prob::EITProblem)The conductivity coefficients of the current iterate (P θ with a parametrization, otherwise θ).
ModularEIT.data_misfit — Function
data_misfit(prob::EITProblem, θ = prob.θ)The data misfit (without regularization) at θ, the quantity that the discrepancy principle compares with prob.target.