mima_demo.mima_masscontourΒΆ

Script to plot mass contours for PACC=0, 4, and 7.

The mass contour is obtained from irfpy.mima.massring.massline() function.

../_images/mima_masscontour.png
""" Script to plot mass contours for PACC=0, 4, and 7.

The mass contour is obtained from :func:`irfpy.mima.massring.massline` function.

.. image:: ../../../src/scripts/mima_demo/mima_masscontour.png
"""
import numpy as np
import matplotlib.pyplot as plt

def main():
    '''Main script'''

    mass = [1, 2, 4, 16, 32, 44]
    massname = ['H+', 'He++', 'He+', 'O+', 'O2+', 'CO2+']
    masscolor = 'brgcmyk'

    energy = np.logspace(1, 4.5, 96)   # 10 eV to 30000 eV.

    fig = plt.figure(figsize=[14, 6])

    for i, pacc_index in enumerate((0, 4, 7)):
        ax = fig.add_subplot(1, 3, i + 1)
        for m, mn, c in zip(mass, massname, masscolor):
            import irfpy.mima.massring
            energy_list, mass_list = irfpy.mima.massring.massline(m, pacc_index, enestep=energy)
            ax.plot(mass_list, energy_list, color=c)
            ax.text(mass_list[75 - m], energy_list[75 - m], mn, color=c, ha='center')

        ax.set_title('PACC={}'.format(pacc_index))
        ax.set_yscale('log')
        ax.set_xlabel('Mass ring')
        ax.set_ylabel('Energy [eV/q]')
        ax.set_xlim(0, 32)
        ax.set_ylim(10, 10 ** 4.5)

    plt.savefig('mima_masscontour.png')

if __name__ == "__main__":
    main()