cena_count_rate_energy_bandΒΆ

# IPython log file
import numpy as np
from pylab import *

import irfpy.cena.empirical
import irfpy.util.units as u
import irfpy.cena.energy
import irfpy.cena.cena_flux

if __name__ == '__main__':

    n = 5 * u.cm ** -3
    T = 100 * u.ev.T
    j_mx = irfpy.cena.empirical.maxwell_func(n, T)
    energy_in_eV = irfpy.cena.energy.getEnergyE16()
    j = [j_mx(e * u.ev.E).asNumber(u.cm**-2 / u.ster /u.s / u.ev.E) for e in energy_in_eV]
    plot(energy_in_eV, j)
    xscale('log')
    yscale('log')
    ylim(1, 1e5)

    f2c_m1 = irfpy.cena.cena_flux.Flux2Count_Matrix()
    f2c_m2 = irfpy.cena.cena_flux.Flux2Count_Matrix(energy_response_type='simple_triangle')
    c_m1 = f2c_m1.get_counts(j, 3)
    c_m2 = f2c_m2.get_counts(j, 3)

    f2c_s = irfpy.cena.cena_flux.Flux2Count_Simple()
    c1 = np.array([f2c_s.getCount(j[i], i, 3) for i in range(16)])

    figure()
    plot(energy_in_eV, c_m1, label='Kazama func')
    plot(energy_in_eV, c_m2, label='triangle func')
    plot(energy_in_eV, c1, label='Rectangle (classical)')

    yscale('log')
    xscale('log')

    legend(loc='lower left')