pylbo.visualisation.modes.mode_data

Module Contents

Classes

ModeVisualisationData

Class that contains the data used for eigenmode visualisations.

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

Class that contains the data used for eigenmode visualisations.

Parameters:
  • ds (LegolasDataSet) – The dataset containing the eigenfunctions and modes to visualise.

  • omega (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 (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 dataset containing the eigenfunctions and modes to visualise.

Type:

LegolasDataSet

omega

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

Type:

list[complex]

eigenfunction

The eigenfunction of the mode(s) to visualise.

Type:

list[np.ndarray]

use_real_part

Whether to use the real part of the eigenmode solution.

Type:

bool

complex_factor

The complex factor to multiply the eigenmode solution with.

Type:

complex

add_background

Whether to add the equilibrium background to the eigenmode solution.

Type:

bool

property k2: float[source]

The k2 wave number of the eigenmode solution.

property k3: float[source]

The k3 wave number of the eigenmode solution.

property part_name: str[source]

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

_get_all_efs(ds: pylbo.data_containers.LegolasDataSet, omega: List[complex]) numpy.ndarray[source]

Returns an array of dicts with all eigenfunctions for every eigenvalue. The dictionaries will be updated with the derived eigenfunctions if they are available in the dataset.

Parameters:
  • ds (LegolasDataSet) – The dataset containing the eigenfunctions.

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

Returns:

An array of dicts with all eigenfunctions for every eigenvalue.

Return type:

np.ndarray

get_ef_name_latex() str[source]

Returns the latex representation of the eigenfunction name.

_validate_complex_factor(complex_factor: complex) complex[source]

Validates the complex factor.

Parameters:

complex_factor (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, u2: float | numpy.ndarray, u3: float | numpy.ndarray, t: float | numpy.ndarray) numpy.ndarray[source]

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.

  • 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.

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

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

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

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.