Source code for torx.measure.plasma_parameters_m
"""Fundamental plasma parameters."""
import xarray as xr
import numpy as np
from torx import make_xarray
from torx.normalization.normalization_m import Normalization
from torx.autodoc_decorators_m import autodoc_function
[docs]
@autodoc_function
def ion_larmor_radius(
shaped_ion_temp: xr.DataArray,
magnetic_field_strength: xr.DataArray,
norm: Normalization,
):
"""Return the radius of ion gyro-orbit."""
assert (
"R" in shaped_ion_temp.dims and "Z" in shaped_ion_temp.dims
), f"Should transform potential to matrix form before\
calling ion_larmor_radius"
return make_xarray(
np.sqrt(shaped_ion_temp) / magnetic_field_strength,
norm=norm.rho_s0,
name="Ion Larmor radius",
)
[docs]
@autodoc_function
def drift_scale(
shaped_electron_temp: xr.DataArray,
magnetic_field_strength: xr.DataArray,
norm: Normalization,
):
"""Return the turbulence drift-scale."""
assert (
"R" in shaped_electron_temp.dims and "Z" in shaped_electron_temp.dims
), f"Should transform potential to matrix form before\
calling drift_scale"
return make_xarray(
np.sqrt(shaped_electron_temp) / magnetic_field_strength,
norm=norm.rho_s0,
name="Ion Larmor radius",
)