pylbo.visualisation.modes.cartesian_2d

Module Contents

Classes

CartesianSlicePlot2D

Class for handling Cartesian 2D plots of the eigenmode solutions.

class pylbo.visualisation.modes.cartesian_2d.CartesianSlicePlot2D(data: pylbo.visualisation.modes.mode_data.ModeVisualisationData, u2: float | numpy.ndarray, u3: float | numpy.ndarray, time: float, slicing_axis: str, figsize: tuple[int, int], show_ef_panel: bool, **kwargs)[source]

Bases: pylbo.visualisation.modes.mode_figure.ModeFigure

Class for handling Cartesian 2D plots of the eigenmode solutions.

Parameters:
  • data (ModeVisualisationData) – The data for the visualisation.

  • u2 (float or ndarray) – The \(y\) coordinate of the eigenmode solution.

  • u3 (float or ndarray) – The \(z\) coordinate of the eigenmode solution.

  • time (float) – The time at which the eigenmode solution is calculated.

  • slicing_axis (str) – The axis along which the eigenmode solution is sliced.

  • figsize (tuple[int, int]) – The size of the figure.

  • show_ef_panel (bool) – Whether to show the eigenfunction panel.

  • **kwargs – Additional keyword arguments to be passed to matplotlib.pyplot.imshow().

_validate_slicing_axis(slicing_axis: str, allowed_axes: list[str]) str[source]

Validates the slicing axis.

Parameters:
  • slicing_axis (str) – The slicing axis.

  • allowed_axes (list[str]) – The list of allowed axes.

Returns:

The validated slicing axis.

Return type:

str

_validate_u2(u2: float, slicing_axis: str, axis: str) float[source]

Validates the combination of u2 and slicing axis.

Parameters:
  • u2 (float) – The \(u_2\) coordinate.

  • slicing_axis (str) – The slicing axis.

  • axis (str) – The coordinate axis corresponding to \(u_2\).

Returns:

The validated \(u_2\) coordinate.

Return type:

float

_validate_u3(u3: float, slicing_axis: str, axis: str) float[source]

Validates the combination of u3 and slicing axis.

Parameters:
  • u3 (float) – The \(u_3\) coordinate.

  • slicining_axis (str) – The slicing axis.

  • axis (str) – The coordinate axis corresponding to \(u_3\).

Returns:

The validated \(u_3\) coordinate.

Return type:

float

set_plot_arrays() None[source]

Sets the arrays used for plotting. This should implement setting of u1_data, u2_data, u3_data, t_data and ef_data.

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().

set_contours(levels=None, fill=False) None[source]

Sets up a contour plot instead of an image plot.

Parameters:
  • levels (int or list[float]) – The number of levels or the list of levels.

  • fill (bool) – Whether to fill the contour plot.

draw_solution() None[source]
_draw_image() None[source]
_draw_contours() None[source]
get_view_ylabel() str[source]
create_animation(times: numpy.ndarray, filename: str, fps: float = 10, dpi: int = 200) None[source]

Creates an animation of the eigenmode solution over a given time interval.

Parameters:
  • times (np.ndarray) – The times at which to create the animation.

  • filename (str) – The filename of the animation.

  • fps (float) – The frames per second of the animation.

  • dpi (int) – The resolution of the animation.

_ensure_first_frame_is_drawn() None[source]
_set_t_txt(t)[source]
_update_view(updated_solution: numpy.ndarray) None[source]

Updates the axes with the new solution. If a contour plot is used, the contour lines are cleared and redrawn. If an image plot is used, the image is updated.

Parameters:

updated_solution (np.ndarray) – The new solution.

_update_view_clims(solution: numpy.ndarray) None[source]
_clear_contours()[source]
_update_contour_plot(updated_solution: numpy.ndarray) None[source]