Batch inversion
Batch inversion is the fact to allow to invert multiple surveys in once. Here we reuse a lot of stuff from the time-lapse implementation.
import warnings
warnings.filterwarnings('ignore')
import os
import sys
import matplotlib.pyplot as plt
sys.path.append((os.path.relpath('../src/'))) # add here the relative path of the API folder
testdir = '../src/examples/dc-2d-timelapse/'
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"
k = Project(typ='R2')
k.createBatchSurvey(testdir + 'data/')
Working directory is: /builds/hkex/resipy/src/resipy
clearing dirname
3/3 imported
fig, ax = plt.subplots()
k.fitErrorPwl(ax=ax)
Error model is R_err = 0.004 R_avg^1.235 (R^2 = 0.990)
Error model is R_err = 0.005 R_avg^1.122 (R^2 = 0.992)
Error model is R_err = 0.006 R_avg^0.954 (R^2 = 0.980)

And inversion as usual.
k.invert(parallel=True) # as for time-lapse, we can run the inversion in parallel
# (this will makes the live outputs a bit funny but should be faster overall.)
Creating triangular mesh...done (1928 elements)
Writing .in file and protocol.dat... done
--------------------- MAIN INVERSION ------------------
0/3 inversions completed
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: 190 Measurements rejected: 0
Geometric mean of apparent resistivities: 0.70466E+02
>> Total Memory required is: 0.020 Gb
Iteration 1
Initial RMS Misfit: 17.83 Number of data ignored: 0
Alpha: 417.957 RMS Misfit: 4.63 Roughness: 7.199
Alpha: 193.998 RMS Misfit: 4.15 Roughness: 11.284
Alpha: 90.046 RMS Misfit: 3.87 Roughness: 16.618
Alpha: 41.796 RMS Misfit: 3.76 Roughness: 22.907
Alpha: 19.400 RMS Misfit: 3.73 Roughness: 29.660
Alpha: 9.005 RMS Misfit: 3.77 Roughness: 37.124
Step length set to 1.00000
Final RMS Misfit: 3.73
Updated data weights
Iteration 2
Initial RMS Misfit: 2.56 Number of data ignored: 0
Alpha: 11.531 RMS Misfit: 1.13 Roughness: 31.792
Alpha: 5.352 RMS Misfit: 0.84 Roughness: 40.521
Step length set to 1.00000
Final RMS Misfit: 0.84
Final RMS Misfit: 1.01
Solution converged - Outputing results to file
Calculating sensitivity map
Processing dataset 2
End of data: Terminating
1/3 inversions completed
All ok
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: 190 Measurements rejected: 0
Geometric mean of apparent resistivities: 0.52987E+02
>> Total Memory required is: 0.020 Gb
Iteration 1
Initial RMS Misfit: 28.72 Number of data ignored: 0
Alpha: 408.075 RMS Misfit: 1.94 Roughness: 1.992
Alpha: 189.412 RMS Misfit: 1.52 Roughness: 2.951
Alpha: 87.917 RMS Misfit: 1.20 Roughness: 4.150
Alpha: 40.807 RMS Misfit: 0.99 Roughness: 5.615
Step length set to 1.00000
Final RMS Misfit: 0.99
Cannot fit quadratic through step lengths
Final RMS Misfit: 0.99
Solution converged - Outputing results to file
Calculating sensitivity map
Processing dataset 2
End of data: Terminating
2/3 inversions completed
All ok
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: 190 Measurements rejected: 0
Geometric mean of apparent resistivities: 0.51162E+02
>> Total Memory required is: 0.020 Gb
Iteration 1
Initial RMS Misfit: 30.42 Number of data ignored: 0
Alpha: 406.879 RMS Misfit: 1.61 Roughness: 1.760
Alpha: 188.857 RMS Misfit: 1.23 Roughness: 2.443
Alpha: 87.660 RMS Misfit: 0.97 Roughness: 3.210
Step length set to 1.00000
Final RMS Misfit: 0.97
Cannot fit quadratic through step lengths
Final RMS Misfit: 0.97
Solution converged - Outputing results to file
Calculating sensitivity map
Processing dataset 2
End of data: Terminating
3/3 inversions completed
----------- END OF INVERSION IN // ----------
3/3 results parsed (3 ok; 0 failed)
All ok
And each inverted section can be shown using the same function
R2.showResults()
.
k.showResults(index=0, vmin=1.5, vmax=2)
k.showResults(index=1, vmin=1.5, vmax=2)
k.showResults(index=2, vmin=1.5, vmax=2)



Download python script: nb_04batch-inversion.py
Download Jupyter notebook: nb_04batch-inversion.ipynb
View the notebook in the Jupyter nbviewer