pylbo.visualisation.modes.mode_data

Classes

ModeVisualisationData

Class that contains the data used for eigenmode visualisations.

Functions

_handle_expected_input_value(→ list[list[complex]])

_check_grid_dataseries(→ bool)

Check if all datasets in the dataseries have the same grid.

Module Contents

pylbo.visualisation.modes.mode_data._handle_expected_input_value(ds: pylbo.data_containers.LegolasDataSeries, value) list[list[complex]]
pylbo.visualisation.modes.mode_data._check_grid_dataseries(ds: pylbo.data_containers.LegolasDataSeries) bool

Check if all datasets in the dataseries have the same grid.

Parameters:

ds (LegolasDataSeries) – The dataseries to check.

Returns:

True if all datasets have the same grid, False otherwise.

Return type:

bool

class pylbo.visualisation.modes.mode_data.ModeVisualisationData(ds: pylbo.data_containers.LegolasDataSet | pylbo.data_containers.LegolasDataSeries, omega: complex | list[complex] | numpy.ndarray | list[list[complex]] | list[numpy.ndarray], ef_name: str = None, use_real_part: bool = True, complex_factor: complex | list[complex] | numpy.ndarray | list[list[complex]] | list[numpy.ndarray] = None, add_background: bool = False)

Class that contains the data used for eigenmode visualisations.

Parameters:
  • ds (LegolasDataSet/LegolasDataSeries) – The data set/series containing the eigenfunctions, having the same equilibria.

  • omega (list[list[complex]]) – The (approximate) eigenvalue(s) of the mode(s) to visualise.

  • ef_name (str) – The name of the eigenfunction to visualise.

  • use_real_part (bool) – Whether to use the real part of the eigenmode solution.

  • complex_factor (list[list[complex]]) – A complex factor to multiply the eigenmode solution with.

  • add_background (bool) – Whether to add the equilibrium background to the eigenmode solution.

ds

The dataseries containing the eigenfunctions and modes to visualise.

Type:

LegolasDataSeries

omega

The (approximate) eigenvalue(s) of the mode(s) to visualise.

Type:

list[list[complex]]

eigenfunction

The eigenfunction of the mode(s) to visualise.

Type:

list[list[np.ndarray]]

use_real_part

Whether to use the real part of the eigenmode solution.

Type:

bool

complex_factor

The complex factors to multiply the eigenmode solution with.

Type:

list[list[complex]]

add_background

Whether to add the equilibrium background to the eigenmode solution.

Type:

bool

ds
complex_factor = None
ds_bg
use_real_part = True
add_background = False
_print_bg_info = True
_ef_name = None
_ef_name_latex = None
_all_efs
omega = []
eigenfunction = []
property k2: float

The k2 wave number of the eigenmode solution.

property k3: float

The k3 wave number of the eigenmode solution.

property part_name: str

Returns the name of the part of the eigenmode solution to use, i.e. ‘real’ or ‘imag’.

get_ef_name_latex() str

Returns the latex representation of the eigenfunction name.

_validate_complex_factor(complex_factor: list[list[complex]]) list[list[complex]]

Validates the complex factors.

Parameters:

complex_factor (list[list[complex]]) – The complex factor to validate.

Returns:

The complex factor if it is valid, otherwise 1.

Return type:

complex

get_mode_solution(ef: numpy.ndarray, omega: complex, complex_factor: complex, u2: float | numpy.ndarray, u3: float | numpy.ndarray, t: float | numpy.ndarray, k2: float, k3: float) numpy.ndarray

Calculates the full eigenmode solution for given coordinates and time. If a complex factor was given, the eigenmode solution is multiplied with the complex factor. If use_real_part is True the real part of the eigenmode solution is returned, otherwise the complex part.

Parameters:
  • ef (np.ndarray) – The eigenfunction to use.

  • omega (complex) – The eigenvalue to use.

  • complex_factor (complex,) – The complex factor to multiply with.

  • u2 (Union[float, np.ndarray]) – The y coordinate(s) of the eigenmode solution.

  • u3 (Union[float, np.ndarray]) – The z coordinate(s) of the eigenmode solution.

  • t (Union[float, np.ndarray]) – The time(s) of the eigenmode solution.

  • k2 (float) – The x2 wavenumber of the mode.

  • k3 (float) – The x3 wavenumber of the mode.

Returns:

The real or imaginary part of the eigenmode solution for the given set of coordinate(s) and time(s).

Return type:

np.ndarray

get_background(shape: tuple[int, Ellipsis], name=None) numpy.ndarray

Returns the background of the eigenmode solution.

Parameters:
  • shape (tuple[int, ...]) – The shape of the eigenmode solution.

  • name (str) – The name of the background to use. If None, the background name will be inferred from the eigenfunction name.

Returns:

The background of the eigenmode solution, sampled on the eigenfunction grid and broadcasted to the same shape as the eigenmode solution.

Return type:

np.ndarray

_sample_background_on_ef_grid(bg: numpy.ndarray) numpy.ndarray

Samples the background array on the eigenfunction grid.

Parameters:

bg (np.ndarray) – The background array with Gaussian grid spacing

Returns:

The background array with eigenfunction grid spacing

Return type:

np.ndarray

_get_background_name() str

Returns the name of the background.

Returns:

The closest match between the eigenfunction name and the equilibrium name.

Return type:

str

Raises:

ValueError – If the eigenfunction name is a magnetic vector potential component or derived eigenfunction that is not the magnetic field.