Visualization based on Plotly#

class opstool.vis.OpsVisPlotly(point_size=5, line_width=5, colors_dict=None, theme='plotly', color_map='jet', on_notebook=False, results_dir='opstool_output')[source]#

A class to visualize OpenSeesPy model based on plotly.

Parameters#

point_size: float

The render size of node.

line_width: float

The width of line element;

colors_dict: dict,

The dict for ele color, default color you can see by the class attribute default_colors.

theme: str, default=plotly

Plot theme, optional “plotly”, “plotly_white”, “plotly_dark”, “ggplot2”, “seaborn”, “simple_white”, “none”.

color_map: str, default=”jet”

color map to display the cloud plot. Optional, [‘aggrnyl’, ‘agsunset’, ‘algae’, ‘amp’, ‘armyrose’, ‘balance’, ‘blackbody’, ‘bluered’, ‘blues’, ‘blugrn’, ‘bluyl’, ‘brbg’, ‘brwnyl’, ‘bugn’, ‘bupu’, ‘burg’, ‘burgyl’, ‘cividis’, ‘curl’, ‘darkmint’, ‘deep’, ‘delta’, ‘dense’, ‘earth’, ‘edge’, ‘electric’, ‘emrld’, ‘fall’, ‘geyser’, ‘gnbu’, ‘gray’, ‘greens’, ‘greys’, ‘haline’, ‘hot’, ‘hsv’, ‘ice’, ‘icefire’, ‘inferno’, ‘jet’, ‘magenta’, ‘magma’, ‘matter’, ‘mint’, ‘mrybm’, ‘mygbm’, ‘oranges’, ‘orrd’, ‘oryel’, ‘oxy’, ‘peach’, ‘phase’, ‘picnic’, ‘pinkyl’, ‘piyg’, ‘plasma’, ‘plotly3’, ‘portland’, ‘prgn’, ‘pubu’, ‘pubugn’, ‘puor’, ‘purd’, ‘purp’, ‘purples’, ‘purpor’, ‘rainbow’, ‘rdbu’, ‘rdgy’, ‘rdpu’, ‘rdylbu’, ‘rdylgn’, ‘redor’, ‘reds’, ‘solar’, ‘spectral’, ‘speed’, ‘sunset’, ‘sunsetdark’, ‘teal’, ‘tealgrn’, ‘tealrose’, ‘tempo’, ‘temps’, ‘thermal’, ‘tropic’, ‘turbid’, ‘turbo’, ‘twilight’, ‘viridis’, ‘ylgn’, ‘ylgnbu’, ‘ylorbr’, ‘ylorrd’].

on_notebook: bool, default=False

Whether work in a jupyter notebook.

results_dir: str, default=”opstool_output”

The dir that results saved.

Returns#

None

deform_anim(input_file='NodeRespStepData-1.hdf5', response='disp', alpha=None, show_outline=False, opacity=1, framerate=24, show_face_line=True, save_html='DefoAnimation', model_update=False)[source]#

Deformation animation of the model.

Parameters#

input_file: str, default = “NodeRespStepData-1.hdf5”,

The filename that node responses data saved by opstool.vis.GetFEMdata.get_node_resp_step() or opstool.vis.GetFEMdata.save_resp_all().

Warning

Be careful not to include any path, only filename, the file will be loaded from the directory results_dir.

response: str, default=’disp’

Response type. Optional, “disp”, “vel”, “accel”.

alpha: float, default=None

Scaling factor, the default value is 1/5 of the model boundary according to the maximum deformation.

show_outline: bool, default=False

Whether to display the axes.

show_face_line: bool, default=True

If True, the edges of plate and solid elements will be displayed.

framerate: int, default=24

The number of frames per second.

opacity: float, default=1.0

Plane and solid element transparency.

save_html: str, default=’DefoAnimation.html’

The html file name to output. If False, the html file will not be generated.

model_update: bool, default False

whether to update the model domain data at each analysis step, this will be useful if model data has changed. For example, some elements and nodes were removed. This parameter must same as that in opstool.vis.GetFEMdata.get_node_resp_step().

Returns#

None

deform_vis(input_file='NodeRespStepData-1.hdf5', slider=False, response='disp', alpha=None, show_outline=False, show_origin=False, show_face_line=True, opacity=1, save_html='DefoVis', model_update=False)[source]#

Visualize the deformation of the model at a certain analysis step.

Parameters#

input_file: str, default = “NodeRespStepData-1.hdf5”,

The filename that node responses data saved by opstool.vis.GetFEMdata.get_node_resp_step() or opstool.vis.GetFEMdata.save_resp_all().

Warning

Be careful not to include any path, only filename, the file will be loaded from the directory results_dir.

slider: bool, default=False

If True, responses in all steps will display by slider style. If False, the step that max response will display.

response: str, default=’disp’

Response type. Optional, “disp”, “vel”, “accel”.

alpha: float, default=None

Scaling factor, the default value is 1/5 of the model boundary according to the maximum deformation.

show_outline: bool, default=False

Whether to display the axes.

show_origin: bool, default=False

Whether to show undeformed shape.

show_face_line: bool, default=True

If True, the edges of plate and solid elements will be displayed.

opacity: float, default=1.0

Plane and solid element transparency.

save_html: str, default=’DefoVis.html’

The html file name to output. If False, the html file will not be generated.

model_update: bool, default False

whether to update the model domain data at each analysis step, this will be useful if model data has changed. For example, some elements and nodes were removed. This parameter must same as that in opstool.vis.GetFEMdata.get_node_resp_step().

Returns#

None

