snippet_mars.exosphere_partition_funcΒΆ

A sample code for a partition function.

""" A sample code for a partition function.

.. codeauthor: wang
"""
import numpy as np
import matplotlib.pyplot as plt
from irfpy.mars.exosphere import ISSI2008_SolarMin

def main():
    # test the partition function
    zs = np.logspace(0, np.log10(100 * ISSI2008_SolarMin.R_m), 300)
    rrs = ISSI2008_SolarMin.R_m + zs

    zetas_HC_1 = ISSI2008_SolarMin.part_func(rrs, zc=164e3, hc=706e3)
    zetas_HC_2 = ISSI2008_SolarMin.part_func(rrs, lam=25965 / (rrs / 1000))
    zetas_HH_1 = ISSI2008_SolarMin.part_func(rrs)
    zetas_HH_2 = ISSI2008_SolarMin.part_func(rrs, lam=10365 / (
            rrs / 1000))  # confirmed, zeta as a function of lambda (bal + sat) is correct , originally 10365
    # plt.plot(lamHH2, zetas_HH_2, c='r')
    # plt.minorticks_on()
    plt.grid()

    # plt.plot(zs / R_m, zetas_HH_1, c='r')
    plt.plot(zetas_HH_2, zs / 1000, c='y', label='500 K')
    # plt.plot(zs / R_m, zetas_HC_1, c='b')
    plt.plot(zetas_HC_2, zs / 1000, c='g', label='200 K')
    plt.xscale('log')
    plt.yscale('log')
    plt.legend()

    plt.ylabel('ALtitude (km)')
    plt.xlabel('Partition func')
    plt.ylim(2e2, 7e5)
    plt.xlim(1e-4, 1)

    # plt.savefig('ISSI2008_solmin.eps')
    plt.show()

if __name__ == "__main__":
    main()