Load.cartesian_vector#

pyPLUTO.Load.cartesian_vector(self, var: str | None = None, **kwargs: Any) tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], ...][source]#

Function that converts a vector from spherical or polar components to cartesian components.

Parameters:
- transpose: bool, default False

If True, the variable is transposed.

- var: np.ndarray

The variable to convert.

- var1: np.ndarray

The first variable to convert if var is not used.

- var2: np.ndarray

The second variable to convert if var is not used.

- var3: np.ndarray

The third variable to convert if var is not used.

- x1: int

The first index of the variable.

- x2: int

The second index of the variable.

—-
Returns:
  • newvar: tuple(np.ndarray)

    The converted vector components.

Examples

  • Example #1: Convert the vector from spherical to cartesian components

    >>> Bx, By, Bz = cartesian_vector(var="B")
    
  • Example #2: Convert the vector from polar to cartesian components

    >>> Bx, By = cartesian_vector(var1=D.Bx1, var2=D.Bx2)