eigen_anim(mode_tag=1, input_file='EigenData.hdf5', n_cycle=5, alpha=None, show_outline=False, opacity=1, framerate=3, show_face_line=True, save_html='EigenAnimation')[source]#

Animation of Modal Analysis.

Parameters#

mode_tag: int

The mode tag.

input_file: str, default = ‘EigenData.hdf5’,

The filename that eigen data saved by opstool.vis.GetFEMdata.get_eigen_data().

Warning

Be careful not to include any path, only filename, the file will be loaded from the directory results_dir.

n_cycle: int, default = 5,

The number of cycles in the positive and negative directions of the modal deformation.

alpha: float, default=None

Scaling factor, the default value is 1/5 of the model boundary according to the maximum deformation.

show_outline: bool, default=False

Whether to display the axes.

opacity: float, default=1.0

Plane and solid element transparency.

framerate: int

The number of frames per second.

show_face_line: bool, default=True

If True, the edges of plate and solid elements will be displayed.

save_html: str, default=’EigenAnimation.html’

The html file name to output. If False, the html file will not be generated.

Returns#

None

eigen_vis(mode_tags, input_file='EigenData.hdf5', subplots=False, alpha=None, show_outline=False, show_origin=False, opacity=1.0, show_face_line=True, save_html='EigenVis')[source]#

Eigenvalue Analysis Visualization.

Parameters#

mode_tags: list[int], or tuple[int]

Mode tags to be shown, if list or tuple [mode1, mode2], display the multiple modes from mode1 to mode2.

input_file: str, default = ‘EigenData.hdf5’,

The filename that eigen data saved by opstool.vis.GetFEMdata.get_eigen_data().

Warning

Be careful not to include any path, only filename, the file will be loaded from the directory results_dir.

subplots: bool, default=False

If True, subplots in a figure. If False, plot in a slide style.

alpha: float, default=None

Model scaling factor, the default value is 1/5 of the model boundary according to the maximum deformation.

show_outline: bool, default=True

Whether to display the axes.

show_origin: bool, default=False

Whether to show undeformed shape.

opacity: float, default=1.0

Plane and solid element transparency.

show_face_line: bool, default=True

If True, the edges of plate and solid elements will be displayed.

save_html: str, default=’EigenVis.html’

The html file name to output. If False, the html file will not be generated.

Returns#

None

frame_resp_vis(input_file='BeamRespStepData-1.hdf5', ele_tags=None, slider=False, response='Mz', show_values=True, alpha=None, opacity=1, save_html='FrameRespVis')[source]#

Display the force response of frame elements.

Parameters#

input_file: str, default = “BeamRespStepData-1.hdf5”,

The filename that beam frame elements responses data saved by opstool.vis.GetFEMdata.get_frame_resp_step() or opstool.vis.GetFEMdata.save_resp_all().

Warning

Be careful not to include any path, only filename, the file will be loaded from the directory results_dir.

ele_tags: int or list[int], default=None

Element tags to display, if None, all frame elements will display.

slider: bool, default=False

If True, responses in all steps will display by slider style. If False, the step that max response will display.

response: str, default=’Mz’

Response type. Optional, “Fx”, “Fy”, “Fz”, “My”, “Mz”, “Mx”.

show_values: bool, default=True

If True, will show the response values.

alpha: float, default=None

Scaling factor.

opacity: float, default=1.0

Plane and solid element transparency.

save_html: str, default=’FrameRespVis.html’

The html file name to output. If False, the html file will not be generated.

model_vis(input_file='ModelData.hdf5', show_node_label=False, show_ele_label=False, show_local_crd=False, show_fix_node=True, show_constrain_dof=False, label_size=8, show_outline=True, opacity=1.0, save_html='ModelVis.html')[source]#

Visualize the model in the current domain.

Parameters#

input_file: str, default = “ModelData.hdf5”,

The filename that model data saved by opstool.vis.GetFEMdata.get_model_data().

Warning

Be careful not to include any path, only filename, the file will be loaded from the directory results_dir.

show_node_label: bool, default=False

Whether to display the node label.

show_ele_label: bool, default=False

Whether to display the ele label.

show_local_crd: bool, default=False

Whether to display the local axes of beam and link elements.

show_fix_node: bool, default=True

Whether to display the fix nodes.

show_constrain_dof: bool, default=False

Whether to display labels for constrained degrees of freedom.

label_size: float, default=8

The foontsize of node and ele label.

show_outline: bool, default=True

Whether to show the axis frame.

opacity: float, default=1.0

Plane and solid element transparency.

save_html: str, default=’ModelVis.html’

The html file name to output. If False, the html file will not be generated.

Returns#

None

react_vis(input_file='NodeReactionStepData-1.hdf5', slider=False, direction='Fz', show_values=True, show_outline=False, save_html='ReactionVis')[source]#

Plot the node reactions.

Parameters#

input_filestr, optional, default=”NodeReactionStepData-1.hdf5”

The filename that eigen data saved by opstool.vis.GetFEMdata.get_node_react_step() or opstool.vis.GetFEMdata.save_resp_all().

Warning

Be careful not to include any path, only filename, the file will be loaded from the directory results_dir.

slider: bool, default=False

If True, responses in all steps will display by slider style. If False, the step that max response will display.

directionstr, optional, by default “Fz”

Type of reaction, if 2D, only be one of [‘Fx’, ‘Fy’, ‘Mz’]; if 3D, one of [‘Fx’, ‘Fy’, ‘Fz’, ‘Mx’, ‘My’, ‘Mz’]

show_valuesbool, optional, by default True

If True, will show the reaction values.

show_outline: bool, default=False

Whether to display the axes.

save_html: str, default=’ReactionVis.html’

The html file name to output. If False, the html file will not be generated.