#!/usr/bin/env python # coding: utf-8 # # 3D viewing # This notebook will show how to display 3D results with resipy in a notebook. Note that 3D viewing is based on the Python package: *pyvista* that needs to be installed (`pip install pyvista`). # In[1]: import sys sys.path.append('../src') from resipy import Project import pyvista as pv testdir = '../src/examples/' # Create a Survey and Mesh, then display the mesh using a pyvista plotter object (which displays inline with the notebook). # In[2]: k = Project(typ='R3t') k.createSurvey(testdir + 'dc-3d/protocol.dat', ftype='ProtocolDC') k.importElec(testdir + 'dc-3d/elec.csv') k.createMesh() pl = pv.Plotter() # init pyvista plotter object k.showMesh(ax=pl) # Now invert the data # In[3]: k.invert() # ## Options available # - `pvslices`: a tuple of list, each list represent the coordinates of an slice orthogonal to X, Y and Z respectively # - `pvthreshold` : a list of two values representing the minimum and maximum values between which to keep the cells # - `pvcontour` : a list of values at which draw isosurfaces # - `pvgrid`: a bool, if `True`, the grid is plotted # In[4]: pl = pv.Plotter() k.showResults(ax=pl, color_map='jet') # In[5]: pl = pv.Plotter() k.showResults(ax=pl, pvslices=([5,15,25,35,45],[0],[]), pvgrid=True, vmin=1.95, vmax=2.2, color_map='plasma') # In[6]: pl = pv.Plotter() k.showResults(ax=pl, pvthreshold=[2.1, 2.2], pvgrid=True) # In[7]: pl = pv.Plotter() k.showResults(ax=pl, pvcontour=[2, 2.1], pvgrid=True) # In[ ]: