gimli-org / gimli

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

Calculated Apparent Resistivity #660

Closed tonapawilliam closed 2 months ago

tonapawilliam commented 2 months ago

Excuse Me Sir,

is there any command or function which can export the calculated apparent resistivity in pygimli? I want to make a statistical comparison about Observed Apparent Resistivity and Calculated Apparent resistivity? Thank You

halbmy commented 2 months ago

Please have a look at https://www.pygimli.org/_tutorials_auto/3_inversion/plot_1-polyfit.html where several measures are computed by using inv.response. If you use the ERT manager, inv=mgr.inv, and the data vector is data['rhoa'].

tonapawilliam commented 2 months ago

I had try but there is something error. Is it my script wrong?

import numpy as np
import pygimli as pg
from pygimli.physics import ert
from pygimli.physics.ert.importData import importRes2dInv

data  = importRes2dInv("2Block_Res2DInv.dat")
dt =open("2Block_Res2DInv.dat", "r")
print(dt.read())
print(data)
ert.show(data)
data["k"] = ert.geometricFactors(data) 
data['err'] = ert.estimateError(data) 
ert.show(data, data['err']) 
print(data)

mgr = ert.ERTManager(data, verbose = True)
inv = mgr.invert(lam =  10, paraDepth =57 , quality = 33.6)
#%%
print (inv.response(data['rhoa']))
mgr.showResultAndFit()
mgr.showResult()
mgr.saveResult("2Block")

np.savetxt("out.txt", np.column_stack([pg.x(mgr.paraDomain), pg.y(mgr.paraDomain), mgr.paraModel]))  # add fmt, delimiter or header keywords

Output AttributeError: 'RVector' object has no attribute 'response' I want the output of Calculated Apparent Resistivity just like XYZ format. There are position of dataum (x,y) and resistivity just like output this line:

np.savetxt("out.txt", np.column_stack([pg.x(mgr.paraDomain), pg.y(mgr.paraDomain), mgr.paraModel])) # add fmt, delimiter or header keywords

Thank You 2Block2_Res2DInv.txt

halbmy commented 2 months ago

The result of mgr.invert() is the model vector. As written above, you should use mgr.inv to retrieve the inversion class instance and then you can get the model response:

model = mgr.invert(...)
misfit = data['rhoa'] - mgr.inv.response
tonapawilliam commented 2 months ago

Thank You Sir