==========================
Get parameters from CPEMv2
==========================


Install referring to the :ref:`quickinstall`.
CPEMv2 is provided in a form of module.
Once installed, CPEMv2 model can be used
from any python interpreters or scripts.


Just start Python3.  Probably, you want to use ipython, or jupyter notebook.
Double-click the relevant icons, or use the command line as

.. code-block:: sh

        % ipython


Importing CPEMv2 module
=======================

Once Python3 is launched, import the module.

>>> from irfpy.cpem import cpemv2

Getting charge density
======================

The charge density model is available by ``cpemv2.plasma_density``.

There are four models implemented under ``cpemv2.plasma_density``:

- Reference model, only depending on the Jovi-center distance, :math:`R`.
  :meth:`cpemv2.plasma_density.reference_model <irfpy.cpem.cpemv2.CpemIonChargeDensity.reference_model>`
- Mean model, depending on the Jovi-center distance and the magnetic local time, :math:`R, MLT`.
  :meth:`cpemv2.plasma_density.mean_model <irfpy.cpem.cpemv2.CpemIonChargeDensity.mean_model>`
- Percentile model, depending on the percentile (user can specify) together with above.
  :meth:`cpemv2.plasma_density.percentile_model  <irfpy.cpem.cpemv2.CpemIonChargeDensity.percentile_model>`
- Full model, depending on the magnetic latitude, but only for Charge density.
  Otherwise, the return is the same as percentile model.
  :meth:`cpemv2.plasma_density.full_model  <irfpy.cpem.cpemv2.CpemIonChargeDensity.full_model>`

Charge density model
--------------------

It is easy to get the CPEMv2 charge density model.

>>> n = cpemv2.plasma_density.full_model(15.5, 6.0, -5.3, 0.5)

This is the density modeled at R=15.5 Rj, MLT=6 hr, Mlat=-5.3 deg, and percentile of 50%. 

>>> print(n)
0.656950469619

Other models
------------

You can replace ``plasma_density`` to the following.

- ``ion_velocity_corotation``, ``ion_velocity_polar``, and ``ion_velocity_radial`` for the corotation ion velocity vector
- ``ion_temperature`` for the ion temperature
- ``hot_electron_density`` and ``hot_electron_temperature`` for hot electrons.