cigvis.plotlyplot module#

Functions for drawing 3D seismic figure using plotly#

TODO: The code for the plotly part is not yet fully developed, and there are only some basic implementations. We will continue to improve it in the future.

Note#

Only run in jupyter environment (not include Ipython)

In plotly, for a seismic volume, - x means inline order - y means crossline order - z means time order

  • ni means the dimension size of inline / x

  • nx means the dimension size of crossline / y

  • nt means the dimension size of time / depth / z

Examples#

>>> volume.shape = (192, 200, 240) # (ni, nx, nt)

# only slices >>> nodes = create_slices(volume, pos=[0, 0, 239], cmap=’Petrel’, show_cbar=True) >>> plot3D(nodes)

# add mask >>> nodes = create_slices(volume, pos=[0, 0, 239], cmap=’gray’) >>> nodes = add_mask(nodes, mask, cmap=’jet’) >>> plot3D(nodes)

# add surface

# surfs = [surf1, surf2, …], each shape is (ni, nx) >>> sf_nodes = create_surfaces(surfs, value_type=’depth’)

# or use amplitude as color >>> sf_nodes = create_surfaces(surfs, volume, value_type=’amp’) >>> plot3D(nodes + sf_nodes)

For more and detail examples, please refer our documents

class cigvis.plotlyplot.PlotlyBodySpec(volume: numpy.ndarray, level: float, margin: float = None, color: Any = 'yellow')#

Bases: PlotlySpec

color: Any = 'yellow'#
level: float#
margin: float = None#
to_traces() List#
volume: ndarray#
class cigvis.plotlyplot.PlotlyLineLogSpec(log: numpy.ndarray, cmap: Any = 'jet', line_width: float = 8)#

Bases: PlotlySpec

cmap: Any = 'jet'#
line_width: float = 8#
log: ndarray#
to_traces() List#
class cigvis.plotlyplot.PlotlyOverlaySpec(volume: numpy.ndarray, cmap: Any, clim: Tuple[float, float], interpolation: str = 'linear', preproc_func: Callable = None, provider: Any = None, show_cbar: bool = False, cbar_params: Dict = None, nancolor: Any = None)#

Bases: PlotlySpec

cbar_params: Dict = None#
clim: Tuple[float, float]#
cmap: Any#
interpolation: str = 'linear'#
nancolor: Any = None#
preproc_func: Callable = None#
provider: Any = None#
show_cbar: bool = False#
to_traces() List#
volume: ndarray#
class cigvis.plotlyplot.PlotlyPointsSpec(points: numpy.ndarray, color: Any = 'red', size: float = 3, sym: str = 'square')#

Bases: PlotlySpec

color: Any = 'red'#
points: ndarray#
size: float = 3#
sym: str = 'square'#
to_traces() List#
class cigvis.plotlyplot.PlotlySliceSpec(volume: numpy.ndarray, axis: str, pos: int, cmap: Any = 'Petrel', clim: Tuple[float, float]=None, scale: float = 1, interpolation: str = 'cubic', display_range: Dict = None, provider: Any = None, overlays: List[cigvis.plotlyplot.PlotlyOverlaySpec] = <factory>, show_cbar: bool = False, cbar_params: Dict = None, nancolor: Any = None, name: str = None, kwargs: Dict = <factory>)#

Bases: PlotlySpec

axis: str#
cbar_params: Dict = None#
clim: Tuple[float, float] = None#
cmap: Any = 'Petrel'#
display_range: Dict = None#
interpolation: str = 'cubic'#
kwargs: Dict#
name: str = None#
nancolor: Any = None#
overlays: List[PlotlyOverlaySpec]#
pos: int#
provider: Any = None#
scale: float = 1#
show_cbar: bool = False#
to_traces() List#
volume: ndarray#
class cigvis.plotlyplot.PlotlySpec#

Bases: object

Lightweight Plotly backend object compiled by plot3D.

to_traces() List#
class cigvis.plotlyplot.PlotlySurfacesSpec(surfs: List[numpy.ndarray], volume: numpy.ndarray = None, value_type: str = 'depth', clim: Tuple[float, float] = None, cmap: Any = 'jet', show_cbar: bool = False, kwargs: Dict = <factory>)#

Bases: PlotlySpec

