.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/3Dvispy/02-overlay_fault.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_3Dvispy_02-overlay_fault.py: Overlaying fault displays on slices of 3D seismic data bodies =================================================================== ``create_overlay``: the first parameters is (background), and the second parameters is (foreground) .. Note:: foreground 需要合理设置透明度和mask .. image:: ../../_static/cigvis/3Dvispy/02.png :alt: image :align: center .. GENERATED FROM PYTHON SOURCE LINES 20-45 .. code-block:: default # sphinx_gallery_thumbnail_path = '_static/cigvis/3Dvispy/02.png' import numpy as np import cigvis from cigvis import colormap from pathlib import Path root = Path(__file__).resolve().parent.parent.parent sxp = root / 'data/rgt/sx.dat' fxp = root / 'data/rgt/fx.dat' ni, nx, nt = 128, 128, 128 sx = np.fromfile(sxp, np.float32).reshape(ni, nx, nt) fx = np.fromfile(fxp, np.float32).reshape(ni, nx, nt) # mask min value (0), 0 means no fault fg_cmap = colormap.set_alpha_except_min('jet', alpha=1) # fx is discrete data, set interpolation as 'nearest' nodes = cigvis.create_slices(sx, pos=[[36], [28], [84]], cmap='gray') nodes = cigvis.add_mask(nodes, fx, cmaps=fg_cmap, interpolation='nearest') nodes += cigvis.create_colorbar_from_nodes(nodes, 'Amplitude', select='slices') cigvis.plot3D(nodes, size=(700, 600), savename='example.png') .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.000 seconds) .. _sphx_glr_download_gallery_3Dvispy_02-overlay_fault.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 02-overlay_fault.py <02-overlay_fault.py>` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 02-overlay_fault.ipynb <02-overlay_fault.ipynb>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_