import sys
from resipy import R2
import pyvista as pv # needed for 3D plotting
k = R2(typ='R3t')
k.createSurvey(r'C:\ResIPy\Notebook examples\3D inversion\protocol.dat', ftype='ProtocolDC')
k.importElec(r'C:\ResIPy\Notebook examples\3D inversion\electrodes.csv')
k.fitErrorPwl() # fit a power law to the error
k.createMesh()
k.err = True # setting this flag is necessary for adopting the fitted error model, otherwise a default error is set
k.invert()
pl = pv.Plotter()
k.showResults(ax=pl, color_map='jet', contour=True, pvgrid=True, vmin=1.6, vmax=2.2)
pl = pv.Plotter()
k.showResults(ax=pl, color_map='jet', pvslices=([0.5,1.5,2.5],[],[-2]), contour=True, pvgrid=True, vmin=1.6, vmax=2.2)
k.meshResults[0].df.columns # find out attributes available
pl = pv.Plotter()
k.showResults(ax=pl, attr='Sensitivity_map(log10)', color_map='jet', contour=True) # plot sensitivity map