sfepy.postprocess.viewer module¶
-
class
sfepy.postprocess.viewer.
Viewer
(filename, watch=False, ffmpeg_options=None, output_dir='.', offscreen=False)[source]¶ Class to automate visualization of various data using Mayavi.
It can use any format that mlab.pipeline.open() handles, e.g. a VTK format. After opening a data file, all data (point, cell, scalars, vectors, tensors) are plotted in a grid layout.
Parameters:
- watch : bool
- If True, watch the file for changes and update the mayavi pipeline automatically.
- ffmpeg_options : str
- The ffmpeg animation encoding options.
- output_dir : str
- The output directory, where view snapshots will be saved.
Examples:
>>> view = Viewer('file.vtk') >>> view() # view with default parameters >>> view(layout='col') # use column layout
-
build_mlab_pipeline
(file_source=None, is_3d=False, layout='rowcol', scalar_mode='iso_surface', vector_mode='arrows_norm', rel_scaling=None, clamping=False, ranges=None, is_scalar_bar=False, is_wireframe=False, opacity=None, subdomains_args=None, rel_text_width=None, filter_names=None, group_names=None, only_names=None, domain_specific=None, **kwargs)[source]¶ Sets self.source, self.is_3d_data
-
call_mlab
(scene=None, show=True, is_3d=False, view=None, roll=None, parallel_projection=False, fgcolor=(0.0, 0.0, 0.0), bgcolor=(1.0, 1.0, 1.0), colormap='blue-red', layout='rowcol', scalar_mode='iso_surface', vector_mode='arrows_norm', rel_scaling=None, clamping=False, ranges=None, is_scalar_bar=False, is_wireframe=False, opacity=None, subdomains_args=None, rel_text_width=None, fig_filename='view.png', resolution=None, filter_names=None, only_names=None, group_names=None, step=None, time=None, anti_aliasing=None, domain_specific=None)[source]¶ By default, all data (point, cell, scalars, vectors, tensors) are plotted in a grid layout, except data named ‘node_groups’, ‘mat_id’ which are usually not interesting.
Parameters: show : bool
Call mlab.show().
is_3d : bool
If True, use scalar cut planes instead of surface for certain datasets. Also sets 3D view mode.
view : tuple
Azimuth, elevation angles, distance and focal point as in mlab.view().
roll : float
Roll angle tuple as in mlab.roll().
parallel_projection: bool
If True, use parallel projection.
fgcolor : tuple of floats (R, G, B)
The foreground color, that is the color of all text annotation labels (axes, orientation axes, scalar bar labels).
bgcolor : tuple of floats (R, G, B)
The background color.
colormap : str
The colormap name.
layout : str
Grid layout for placing the datasets. Possible values are: ‘row’, ‘col’, ‘rowcol’, ‘colrow’.
scalar_mode : str
Mode for plotting scalars and tensor magnitudes, one of ‘cut_plane’, ‘iso_surface’, ‘both’.
vector_mode : str
Mode for plotting vectors, one of ‘arrows’, ‘norm’, ‘arrows_norm’, ‘warp_norm’.
rel_scaling : float
Relative scaling of glyphs for vector datasets.
clamping : bool
Clamping for vector datasets.
ranges : dict
List of data ranges in the form {name : (min, max), …}.
is_scalar_bar : bool
If True, show a scalar bar for each data.
is_wireframe : bool
If True, show a wireframe of mesh surface bar for each data.
opacity : float
Global surface and wireframe opacity setting in [0.0, 1.0],
subdomains_args : tuple
Tuple of (mat_id_name, threshold_limits, single_color), see
add_subdomains_surface()
, or None.rel_text_width : float
Relative text width.
fig_filename : str
File name for saving the resulting scene figure.
resolution : tuple
Scene and figure resolution. If None, it is set automatically according to the layout.
filter_names : list of strings
Omit the listed datasets. If None, it is initialized to [‘node_groups’, ‘mat_id’]. Pass [] if you need no filtering.
only_names : list of strings
Draw only the listed datasets. If None, it is initialized all names besides those in filter_names.
group_names : list of tuples
List of data names in the form [(name1, …, nameN), (…)]. Plots of data named in each group are superimposed. Repetitions of names are possible.
step : int, optional
If not None, the time step to display. The closest higher step is used if the desired one is not available. Has precedence over time.
time : float, optional
If not None, the time of the time step to display. The closest higher time is used if the desired one is not available.
anti_aliasing : int
Value of anti-aliasing.
domain_specific : dict
Domain-specific drawing functions and configurations.
-
class
sfepy.postprocess.viewer.
ViewerGUI
(fgcolor=(0.0, 0.0, 0.0), bgcolor=(1.0, 1.0, 1.0), **traits)[source]¶
-
sfepy.postprocess.viewer.
add_glyphs
(obj, position, bbox, rel_scaling=None, scale_factor='auto', clamping=False, color=None)[source]¶
-
sfepy.postprocess.viewer.
add_subdomains_surface
(obj, position, mat_id_name='mat_id', threshold_limits=(None, None), **kwargs)[source]¶
-
sfepy.postprocess.viewer.
add_vector_cut_plane
(obj, position, normal, bbox, rel_scaling=None, scale_factor='auto', clamping=False, opacity=1.0)[source]¶
-
sfepy.postprocess.viewer.
get_opacities
(opacity)[source]¶ Provide defaults for all supported opacity settings.