gimli-org / gimli

Geophysical Inversion and Modeling Library :earth_africa:
https://www.pygimli.org
Other
365 stars 133 forks source link

Fixing (constraining) parameter values in inverion of 1D models #383

Closed whitmand closed 1 year ago

whitmand commented 2 years ago

Problem description

I have been modeling and inverting VES data using the procedures in the "VES inversion for a blocky model" tutorial. So far, everything is working great but I cannot figure out how to "fix" some of the parameter values (thickness or resistivity) to the starting model values in the inversion. Is there a method/attribute for f = pg.core.DC1dModelling or inv=pg.core.Inversion where I can fix particular parameters? Or, is it something that I set in the region properties?

Any suggestions?

Your environment

Operating system: Windows Python version: 3.8.13 pyGIMLi version: 1.2.4 Way of installation: e.g. Conda package, Win binary, curl script, manual compilation from source

halbmy commented 2 years ago

The VES inversion example is really outdated and represents a state of pyGIMLi<1.0 using the core functionality which should not be used anymore. We will have to update this and add other examples for controlling regions or parameters.

TheNablaOperator commented 2 years ago

Hello.

The VES inversion example is really outdated and represents a state of pyGIMLi<1.0 using the core functionality which should not be used anymore. We will have to update this and add other examples for controlling regions or parameters.

For Inversion can still the VESManager be used?

from pygimli.physics import VESManager
nlay = 3;
ves = VESManager()
inva = ves.invert(rhoa, 
                  nLayer=nlay, 
                  showProgress=0,
                  verbose=0)
res, thk = inva[nlay-1:nlay*2-1], inv[0:nlay-1]
...

And probably a silly question.... How do I create the RVector on my own? I have VES data (several values in a table), so I thought to type it is faster than converting into UDF...

Thanks!

halbmy commented 2 years ago

Yes you can use the VESManager for inverting your data. And you can just use a (1d) numpy array which is compatible with the RVector. Other ways are:

x = pg.Vector(10, 1.5) # vector of length 10 filled with 1.5
x[2] = 5
y = pg.Vector([1.0, 4, -10]) # converting a list
z = pg.Vector(np.arange(10))
halbmy commented 2 years ago

Coming back to the original question: it is generally possible to fix regions (see e.g. https://github.com/gimli-org/transform2022/blob/main/2_Lake.ipynb) by different ways:

In the future we will support any equations on the model parameters like presented in Wagner et al. (2019). For example to fix an interface depth as sum of thickness values.

Wagner, F.M., Mollaret, C., Günther, T., Kemna, A., Hauck, A. (2019): Quantitative imaging of water, ice, and air in permafrost systems through petrophysical joint inversion of seismic refraction and electrical resistivity data. Geophys. J. Int. 219, 1866-1875. doi:10.1093/gji/ggz402.

halbmy commented 2 years ago

There is a recent inversion framework LSQRInversion (in the dev branch) where you can state additional equations in a Matrix-vector form with an VES example at the end: https://github.com/gimli-org/gimli/blob/dev/pygimli/frameworks/lsqrinversion.py

G = pg.Matrix(rows=1, cols=len(startModel))
for i in range(3):
    G.setVal(0, i, 1)

c = pg.Vector(1, pg.sum(synthk))
inv.setParameterConstraints(G, c, 100)
halbmy commented 1 year ago

I created a notebook for this illustrating the use of additional equations: https://github.com/gimli-org/notebooks/blob/main/inversion/additionalConstraintsVES.ipynb

image

whitmand commented 1 year ago

Thomas, Thanks for sharing.

One thing, I am getting this error message as well:

“pyGIMLi - WARNING - Multiprocess jacobian currently unavailable for win build”

Is this something that I should be worrying about?

Thanks Dean

From: Thomas Günther @.> Sent: Tuesday, December 13, 2022 4:25 PM To: gimli-org/gimli @.> Cc: Dean Whitman @.>; Author @.> Subject: Re: [gimli-org/gimli] Fixing (constraining) parameter values in inverion of 1D models (Issue #383)

Note: This message originated from outside the FIU Faculty/Staff email system.

I created a notebook for this illustrating the use of additional equations: https://github.com/gimli-org/notebooks/blob/main/inversion/additionalConstraintsVES.ipynbhttps://urldefense.com/v3/__https:/github.com/gimli-org/notebooks/blob/main/inversion/additionalConstraintsVES.ipynb__;!!FjuHKAHQs5udqho!NuzVEVlfS84OpXkISHVyTHLQHFZX807qptQimKja9JeI1w8TYWnKDTAzSUg5sPhZbcdobgIIWXXcvqdQpSp9873f$

[image]https://urldefense.com/v3/__https:/user-images.githubusercontent.com/7136401/207446600-0153d60b-62cf-4ff0-abf1-9596a72b4e35.png__;!!FjuHKAHQs5udqho!NuzVEVlfS84OpXkISHVyTHLQHFZX807qptQimKja9JeI1w8TYWnKDTAzSUg5sPhZbcdobgIIWXXcvqdQpf_zDL0Y$

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/gimli-org/gimli/issues/383*issuecomment-1349737154__;Iw!!FjuHKAHQs5udqho!NuzVEVlfS84OpXkISHVyTHLQHFZX807qptQimKja9JeI1w8TYWnKDTAzSUg5sPhZbcdobgIIWXXcvqdQpS7WfTOv$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AYRVOUFWKHMNLFH66SI5TBDWNDSS3ANCNFSM5SP6WT6Q__;!!FjuHKAHQs5udqho!NuzVEVlfS84OpXkISHVyTHLQHFZX807qptQimKja9JeI1w8TYWnKDTAzSUg5sPhZbcdobgIIWXXcvqdQpTW2MqQ6$. You are receiving this because you authored the thread.Message ID: @.**@.>>

halbmy commented 1 year ago

Is this something that I should be worrying about?

No need to worry.