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][source]

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)[source]
data[source]
axis[source]
spec_axis[source]
_selected_idxs[source]
_use_real_part = True[source]
_selected_name_idx = 0[source]
_function_names[source]
_retransform = False[source]
_condition_to_make_transparent = None[source]
_transparent_data = False[source]
_unmarked_alpha = None[source]
_ef_subset_artists = None[source]
_draw_resonances = False[source]
savedir = None[source]
_check_data_is_present()[source]

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

_artist_has_valid_attributes(event)[source]

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()[source]

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

_switch_real_and_imaginary_part()[source]

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

_select_next_function()[source]

Increments the index of the currently selected function by 1.

_select_previous_function()[source]

Decrements the index of the currently selected function by 1.

_retransform_functions()[source]

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

_print_selected_eigenvalues()[source]

Prints all selected eigenvalues to the console as an array.

_save_eigenvalue_selection()[source]

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()[source]

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()[source]

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)[source]

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()[source]

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]][source]
get_name_of_drawn_eigenfunction() str[source]
abstract update_plot()[source]

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)[source]

Determines what happens when an eigenvalue is clicked.

Parameters:

event (PickEvent) – The pick event.

on_key_press(event)[source]

Determines what happens when a key is pressed.

Parameters:

event (KeyEvent) – The key event.

on_left_click(event)[source]

Determines what happens when left-clicking an eigenvalue.

Parameters:

event (PickEvent) – The pick event.

on_right_click(event)[source]

Determines what happens when right-clicking an eigenvalue.

Parameters:

event (PickEvent) – The pick event.

_get_clicked_point_data(event)[source]

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)[source]

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()[source]
_mark_points_without_data_written()[source]

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()[source]
_invert_continua(ds, ev_idx)[source]

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)[source]

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