.. _tutorial_mex_frame:

=============================
Mars Express frame definition
=============================

In :mod:`irfpy.aspera` modules, the frame definition follows that of SPICE.

.. note::

   There are confusion in the SPICE definition and ASPERA-team
   internal definition of the IMA frame name.
   Internal definition of "IMA" frame is equivalent to
   "IMAS" frame in SPICE (``MEX_ASPERA_IMAS``).
   "IMA" frame in SPICE is **not** used in the internal ASPERA document.

   In :mod:`irfpy.aspera.mima` module, all the definition
   of "IMA frame" should follow the internal-"IMA" frame
   which is identical to "IMAS" frame in SPICE.
   Therefore, if I state "IMA frame", this means internal-IMA.
   In some modules, the frame name is explicitly says ``imas``, but
   this is again the same as internal-IMA frame.



Frame and numbering
===================

:mod:`irfpy.mima.fov` for the field of view and frame
definition and implementation.

.. image:: mex_frame_definition.png

.. note::

   Definition for VEX differs.


IMA angles
==========

For IMA, sometimes the numbering is expressed by the angles.

- :mod:`irfpy.mima.fov` for the field ov view.


Conversion
==========

High level operation can be supported in :class:`irfpy.mima.fov.SimpleFOV`.

Convert from numbering to IMA frame
-----------------------------------

For IMAS frame, the azimuth and polar angle between az=0 and az=1
and between po=7 and 8 points x direction.
:meth:`irfpy.mima.fov.SimpleFOV.viewvector_imasframe` supports this.
:meth:`irfpy.mima.fov.SimpleFOV.velocityvector_imasframe` method
returns the corresponding (unit) velocity vector in IMAS frame.

Samples are in the docstring in the above method.

IMA frame conversion to numbering
---------------------------------

You may use :meth:`irfpy.mima.fov.SimpleFOV.numbering_imasframe`.

Samples are in the docstring in the above method.