pylbo.visualisation.continua

Module Contents

Classes

ContinuaHandler

Handler to draw continua regions on the plots and make them interactive.

Functions

_is_zero(→ bool)

_is_nonadiabatic(→ bool)

_get_parallel_wave_vector(→ float)

_get_squared_sound_speed(→ numpy.ndarray)

_get_squared_isothermal_sound_speed(→ numpy.ndarray)

_get_squared_Alfven_speed(→ numpy.ndarray)

calculate_continua(→ dict)

Calculates the different continua for a given dataset.

get_squared_alfven_continuum(→ numpy.ndarray)

Calculates the squared Alfvén continuum.

get_doppler_shift(→ numpy.ndarray)

Calculates the Doppler shift as the dot product between the wave vector and the

get_squared_slow_continuum(→ numpy.ndarray)

Calculates the squared slow continuum.

_get_thermal_and_slow_continua(→ Tuple[numpy.ndarray, ...)

Calculates the thermal and slow continua.

_get_thermal_continuum_analytical(→ numpy.ndarray)

Calculates the thermal continuum analytically, when the slow continuum is zero.

_get_slow_and_thermal_continuum_coupled(...)

_solve_coupled_continuum_polynomial(...)

Solves the third-order polynomial that couples the slow and thermal continua.

_extract_solutions_from_roots(roots, i, complex, complex)

_log_slow_continuum_zero_warning(roots, i)

_log_assumed_thermal_continuum(root)

Attributes

SLOW_MIN

SLOW_PLUS

ALFVEN_MIN

ALFVEN_PLUS

THERMAL

DOPPLER

CONTINUA_NAMES

CONTINUA_COLORS

_DEFAULT_ZERO_TOL

pylbo.visualisation.continua.SLOW_MIN = 'slow-'[source]
pylbo.visualisation.continua.SLOW_PLUS = 'slow+'[source]
pylbo.visualisation.continua.ALFVEN_MIN = 'alfven-'[source]
pylbo.visualisation.continua.ALFVEN_PLUS = 'alfven+'[source]
pylbo.visualisation.continua.THERMAL = 'thermal'[source]
pylbo.visualisation.continua.DOPPLER = 'doppler'[source]
pylbo.visualisation.continua.CONTINUA_NAMES[source]
pylbo.visualisation.continua.CONTINUA_COLORS = ['red', 'red', 'cyan', 'cyan', 'green', 'grey'][source]
pylbo.visualisation.continua._DEFAULT_ZERO_TOL = 1e-12[source]
pylbo.visualisation.continua._is_zero(values: numpy.ndarray, zero_tol: float = _DEFAULT_ZERO_TOL) bool[source]
pylbo.visualisation.continua._is_nonadiabatic(ds: pylbo.data_containers.LegolasDataSet) bool[source]
pylbo.visualisation.continua._get_parallel_wave_vector(ds: pylbo.data_containers.LegolasDataSet) float[source]
pylbo.visualisation.continua._get_squared_sound_speed(ds: pylbo.data_containers.LegolasDataSet) numpy.ndarray[source]
pylbo.visualisation.continua._get_squared_isothermal_sound_speed(ds: pylbo.data_containers.LegolasDataSet) numpy.ndarray[source]
pylbo.visualisation.continua._get_squared_Alfven_speed(ds: pylbo.data_containers.LegolasDataSet) numpy.ndarray[source]
pylbo.visualisation.continua.calculate_continua(ds: pylbo.data_containers.LegolasDataSet) dict[source]

Calculates the different continua for a given dataset. The Alfvén and flow continua are always analytical. Depending on the background and physical effects the slow and thermal continua are either all analytical, or coupled through a third-order polynomial. In case of the latter this polynomical is numerically solved through numpy.roots.

Parameters:

ds (LegolasDataSet) – The Legolas dataset.

Returns:

Dictionary containing the various continua. The keys are the names of the continua, the values are the corresponding frequencies as numpy arrays. Returns None if the dataset has no background.

Return type:

dict, None

pylbo.visualisation.continua.get_squared_alfven_continuum(ds: pylbo.data_containers.LegolasDataSet) numpy.ndarray[source]

Calculates the squared Alfvén continuum.

Returns:

The squared Alfvén continuum.

Return type:

np.ndarray

pylbo.visualisation.continua.get_doppler_shift(ds: pylbo.data_containers.LegolasDataSet) numpy.ndarray[source]

Calculates the Doppler shift as the dot product between the wave vector and the background velocity.

Returns:

The Doppler shift.

Return type:

np.ndarray

pylbo.visualisation.continua.get_squared_slow_continuum(ds: pylbo.data_containers.LegolasDataSet) numpy.ndarray[source]

Calculates the squared slow continuum.

Returns:

The squared slow continuum.

Return type:

np.ndarray

pylbo.visualisation.continua._get_thermal_and_slow_continua(ds: pylbo.data_containers.LegolasDataSet) Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray][source]

Calculates the thermal and slow continua.

Returns:

A tuple containing the slow-, slow+ and thermal continua, in this order.

Return type:

Tuple[np.ndarray, np.ndarray, np.ndarray]

pylbo.visualisation.continua._get_thermal_continuum_analytical(ds: pylbo.data_containers.LegolasDataSet) numpy.ndarray[source]

Calculates the thermal continuum analytically, when the slow continuum is zero.

Returns:

The thermal continuum.

Return type:

np.ndarray

pylbo.visualisation.continua._get_slow_and_thermal_continuum_coupled(ds: pylbo.data_containers.LegolasDataSet) Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray][source]
pylbo.visualisation.continua._solve_coupled_continuum_polynomial(coeff3: numpy.ndarray, coeff2: numpy.ndarray, coeff1: numpy.ndarray, coeff0: numpy.ndarray) Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray][source]

Solves the third-order polynomial that couples the slow and thermal continua. The thermal continuum corresponds to the purely imaginary solution.

Parameters:
  • coeff3 (np.ndarray) – The coefficient corresponding to the term \(\omega^3\).

  • coeff2 (np.ndarray) – The coefficient corresponding to the term \(\omega^2\).

  • coeff1 (np.ndarray) – The coefficient corresponding to the term \(\omega^1\).

  • coeff0 (np.ndarray) – The coefficient corresponding to the constant term.

Returns:

A tuple containing the slow-, slow+ and thermal continua, in this order.

Return type:

Tuple[np.ndarray, np.ndarray, np.ndarray]

pylbo.visualisation.continua._extract_solutions_from_roots(roots: numpy.ndarray, i: int = 0)[source]
pylbo.visualisation.continua._log_slow_continuum_zero_warning(roots: numpy.ndarray, i: int)[source]
pylbo.visualisation.continua._log_assumed_thermal_continuum(root: complex)[source]
class pylbo.visualisation.continua.ContinuaHandler(interactive)[source]

Bases: pylbo.visualisation.legend_handler.LegendHandler

Handler to draw continua regions on the plots and make them interactive.

Parameters:

interactive (bool) – If True, makes the legend pickable and continuum plotting interactive.

continua_names

The list of continua names

Type:

list

property continua_colors[source]

Returns the list of continua colors.

Return type:

The continua colors as a list.