pyOMA.core.PlotMSH.ModeShapePlot#
- class pyOMA.core.PlotMSH.ModeShapePlot(geometry_data, stabil_calc=None, modal_data=None, prep_signals=None, merged_data=None, config=None, **kwargs)[source]#
Bases:
object3-D mode-shape visualisation for pyOMA modal analysis results.
Renders a structural geometry (nodes, beams, parent-child relations) and superimposes animated or static mode-shape deformations. Supports single- setup analyses as well as PoGER and PoSER multi-setup results.
- amplitude#
Scaling factor applied to modal displacement amplitudes when drawing deformed shapes. Increase to make the deformation more visible.
- Type:
float
Notes
The object accepts different combinations of inputs depending on the merging strategy (single-setup, PoGER/PreGER, PoSER):
Variable
single-setup
PoGER/PreGER
PoSER merging
modal_freq./damp.
modal_data
modal_data
merged_data
mode shapes
modal_data
modal_data
merged_data
num_channels
prep_signals
modal_data
merged_data
chan_dofs
prep_signals
modal_data
merged_data
select_modes
stabil_calc
stabil_calc
merged_data
Todo
clean up animation methods
remove “real modeshape” functionality as it might mislead inexperienced users
Fix parent-childs assignment: allow multiple channel averaging into a single child displacement, then transform to polar coordinates
Implement the plotting in pyvista for better 3D graphics
- __init__(geometry_data, stabil_calc=None, modal_data=None, prep_signals=None, merged_data=None, config=None, **kwargs)[source]#
Initializes the class object and automatically checks which of the merging use cases applies.
See class docstring for the merging-routine table.
- Parameters:
geometry_data (PreProcessingTools.GeometryProcessor, required) – Object containing all the necessary geometry information.
stabil_calc (StabilDiagram.StabilCalc, optional) – Object containing the information, which modes were selected from modal_data.
modal_data (ModalBase.ModalBase, optional) – Object of one the classes derived from ModalBase.ModalBase, containing the estimated modal parameters at multiple model orders.
prep_signals (PreProcessingTools.PreProcessSignals, optional) – Object containing the signals data and information about it.
merged_data (PostProcessingTools.MergePoSER, optional) – Object containing the merged data.
config (ModeShapePlotConfig, optional) – Visual-style configuration object. Preferred over passing individual style keyword arguments.
**kwargs – Accepts
selected_mode,fig, and deprecated individual style params (amplitude, real, scale, dpi, nodecolor, nodemarker, nodesize, beamcolor, beamstyle, linewidth, callback_fun, save_ani_path).
Methods
__init__(geometry_data[, stabil_calc, ...])Initializes the class object and automatically checks which of the merging use cases applies.
add_chan_dof(chan, node, az, elev, chan_name, i)Draws an arrow indicating a channel-DOF assignment.
add_cn_line(i)Draws a line between the displaced and the undisplaced node.
add_line(line, i)Add a line by adding the start node and end node to the internal line table and draws that line between the two nodes.
add_nd_line(line, i)Add a non-displaced line, which acts as a mesh-reference for the displaced lines.
add_node(x, y, z, i)Adds a node to the internal node table and initializes zero-value displacements for this node to the internal displacements table.
add_parent_child(*, i, parent, child)Takes parent-child definitions and adds these definitions to the internal parent-child table.
animate()Create necessary objects to animate the currently displayed deformed structure.
change_amplitude([amplitude])Changes the amplitude of the mode shape, and redraws the modeshapes based on this amplitude.
change_mode([frequency, index, mode_index])If the user selects a new mode: plots the mode shape and returns modal values e.g. to a GUI caller.
change_part(b)Change, which part of the complex number modeshapes should be drawn and redraw the modeshapes
change_viewport([viewport])Change the viewport e.g. azimuth and elevation and refresh the canvas.
Draw the axis arrows.
Draw arrows and numbers for all channel-DOF assignments stored in the channel - DOF assignment table of PreProcessingTools.GeometrProcessor
Draws all line from the line list of PreProcessingTools.GeometryProcessor The currently stored displacement values are used for moving the nodes.
draw_msh()Draw mode shapes by assigning displacement values to the nodes based on the channel - DOF assignments and the parent - child definitions.
Draw arrows for all parent-child definitions stored in the internal parent-child definition table.
filter_and_animate_data([callback])Animate the acquired vibration data to check the real vibration displacement of the structure against the identified modes.
refresh_axis([visible])Refresh the axis arrows and make them visible/invisible, e.g. after programmatically changing visibility flags.
refresh_chan_dofs([visible])Refresh the arrows indicating the channel-dof assignments and make them visible/invisible, e.g. after programmatically changing visibility flags.
refresh_cn_lines([visible])Refresh the connecting lines and make them visible/invisible, e.g. after programmatically changing visibility flags.
refresh_lines([visible])Refresh the lines and make them visible/invisible, e.g. after programmatically changing visibility flags.
refresh_nd_lines([visible])Refresh the non-displaced lines and make them visible/invisible, e.g. after programmatically changing visibility flags.
refresh_nodes([visible])Refresh the nodes and make them visible/invisible, e.g. after programmatically changing visibility flags.
refresh_parent_childs([visible])Refresh the parent-child arrows and make them visible/invisible, e.g. after programmatically changing visibility flags.
refresh_traces([visible])Refresh the node-trace ellipses and make them visible/invisible, e.g. after programmatically changing visibility flags.
save_plot([path])Save the curently displayed frame as a graphics file
set_equal_aspect()stop_ani()Convenience method to stop the animation and restore the still plot
take_chan_dof(chan, node, dof)Remove the arrow and text objects associated with the channel - DOF assignment.
take_line(line)Remove a line between to nodes.
take_node(x, y, z, node)Remove a node at given coordinates and all objects connected to this node first (there should not be any).
take_parent_child(*, parent, child)Remove the two arrows associated with the parent-child definition.
- add_chan_dof(chan, node, az, elev, chan_name, i)[source]#
Draws an arrow indicating a channel-DOF assignment. Annotates the arrow with the the channel name. Stores the two plot objects in a table and removes any objects that might be in the table at the desired index i.e. avoid duplicate arrows/texts.
- Parameters:
chan (integer) – Index of the channel.
node (integer) – Index of the node in the internal node table
az (float) – Azimuth and elevation of the DOF assignment
elev (float) – Azimuth and elevation of the DOF assignment
chan_name (str) – Name of the channel to annotate
i (integer) – Table index for the plot objects.
Todo
arrow lengths do not scale with the total dimension of the plot
- add_cn_line(i)[source]#
Draws a line between the displaced and the undisplaced node.
- Parameters:
i (integer) – Index of the node
- add_line(line, i)[source]#
Add a line by adding the start node and end node to the internal line table and draws that line between the two nodes. Stores the line object in a table and removes any objects that might be in the table at the desired place, i.e. avoid duplicate lines
- Parameters:
line (2-tuple of integer) – The indices of the start- and end-node of the line
i (integer) – Index of the line, must be previously determined
- add_nd_line(line, i)[source]#
Add a non-displaced line, which acts as a mesh-reference for the displaced lines. Works analogously to self.add_line
- Parameters:
line (2-tuple of integer) – The indices of the start- and end-node of the line
i (integer) – Index of the line, must be previously determined
- add_node(x, y, z, i)[source]#
Adds a node to the internal node table and initializes zero-value displacements for this node to the internal displacements table. Draws a single point at the coordinates and annotates it with its number. Stores the two plot objects in a table and removes any objects that might be in the table at the desired place to avoid duplicate nodes.
- Parameters:
x (float) – 3D-coordinates of the node
y (float) – 3D-coordinates of the node
z (float) – 3D-coordinates of the node
i (integer) – Index of the node, must be previously determined
- add_parent_child(*, i, parent, child)[source]#
Takes parent-child definitions and adds these definitions to the internal parent-child table. Draws an arrow indicating the DOF at each node of parent and child. Arrows at equal positions and direction will be offset to avoid overlapping. Stores the two arrow objects in a table and removes any objects that might be in the table at the desired index i.e. avoid duplicate arrows.
- Parameters:
i (int) – Table index for the plot objects.
parent (NodeCoords) – Parent node coordinates (node_index, x, y, z).
child (NodeCoords) – Child node coordinates (node_index, x, y, z).
- animate()[source]#
Create necessary objects to animate the currently displayed deformed structure.
If self.save_ani_path is given, the animation will be saved to that folder. The numbering of the files follows the order in which the modes were selected in the stabilization diagram.
- change_amplitude(amplitude=None)[source]#
Changes the amplitude of the mode shape, and redraws the modeshapes based on this amplitude.
- Parameters:
amplitude (float, optional)
- change_mode(frequency=None, index=None, mode_index=None)[source]#
If the user selects a new mode: plots the mode shape and returns modal values e.g. to a GUI caller.
- Parameters:
frequency (float,optional) – A search for the closest frequency in the list of already selected indices (self.selected_indices) is performed
index (integer, optional) – Alternatively, the index of the wanted mode can be directly given
mode_index (integer, optional) – The number of the mode in the list of currently selected modes
- Returns:
order_index (integer) – Model order of the selected mode
mode_index (integer) – Index of the selected mode at model order
frequency (float) – natural frequency of the selected mode
damping (float) – damping ratio of the selected mode
MPC (float, optional) – Modal phase colinearity of the selected mode, if available from an instance of StabilDiagram.StabilCalc1
MP (float, optional) – Mean phase of the selected mode, if available from an instance of StabilDiagram.StabilCalc1
MPD (float, optional) – Mean phase deviation of the selected mode, if available from an instance of StabilDiagram.StabilCalc1
- change_part(b)[source]#
Change, which part of the complex number modeshapes should be drawn and redraw the modeshapes
- Parameters:
b (bool) – If b, draws the magnitude of the modal coordinated, else phase information is considered. Default: b = False
- change_viewport(viewport=None)[source]#
Change the viewport e.g. azimuth and elevation and refresh the canvas
- Parameters:
viewport ({'X', 'Y', 'Z', 'ISO', optional) – The viewport to set.
- draw_axis()[source]#
Draw the axis arrows. Length is based on the current data limits. Removes the current arrows if the exist.
- draw_chan_dofs()[source]#
Draw arrows and numbers for all channel-DOF assignments stored in the channel - DOF assignment table of PreProcessingTools.GeometrProcessor
- draw_lines()[source]#
Draws all line from the line list of PreProcessingTools.GeometryProcessor The currently stored displacement values are used for moving the nodes.
- draw_msh()[source]#
Draw mode shapes by assigning displacement values to the nodes based on the channel - DOF assignments and the parent - child definitions. Draws the displaced nodes and beams.
Todo
The computation of resulting magnitude and phase angles for displacements based on parent-child definitions is currently more or less broken. It should be possible, even in 3D to compute exact solutions.
- draw_nodes()[source]#
‘ Draws nodes from the node list of PreProcessingTools.GeometryData The currently stored displacement values are used for moving the nodes.
- draw_parent_childs()[source]#
Draw arrows for all parent-child definitions stored in the internal parent-child definition table.
- filter_and_animate_data(callback=None)[source]#
Animate the acquired vibration data to check the real vibration displacement of the structure against the identified modes.
- get_frequencies()[source]#
- Returns:
frequencies – Identified frequencies of all currently selected modes.
- Return type:
list
- refresh_axis(visible=None)[source]#
Refresh the axis arrows and make them visible/invisible, e.g. after programmatically changing visibility flags.
- Parameters:
visible (bool, ooptional) – Visibility flag for the axis arrows
- refresh_chan_dofs(visible=None)[source]#
Refresh the arrows indicating the channel-dof assignments and make them visible/invisible, e.g. after programmatically changing visibility flags.
Will not be shown in displaced mode (modeshape)
- Parameters:
visible (bool, ooptional) – Visibility flag for the channel-dof assignment arrows
- refresh_cn_lines(visible=None)[source]#
Refresh the connecting lines and make them visible/invisible, e.g. after programmatically changing visibility flags.
- Parameters:
visible (bool, ooptional) – Visibility flag for the non-displaced lines
- refresh_lines(visible=None)[source]#
Refresh the lines and make them visible/invisible, e.g. after programmatically changing visibility flags.
- Parameters:
visible (bool, ooptional) – Visibility flag for the lines
- refresh_nd_lines(visible=None)[source]#
Refresh the non-displaced lines and make them visible/invisible, e.g. after programmatically changing visibility flags.
- Parameters:
visible (bool, ooptional) – Visibility flag for the non-displaced lines
- refresh_nodes(visible=None)[source]#
Refresh the nodes and make them visible/invisible, e.g. after programmatically changing visibility flags.
- Parameters:
visible (bool, ooptional) – Visibility flag for the nodes
- refresh_parent_childs(visible=None)[source]#
Refresh the parent-child arrows and make them visible/invisible, e.g. after programmatically changing visibility flags.
Will not be shown in displaced mode (modeshape)
- Parameters:
visible (bool, ooptional) – Visibility flag for the parent-child arrows
- refresh_traces(visible=None)[source]#
Refresh the node-trace ellipses and make them visible/invisible, e.g. after programmatically changing visibility flags.
- Parameters:
visible (bool, optional) – Visibility flag for the traces
- reset_view()[source]#
restore viewport
restore axis’ limits
reset displacements values for all nodes
- save_plot(path=None)[source]#
Save the curently displayed frame as a graphics file
- Parameters:
path (str (valid filepath), optional) – The full path, including the extension, where to save the graphic.
- take_chan_dof(chan, node, dof)[source]#
Remove the arrow and text objects associated with the channel - DOF assignment.
- Parameters:
chan (integer) – Index of the channel.
node (integer) – Index of the node in the internal node table
dof (3-tuple {az,elev,chan_name}) –
- az, elev: float
Azimuth and elevation of the DOF assignment
- chan_name: str
Name of the channel to annotate
- take_line(line)[source]#
Remove a line between to nodes. If the plot objects are already in their displaced state, the comparison between the actual coordinates and these objects have to account for displacement by comparing to an interval of coordinates. Remove the non-displaced lines, too.
- Parameters:
line (2-tuple of integers) – Tuple containg the indices of the start- and end-nodes
- take_node(x, y, z, node)[source]#
Remove a node at given coordinates and all objects connected to this node first (there should not be any). Remove the patch objects from the plot and remove the coordinates from the node and displacement tables.
- Parameters:
x (float) – Coordinates of the node
y (float) – Coordinates of the node
z (float) – Coordinates of the node
node (integer) – Index of the node
Todo
Function presumably breaks in the second for loop, because geometry_data and the internal tables become out of sync.
- take_parent_child(*, parent, child)[source]#
Remove the two arrows associated with the parent-child definition.
- Parameters:
parent (NodeCoords) – Parent node coordinates (node_index, x, y, z).
child (NodeCoords) – Child node coordinates (node_index, x, y, z).