Parametrizations
The unknowns of a reconstruction need not be the finite element coefficients of the conductivity. A parametrization $\sigma = P\theta$ maps parameters to coefficients, and ParametrizedObjective turns any objective into a function of $\theta$ (gradient $P^\top\nabla_\sigma J$, Jacobian $(\partial r/\partial\sigma) P$), so every optimizer applies.
PixelParametrization: the parameters are the pixels of an image on a rectangle that contains the domain, independent of the mesh. The mesh can be refined anywhere (e.g. towards the boundary) while the unknowns stay pixels, e.g. for image priors.SubspaceParametrization: pixels restricted to a subspace, e.g. low-frequency DCT modes (dct_basis) for a stable first stage of a coarse-to-fine reconstruction, or DCT modes plus free pixels along the boundary (boundary_band_basis).
pp = PixelParametrization(disc, 64, 64) # disc: any 2D mesh, e.g. refined at the boundary
obj = RegularizedObjective(ParametrizedObjective(data, pp),
1e-3 => TotalVariationRegularizer(pp.pixel_disc; ε = 1e-2))
res = minimize(obj, ones(parameter_count(pp)), GaussNewton(); lower = 0.05)
img = pixel_image(pp, res.σ) # 64 × 64, NaN outside the domain
C = dct_basis(pp, 8) # coarse stage: 64 DCT modes
sp = SubspaceParametrization(pp, C)
res0 = minimize(ParametrizedObjective(data, sp), [64.0; zeros(63)], GaussNewton())
θ0 = C * res0.σ # pixel start for the fine stageBounds on pixel parameters bound the conductivity (the weights of $P$ are non-negative and sum to one). Subspace parameters cannot be bounded this way: trial steps with a non-positive conductivity are rejected (InfeasibleConductivityError).
Theory: wiki article Parametrizations of the Conductivity.
ModularEIT.AbstractParametrization — Type
AbstractParametrizationA linear map σ = P θ from reconstruction parameters to conductivity coefficients, e.g. pixel values (PixelParametrization (Ferrite back end)) or subspaces of them (SubspaceParametrization). Objectives in the parameters: ParametrizedObjective.
ModularEITFerrite.PixelParametrization — Type
PixelParametrization(disc, n, m; bbox = nothing, pixels = :square, quadrature_order = nothing)Conductivity on disc parametrized by the values θ of an n × m pixel grid on the rectangle bbox (default: the bounding box of the mesh, widened to square pixels unless pixels = :stretch, as in unit_image): σ = P θ with P the lumped L² projection of the pixel function onto the σ space (weighted pixel averages; positive, constants preserved, exact on pixel-aligned meshes).
Fields: P (ndofs_σ × n m), pixel_disc (P0 discretization of the pixel grid; θ are its coefficients, e.g. for TotalVariationRegularizer), active (pixels that influence σ), centres (pixel centres in parameter order), bbox, n, m.
See conductivity, pixel_image, pixel_parameters, ParametrizedObjective, SubspaceParametrization.
ModularEIT.SubspaceParametrization — Type
SubspaceParametrization(pixels::PixelParametrization, B)Pixel values restricted to the span of the columns of B (n m × k): pixels = B θ, σ = P_pixels B θ. Bases: dct_basis (Ferrite back end) (smooth, low-dimensional), boundary_band_basis (Ferrite back end) (free pixels along the boundary), or combinations [B₁ B₂].
ModularEIT.ParametrizedObjective — Type
ParametrizedObjective(obj, par)The objective obj as a function of the parameters θ of par (σ = P θ): values, gradients Pᵀ ∇_σ J and, for least-squares objectives, residuals and Jacobians (∂r/∂σ) P, so that all optimizers apply (bounds on pixel parameters bound σ, see PixelParametrization (Ferrite back end)). Regularizers on the parameters act on the pixel discretization, e.g. RegularizedObjective(ParametrizedObjective(data, pp), α => TotalVariationRegularizer(pp.pixel_disc)).
ModularEIT.conductivity — Method
conductivity(par::AbstractParametrization, θ)Conductivity coefficients σ = P θ of the parameters θ.
ModularEIT.parameter_count — Function
parameter_count(par)Number of parameters of a parametrization.
ModularEIT.pixel_image — Function
pixel_image(par, θ)The parameters θ of a pixel-based parametrization as an image (row 1 at the top). Back end contract for pixel parametrizations.
ModularEITFerrite.pixel_parameters — Function
pixel_parameters(pp::PixelParametrization, img)Parameters θ of an n × m image (row 1 at the top); NaN pixels become fill (keyword, default 1).
ModularEITFerrite.dct_basis — Function
dct_basis(pp::PixelParametrization, K)The K × K lowest-frequency orthonormal DCT-II modes of the pixel grid as the columns of an n m × K² matrix (parameter order), sorted by total frequency (the constant mode first). For SubspaceParametrization: smooth, low-dimensional conductivities, e.g. as the first stage of a coarse-to-fine reconstruction.
ModularEITFerrite.boundary_band_basis — Function
boundary_band_basis(pp::PixelParametrization, width)Indicator vectors (sparse columns) of the active pixels whose centre lies within width of the domain boundary: free pixel values along the boundary, where the data determine the conductivity best. Combined with dct_basis ([C Bb]) the interior is smooth and low-dimensional and the boundary band fully resolved.
ModularEIT.InfeasibleConductivityError — Type
InfeasibleConductivityError(msg)Thrown when a conductivity is not admissible for the forward problem (e.g. non-positive values seen by a preconditioner). Optimizers treat it like a failed factorization: the trial point is rejected and the step shortened.
Wiki articles
Theory behind this page in the theory wiki: