pylbo.visualisation.modes.mode_figure
Classes
Main class to hold the figure, axes and colorbar for eigenmode visualisations. |
Module Contents
- class pylbo.visualisation.modes.mode_figure.ModeFigure(figsize: tuple[int, int], data: pylbo.visualisation.modes.mode_data.ModeVisualisationData, show_ef_panel: bool)[source]
Bases:
pylbo.visualisation.figure_window.FigureWindow
Main class to hold the figure, axes and colorbar for eigenmode visualisations.
- Parameters:
data (ModeVisualisationData) – The data used for eigenmode visualisations.
- u1_data
The data for the \(u_1\) coordinate.
- Type:
np.ndarray
- omega_txt
The text for the \(\omega\) label.
- Type:
- k2k3_txt
The text for the \(k_2-k_3\) label.
- Type:
- u2u3_txt
The text for the \(u_2-u_3\) label.
- Type:
- t_txt
The text for the time label.
- Type:
- _check_if_number(val: float, attr_name: str) float [source]
Checks if a given value is a number.
- Parameters:
- Raises:
ValueError – If the value is not a number.
- _check_if_array(array: numpy.ndarray, attr_name: str) numpy.ndarray [source]
Checks is a given value is a numpy array.
- Parameters:
array (np.ndarray) – The value to check.
attr_name (str) – The name of the value.
- Raises:
ValueError – If the value is not a numpy array.
- abstract set_plot_arrays() None [source]
Sets the arrays used for plotting. This should implement setting of
u1_data
,u2_data
,u3_data
,t_data
andef_data
.
- calculate_mode_solution(efdata: dict, u2: float | numpy.ndarray, u3: float | numpy.ndarray, t: float | numpy.ndarray) numpy.ndarray [source]
Calculates the mode solution.
- Parameters:
efdata (dict) – The data for the eigenfunction. This should be a dictionary with the keys
'ef'
and'omega'
, with'ef'``containing the eigenfunction and ``'omega'
the corresponding eigenvalue.u2 (Union[float, np.ndarray]) – The data for the \(u_2\) coordinate.
u3 (Union[float, np.ndarray]) – The data for the \(u_3\) coordinate.
t (Union[float, np.ndarray]) – The data for the time.
- Returns:
The mode solution.
- Return type:
np.ndarray
- property ax: matplotlib.axes.Axes[source]
returns: Alias for the axes containing the eigenmode solution view. :rtype: matplotlib.axes.Axes
- property solutions: numpy.ndarray[source]
returns: The solutions for the eigenmode :rtype: np.ndarray
- _create_cbar_axes(width: float) matplotlib.axes.Axes [source]
Creates the axes for the colorbar.
- Parameters:
width (float) – The width of the colorbar axes.
- Returns:
The axes for the colorbar.
- Return type:
- add_omega_txt(ax, **kwargs) None [source]
Creates a textbox on the axis with the value of the eigenfrequency.
- Parameters:
ax (Axes) – The axes to use for the textbox.
**kwargs – Additional keyword arguments to pass to
add_axis_label()
.
- add_k2k3_txt(ax, **kwargs) None [source]
Creates a textbox on the figure with the value of the k2 and k3 coordinates.
- Parameters:
ax (Axes) – The axes to use for the textbox.
**kwargs – Additional keyword arguments to pass to
add_axis_label()
.
- add_u2u3_txt(ax, **kwargs) None [source]
Creates a textbox on the figure with the value of the \(u_2-u_3\) coordinates.
- Parameters:
ax (Axes) – The axes to use for the textbox.
**kwargs – Additional keyword arguments to pass to
add_axis_label()
.
- _create_figure_layout(figsize: tuple[int, int]) tuple[matplotlib.figure.Figure, dict] [source]
Create the figure layout for the visualisation. Two panels are created: the top one for the eigenfunction and the bottom one for the visualisation.