pyrfu.mms.rotate_tensor module#

pyrfu.mms.rotate_tensor.rotate_tensor(inp, rot_flag, vec, perp: str = 'pp')[source]#

Rotates pressure or temperature tensor into another coordinate system.

Parameters:
  • PeIJ/Peall (xarray.DataArray) – Time series of either separated terms of the tensor or the complete tensor. If columns (PeXX,PeXY,PeXZ,PeYY,PeYZ,PeZZ)

  • rot_flag (str) –

    Flag of the target coordinates system :
    • ”fac”Field-aligned coordinates, requires background

      magnetic field Bback, optional flag “pp” \(\mathbf{P}_{\perp 1} = \mathbf{P}_{\perp2}\) or “qq” \(\mathbf{P}_{\perp 1}\) and \(\mathbf{P}_{\perp 2}\) are most unequal, sets P_{23} to zero.

    • ”rot”Arbitrary coordinate system, requires new x-direction

      xnew, new y and z directions ynew, znew (if not included y and z directions are orthogonal to xnew and closest to the original y and z directions)

    • ”gse” : GSE coordinates, requires MMS spacecraft number

  • vec (xarray.DataArray or numpy.ndarray) – Vector or coordinates system to rotate the tensor. If vec is timeseries of a vector tensor is rotated in field aligned coordinates. If vec is a numpy.ndarray rotates to a time independant coordinates system.

  • perp (str, Optional) –

    Flag for perpandicular components of the tensor. Default is pp.
    • ”pp” : perpendicular diagonal components are equal

    • ”qq” : perpendicular diagonal components are most unequal

Returns:

Pe – Time series of the pressure or temperature tensor in field-aligned, user-defined, or GSE coordinates. For “fac” Pe = [Ppar P12 P13; P12 Pperp1 P23; P13 P23 Pperp2]. For “rot” and “gse” Pe = [Pxx Pxy Pxz; Pxy Pyy Pyz; Pxz Pyz Pzz]

Return type:

xarray.DataArray

Examples

>>> from pyrfu import mms, pyrf
>>> # Time interval
>>> tint = ["2015-10-30T05:15:20.000", "2015-10-30T05:16:20.000"]
>>> # Spacecraft index
>>> mms_id = 1
>>> # Load magnetic field and ion temperature tensor
>>> b_xyz = mms.get_data("B_gse_fgm_srvy_l2", tint, mms_id)
>>> t_xyz_i = mms.get_data("Ti_gse_fpi_fast_l2", tint, mms_id)
>>> # Compute ion temperature in field aligned coordinates
>>> t_xyzfac_i = mms.rotate_tensor(t_xyz_i, "fac", b_xyz, "pp")

TODO : implement method “gse”