clim: Tuple[float, float] = None#
cmap: Any = 'jet'#
kwargs: Dict#
show_cbar: bool = False#
surfs: List[ndarray]#
to_traces() List#
value_type: str = 'depth'#
volume: ndarray = None#
cigvis.plotlyplot.add_mask(nodes: List, volume: List | ndarray, clim: List | Tuple = None, cmap: str | Dict = None, interpolation: str = 'linear', alpha=None, excpt=None, method: str = 'auto', texture_format: str = 'auto', preproc_func: Callable = None, *, clims: List | Tuple = None, cmaps: str | Dict = None, preproc_funcs: Callable = None, show_cbar: bool = False, cbar_params: Dict = None, nancolor=None, **kwargs) List#

Add a mask/overlay volume to Plotly slice specs.

Parameters#

nodes: List[PlotlySliceSpec]

A List that contains specs created by create_slices.

volumearray-like or dict

3D foreground volume/mask, or an axis source dict such as {'x': iline_source, 'y': xline_source, 'z': time_source}. Each source value may also be a spec such as {'data': time_source, 'axes': ('z', 'y', 'x')}. Add multiple masks by calling add_mask repeatedly.

climList

[vmin, vmax] for foreground slices plotting

cmapstr, Dict, or Colormap

colormap for foreground slices. A dict such as {'x': 'Reds', 'z': 'Blues'} applies the mask only to those axes.

interpolationstr

interpolation method. If the values of the slices is discrete, we recommend set as ‘nearest’

alphafloat or List[float]

if alpha is not None, using colormap.fast_set_cmap to set cmap

excptNone or str

it could be one of [None, ‘min’, ‘max’, ‘ramp’]

Returns#

slices_nodesList

list of slice specs

cigvis.plotlyplot.compile_traces(nodes) List#

Compile Plotly specs and raw Plotly traces into a flat trace list.

cigvis.plotlyplot.create_bodies(volume, level, margin: float = None, color='yellow')#
cigvis.plotlyplot.create_fault_skin(*args, **kwargs)#
cigvis.plotlyplot.create_line_logs(logs, cmap='jet', line_width=8)#

logs can be a np.ndarray (one log), or List of np.ndarray (muti-logs). each element’s shape is (N, 3) or (N, 4). each row is (x, y, z) or (x, y, z, value)

cigvis.plotlyplot.create_overlay(bg_volume: ndarray, fg_volume: ndarray, pos: List | Dict = None, bg_clim: List = None, fg_clim: List = None, bg_cmap: str = 'Petrel', fg_cmap: str = None, show_cbar: bool = False, cbar_type: str = 'fg', bg_interpolation: str = 'cubic', fg_interpolation: str = 'linear', **kwargs)#

Deprecated-style overlay helper.

New code should prefer create_slices(bg_volume) followed by add_mask(...). This helper now builds the same Plotly specs.

cigvis.plotlyplot.create_points(points, color='red', size=3, sym='square')#
cigvis.plotlyplot.create_slices(volume: ndarray, pos: List | Dict = None, clim: List = None, cmap: str = 'Petrel', scale: float = 1, show_cbar: bool = False, cbar_params: Dict = None, interpolation: str = 'cubic', texture_format=None, display_range: Dict = None, nancolor=None, **kwargs)#

Create slice specs. Specs are materialized into Plotly traces by plot3D.

Parameters#

volumearray-like or dict

3D array, or an axis source dict such as {'x': iline_source, 'y': xline_source, 'z': time_source}. Each source value may also be a spec such as {'data': time_source, 'axes': ('z', 'y', 'x')}.

posList or Dict

init position of the slices, can be a List or Dict, such as: ` pos = [0, 0, 200] # x: 0, y: 0, z: 200 pos = [[0, 200], [9], []] # x: 0 and 200, y: 9, z: None pos = {'x': [0, 200], 'y': [1], z: []} `

climList

[vmin, vmax] for plotting

cmapstr or Colormap

colormap, it can be str or matplotlib’s Colormap or vispy’s Colormap

show_cbarbool

show colorbar

cbar_paramsDict

parameters pass to colorbar

Returns#

specsList

List of PlotlySliceSpec

cigvis.plotlyplot.create_surfaces(surfs, volume=None, value_type='depth', clim=None, cmap='jet', show_cbar=False, **kwargs)#
cigvis.plotlyplot.create_well_logs(*args, **kwargs)#

use Mesh3D to create tube logs

cigvis.plotlyplot.plot3D(nodes, **kwargs)#