Cross-Borehole example

In this example we are going to invert one of the example given in the R2 manual. The aim is to detect a hidden block in the bottom left of the picture as shown below: and this pictures:

Xhb.png

Fig. 18 Xhb.png

    import warnings
warnings.filterwarnings('ignore')
import os
import sys
import numpy as np # just for parsing the electrode position file
sys.path.append((os.path.relpath('../src'))) # add here the relative path of the API folder
testdir = '../src/examples/dc-2d-borehole/'
from resipy import Project
API path =  /builds/hkex/resipy/src/resipy
ResIPy version =  3.4.1
cR2.exe found and up to date.
R3t.exe found and up to date.
cR3t.exe found and up to date.
it looks like wine32 is missing, you should install it.
multiarch needs to be enabled first.  as root, please
execute "dpkg --add-architecture i386 && apt-get update &&
apt-get install wine32"

Then we will import the protocol.dat file that was outputed by the forward model with this geometry and invert it. Note what we also need to import the electrodes position from a .csv file with 3 columns:x, y, buried. The buried column contains 1 if the electrode is buried and 0 if not.

k = Project(typ='R2')
k.createSurvey(testdir + 'protocol.dat', ftype='ProtocolDC')
k.importElec(testdir + 'elec.csv')
k.createMesh('trian', cl=0.5, cl_factor=20, fmd=20)
# cl is characteristic length, it defines the resolution of the mesh around the electrodes, the smaller, the finer
# cl_factor is how the mesh will grow away from the electrode
# NOTE that a too fine mesh (very small cl) will takes a lot of RAM
# but a too coarse mesh won't be able to resolve the target
k.zlim = [-20, 0]
k.showMesh()
k.invert()
k.showResults(sens=False, contour=True)
Working directory is: /builds/hkex/resipy/src/resipy
clearing dirname
0/407 reciprocal measurements found.
Creating triangular mesh...done (2954 elements)
Writing .in file and protocol.dat... done

--------------------- MAIN INVERSION ------------------
it looks like wine32 is missing, you should install it.
multiarch needs to be enabled first.  as root, please
execute "dpkg --add-architecture i386 && apt-get update &&
apt-get install wine32"
 >> R  2    R e s i s t i v i t y   I n v e r s i o n   v4.02 <<

 >> D a t e : 25 - 10 - 2022
 >> My beautiful survey
 >> I n v e r s e   S o l u t i o n   S e l e c t e d <<
 >> Determining storage needed for finite element conductance matrix
 >> Generating index array for finite element conductance matrix
 >> Reading start resistivity from res0.dat
 >> R e g u l a r i s e d   T y p e <<
 >>   L i n e a r    F i l t e r    <<
 >> L o g - D a t a   I n v e r s i o n <<
 >> N o r m a l   R e g u l a r i s a t i o n <<
 >> D a t a   w e i g h t s   w i l l   b e  m o d i f i e d <<


 Processing dataset   1


 Measurements read:   407     Measurements rejected:     0
   Geometric mean of apparent resistivities:  0.92723E+02

 >> Total Memory required is:          0.049 Gb

   Iteration   1
     Initial RMS Misfit:         5.88       Number of data ignored:     1
     Alpha:        1256.314   RMS Misfit:        2.13  Roughness:        0.626
     Alpha:         583.129   RMS Misfit:        1.83  Roughness:        1.162
     Alpha:         270.665   RMS Misfit:        1.54  Roughness:        2.061
     Alpha:         125.631   RMS Misfit:        1.32  Roughness:        3.282
     Alpha:          58.313   RMS Misfit:        1.16  Roughness:        4.774
     Alpha:          27.066   RMS Misfit:        1.05  Roughness:        6.648
     Alpha:          12.563   RMS Misfit:        1.00  Roughness:        9.231
     Step length set to   1.00000
     Final RMS Misfit:        1.00

 Cannot fit quadratic through step lengths
     Final RMS Misfit:        1.00

 Solution converged - Outputing results to file

 Calculating sensitivity map


 Processing dataset   2


 End of data:  Terminating
1/1 results parsed (1 ok; 0 failed)
All ok
../_images/nb_05cross-borehole_0.png ../_images/nb_05cross-borehole_1.png

Download python script: nb_05cross-borehole.py

Download Jupyter notebook: nb_05cross-borehole.ipynb

View the notebook in the Jupyter nbviewer

Run this example interactively: binder