ertkit.ves.invert_few_layer#
- ertkit.ves.invert_few_layer(data, n_layers, *, start=None, n_starts=10, static_shift=False, rng=None)#
Fit a layered model with a few layers to a sounding.
- Parameters:
- dataSounding
The data and their error model.
- n_layersint
Number of layers \(N\), including the bottom half-space.
- startLayeredModel, optional
Starting model. If given, only this start is used; otherwise
n_startsrandom starting models are tried and the fit with the smallest misfit is kept.- n_startsint, optional
Number of random starting models. Default 10.
- static_shiftbool, optional
Also estimate a multiplicative static-shift factor for every MN segment after the first. Readings with the same MN/2 form a segment. Default False.
- rngint, numpy.random.Generator or None, optional
Seed or generator for the starting models.
- Returns:
- LayerFit
- Raises:
- TypeError
If
datais not aSounding.- ValueError
If
n_layersorn_startsis less than 1, if there are not more data than parameters, ifstarthas the wrong number of layers, or ifstatic_shiftis set and an MN segment has a single reading.
- Warns:
- ConvergenceWarning
If the best fit did not meet the convergence criterion.
- DataWarning
If the fit is poor (goodness-of-fit p-value below 0.01: the errors may be underestimated, or the model needs more layers or static shifts), if it is closer than the errors imply (p-value above 0.99: the errors may be overestimated), if parameters end at their search bounds (listed in
LayerFit.at_bound), or if other parameters are poorly determined (uncertainty factor above 10).
Notes
The parameters are searched within bounds beyond which the data cannot resolve them: resistivities within a factor of 1000 of the observed apparent resistivities, thicknesses between 1/1000 of the smallest and 10 times the largest AB/2, and static shifts within a factor of 2. Each starting model runs for 30 function evaluations per parameter; the best are then continued, for up to 200 evaluations per parameter each, until one converges at the smallest misfit.
The linearized covariance of the log parameters is \((J^T W^2 J)^{-1}\) with \(W = \mathrm{diag}(1/s_i)\), computed from the singular values of \(WJ\). It describes the uncertainty well when the parameters are well resolved. Equivalent layers show up as large uncertainty factors, but a linearized uncertainty can still understate the range of acceptable models; the equivalence analysis planned for release 0.2 samples that range directly.
Examples
>>> import numpy as np >>> from ertkit.ves import LayeredModel, Sounding, Survey, invert_few_layer >>> truth = LayeredModel(resistivity=[150.0, 30.0, 800.0], thickness=[2.0, 15.0]) >>> survey = Survey.schlumberger(ab2=np.geomspace(2.5, 200.0, 22), mn2=0.5) >>> data = Sounding.synthetic(truth, survey, rng=5) >>> fit = invert_few_layer(data, n_layers=3, rng=0) >>> fit.parameter_names ('rho_1', 'rho_2', 'rho_3', 'h_1', 'h_2')