The sel_from_plot module
This module provides interactive plotting functionalities for selecting the mode to extract. It is designed to work with Frequency Domain Decomposition (FDD) and Stochastic Subspace Identification (SSI) algorithms, enabling users to visually inspect and interact with stabilization charts and plots of the singular value of the PSD matrix. The module integrates matplotlib plots into a Tkinter GUI, allowing for intuitive interaction such as pole selection through mouse clicks and keyboard shortcuts.
- Classes:
SelFromPlot: A class for creating interactive plots where users can select ordeselect poles for further analysis in OMA. It supports various types of plots (FDD, SSI, pLSCF) and provides utilities for saving figures, toggling legends, and handling user inputs through a graphical interface.
- Key Features:
Interactive selection of poles directly from stabilization charts and PSD plots.
Compatibility with FDD, SSI, and pLSCF algorithm outputs.
Integration of matplotlib plots within a Tkinter window for enhanced user interaction.
Support for exporting plots and managing display settings like legends and pole visibility.
- References:
This module is inspired by and expands upon functionalities found in the pyEMA package [ZBGS20], offering specialized features tailored for the pyOMA2 package’s requirements.
Note
To select a peack/pole from a plot hold the SHIFT button and left click with the mouse. To remove from selection the last peack/pole added hold the SHIFT button and right click with the mouse. To remove from selection the closest peack/pole hold the SHIFT button and middle click with the mouse.
Warning
The module is designed to be used as part of the pyOMA2 package and relies on its internal data structures and algorithms.
Module for interactive plots. Part of the pyOMA2 package. Authors: Dag Pasca Diego Margoni
This module provides the SelFromPlot class for interactive selection of poles in operational modal analysis plots. It supports FDD, SSI, and pLSCF methods and integrates matplotlib plots into a Tkinter window for user interaction.
- class pyoma2.support.sel_from_plot.SelFromPlot(algo: BaseAlgorithm, freqlim: tuple[float, float] = None, plot: Literal['FDD', 'SSI', 'pLSCF'] = 'FDD')[source]
Bases:
objectA class for interactive selection of poles.
This class integrates matplotlib plots into a Tkinter window, enabling users to interactively select or deselect poles using mouse clicks and keyboard shortcuts. It supports FDD, SSI, and pLSCF methods for operational modal analysis. The design and functionality of this class is strongly inspired by the pyEMA module [ZBGS20].
- algo
An instance of a base algorithm class that provides necessary data for plotting.
- Type:
- freqlim
Upper frequency limit for the plot, defaults to half the Nyquist frequency if not provided.
- Type:
tuple, optional
- root
Root widget of the Tkinter application.
- Type:
- fig
Matplotlib Figure object for plotting.
- Type:
matplotlib.figure.Figure
- ax2
Axes object for the figure.
- Type:
matplotlib.axes.Axes
- MARKER
Line2D object for displaying selected points on the plot.
- Type:
matplotlib.lines.Line2D
- __init__(algo: BaseAlgorithm, freqlim: tuple[float, float] = None, plot: Literal['FDD', 'SSI', 'pLSCF'] = 'FDD')[source]
Initializes the SelFromPlot class with specified algorithm, frequency limit, and plot type.
- Parameters:
algo (BaseAlgorithm) – An instance of a base algorithm class providing necessary data for plotting.
freqlim (tuple, optional) – Upper frequency limit for the plot, defaults to half the Nyquist frequency if not provided.
plot (str, optional) – Type of plot to be displayed. Supported values are “FDD”, “SSI”, and “pLSCF”. Default is “FDD”.
- get_closest_freq() None[source]
Selects the frequency closest to the mouse click location for FDD plots.
- get_closest_pole(plot: Literal['SSI', 'pLSCF']) None[source]
Selects the pole closest to the mouse click location for SSI or pLSCF plots.
- Parameters:
plot (str) – Type of plot (“SSI” or “pLSCF”) for which the pole is being selected.
- on_click_FDD(event) None[source]
Handles mouse click events for FDD plots.
- Parameters:
event (matplotlib.backend_bases.MouseEvent) – The mouse event triggered on the plot.
- on_click_SSI(event, plot: Literal['SSI', 'pLSCF']) None[source]
Handles mouse click events for SSI or pLSCF plots.
- Parameters:
event (matplotlib.backend_bases.MouseEvent) – The mouse event triggered on the plot.
plot (str) – Type of plot (“SSI” or “pLSCF”) where the event occurred.
- on_key_press(event) None[source]
Handles key press events for interactive pole selection.
- Parameters:
event (matplotlib.backend_bases.KeyEvent) – The key event triggered on the plot.
- on_key_release(event) None[source]
Handles key release events.
- Parameters:
event (matplotlib.backend_bases.KeyEvent) – The key event triggered on the plot.
- plot_stab(plot: Literal['SSI', 'pLSCF'], update_ticks: bool = False) None[source]
Plots the stabilization chart for SSI or pLSCF methods.
- plot_svPSD(update_ticks: bool = False) None[source]
Plots the Singular Values of the Power Spectral Density matrix for FDD analysis.
- Parameters:
update_ticks (bool, optional) – Flag indicating whether to update tick marks for selected frequencies. Default is False.