Example #1
0
def print_photon_field(**kwargs):
    """ Sanity check, print otu temperature and energy density of the photon fields. """
    plot_field = lambda i: 'kT=%s, E=%s' % (u.repr(i.kT*u.erg,'eV'), u.repr(i.integrate(e_weight=1),'eV*cm^-3'))
    print 'Photon Fields:'
    for k,v in kwargs.items():
        print '\t%s: %s' % (k,plot_field(v))
    P.loglog(energy, cmb, color='blue', label='CMB', **plot_kwargs)
    P.loglog(energy, optical, color='green', label='optical', **plot_kwargs)

    P.loglog(energy, infrared + cmb + optical, color='black', label='total', **plot_kwargs)

    axes = P.gca()


    # now, overlay estimated quantities
    plot_kwargs = dict(axes=axes, x_units_string = 'eV', y_units_string='ph/cm^3/eV', dashes=[5,2])

    infrared_est = isrf.estimate_infrared(**kwargs)
    infrared_est.loglog(color='red', **plot_kwargs)

    CMB_est = isrf.estimate_CMB(**kwargs)
    CMB_est.loglog(color='blue', **plot_kwargs)
    print 'CMB kT',u.repr(CMB_est.kT*u.erg/u.boltzmann,'kelvin')

    optical_est = isrf.estimate_optical(**kwargs)
    optical_est.loglog(color='green', **plot_kwargs)

    total = CompositeSpectrum(infrared_est, CMB_est, optical_est)
    total.loglog(color='black', **plot_kwargs)

    P.legend(loc=3)

    P.xlabel('energy (eV)')
    P.ylabel('intensity (ph/cm^3/eV)')

    P.savefig('estimate_fields.pdf')
Example #3
0
             label='total',
             **plot_kwargs)

    axes = P.gca()

    # now, overlay estimated quantities
    plot_kwargs = dict(axes=axes,
                       x_units_string='eV',
                       y_units_string='ph/cm^3/eV',
                       dashes=[5, 2])

    infrared_est = isrf.estimate_infrared(**kwargs)
    infrared_est.loglog(color='red', **plot_kwargs)

    CMB_est = isrf.estimate_CMB(**kwargs)
    CMB_est.loglog(color='blue', **plot_kwargs)
    print 'CMB kT', u.repr(CMB_est.kT * u.erg / u.boltzmann, 'kelvin')

    optical_est = isrf.estimate_optical(**kwargs)
    optical_est.loglog(color='green', **plot_kwargs)

    total = CompositeSpectrum(infrared_est, CMB_est, optical_est)
    total.loglog(color='black', **plot_kwargs)

    P.legend(loc=3)

    P.xlabel('energy (eV)')
    P.ylabel('intensity (ph/cm^3/eV)')

    P.savefig('estimate_fields.pdf')