pylbo.visualisation.eigenfunctions.eigfunc_interface

Classes

EigenfunctionInterface

Functions

get_artist_data(→ tuple[numpy.ndarray, numpy.ndarray])

Returns the (x, y) coordinates of a given artist.

Module Contents

pylbo.visualisation.eigenfunctions.eigfunc_interface.get_artist_data(artist: matplotlib.pyplot.Artist) tuple[numpy.ndarray, numpy.ndarray]

Returns the (x, y) coordinates of a given artist.

Parameters:

artist (Artist) – The artist to get the data from.

Returns:

The (x, y) coordinates of the artist.

Return type:

tuple[np.ndarray, np.ndarray]

class pylbo.visualisation.eigenfunctions.eigfunc_interface.EigenfunctionInterface(data, axis, spec_axis)
data
axis
spec_axis
_selected_idxs
_use_real_part = True
_selected_name_idx = 0
_function_names
_retransform = False
_condition_to_make_transparent = None
_transparent_data = False
_unmarked_alpha = None
_ef_subset_artists = None
_draw_resonances = False
savedir = None
_check_data_is_present()

Checks if the required data is present to draw for example eigenfunctions, is overloaded in subclasses.

_artist_has_valid_attributes(event)

Checks if a given event has valid attributes, this prevents triggering the interface when clicking on legend items, for example.

Parameters:

event (PickEvent) – The pick event.

Returns:

True if all conditions are met and callbacks can be connected, False otherwise.

Return type:

bool

_clear_figure_and_selection()

Clears the current figure, clears the dictionary of selected eigenvalues.

_switch_real_and_imaginary_part()

Switches between the real and imaginary part of a given function.

_select_next_function()

Increments the index of the currently selected function by 1.

_select_previous_function()

Decrements the index of the currently selected function by 1.

_retransform_functions()

Toggles a retransform of a function, for example an eigenfunction \(v_r \leftrightarrow rv_r\)

_print_selected_eigenvalues()

Prints all selected eigenvalues to the console as an array.

_save_eigenvalue_selection()

Saves all selected eigenvalues and their eigenfunctions as a list of dictionaries in a .npy file. Files can be loaded with the numpy load function.

_save_selection_indices()

Saves the indices of all selected eigenvalues as an array in a .npy file. Files can be loaded with the numpy load function.

_print_nzeroes()

Counts and prints the number of zeroes of the eigenfunctions for all selected eigenvalues on the plot, together with eigvals.

_get_label(ds, ev_idx, w)

Returns the label used in the legend. In case of a data series, the datfile name is prepended.

Parameters:
  • ds (LegolasDataSet) – The current dataset

  • ev_idx (int) – The index of the current eigenvalue in the corresponding array

  • w (float, complex) – The eigenvalue to use in the label

Returns:

The label to use in the legend.

Return type:

str

abstract _get_title()

Creates the title of a given plot, has to be overridden in a subclass.

get_selected_idxs() dict[pylbo.data_containers.LegolasDataContainer, dict[int, matplotlib.pyplot.Artist]]
get_name_of_drawn_eigenfunction() str
abstract update_plot()

Updates the plot when an event is triggered, clears and then redraws the functions. Rescaling of the axes is done automatically. Has to be overridden in a subclass.

on_point_pick(event)

Determines what happens when an eigenvalue is clicked.

Parameters:

event (PickEvent) – The pick event.

on_key_press(event)

Determines what happens when a key is pressed.

Parameters:

event (KeyEvent) – The key event.

on_left_click(event)

Determines what happens when left-clicking an eigenvalue.

Parameters:

event (PickEvent) – The pick event.

on_right_click(event)

Determines what happens when right-clicking an eigenvalue.

Parameters:

event (PickEvent) – The pick event.

_get_clicked_point_data(event)

Retrieves the index (in the eigenvalue array), x data coordinate and y data coordinate of the eigenvalue nearest to the clicked point.

Parameters:

event (PickEvent) – The pick event.

Returns:

  • idx (integer) – The index of the selected point in the eigenvalue array

  • xdata (float) – The x data coordinate of the selected eigenvalue

  • ydata (float) – The y data coordinate of the selected eigenvalue

_selected_point_has_eigenfunctions(ds, idx)

Checks if the selected index has eigenfunctions associated with it, in the case of for example eigenfunction subsets this is not guaranteed.

Parameters:
  • ds (LegolasDataSet) – The dataset associated with the given eigenvalue index

  • idx (int) – The index of the selected eigenvalue

Returns:

Returns True if idx corresponds to an eigenvalue with eigenfunctions, False otherwise.

Return type:

bool

_toggle_eigenfunction_subset_radius()
_mark_points_without_data_written()

For dataseries, it is possible that not all datasets in the series have eigenfunctions associated with them. This routine will toggle a change in the opacity value for datapoints with no functions, so they are clearly distinguishable from those who do have them.

_display_tooltip()
_invert_continua(ds, ev_idx)

Calculates the locations of resonance with the continua for a specific eigenmode.

Parameters:

ef_idx (int) – The number of the eigenvalue in the dataset.

Returns:

  • r_inv (dict) – Dictionary of continua names and inverted resonance locations (float, or None if not in domain).

  • labels (dict) – Dictionary containing the corresponding labels to be printed when drawing the locations of resonance.

_show_resonances(ds, ev_idx, color)

Shows the locations of resonance with the continua. There is a different linestyle for every continuum.