Examples for the CUBA Class (v1.0)

Designed to work with the CUBA output from Haardt & Madau

# import
# imports
try:
    import seaborn as sns; sns.set_style("white")
except:
    pass

from pyigm.euvb import cuba as pycuba # Location may move
/Users/xavier/anaconda/lib/python2.7/site-packages/matplotlib/__init__.py:872: UserWarning: axes.color_cycle is deprecated and replaced with axes.prop_cycle; please use the latter.
  warnings.warn(self.msg_depr % (key, alt_key))

Initialize

reload(pycuba)
cuba = pycuba.CUBA()
cuba
read_cuba: Using CUBA file -- /Users/xavier/local/Python/pyigm/pyigm/data/euvb/cuba_uvbapr2011_q1g01.hiz.out
[CUBA: cuba_file=/Users/xavier/local/Python/pyigm/pyigm/data/euvb/cuba_uvbapr2011_q1g01.hiz.out]

Data in Attributes

# Redshifts
cuba.z[0:10]
array([ 0.     ,  0.04912,  0.1006 ,  0.1547 ,  0.2114 ,  0.2709 ,
        0.3333 ,  0.3988 ,  0.4675 ,  0.5396 ])
# Wavelengths
cuba.wave[0:10]
\[[1155000,~1101000,~1050000,~1000000,~953600,~908900,~866400,~825800,~787100,~750300] \; \mathrm{\mathring{A}}\]
# Jnu
cuba.Jnu[0:10,0]
\[[1.054 \times 10^{-20},~1.035 \times 10^{-20},~1.017 \times 10^{-20},~1 \times 10^{-20},~9.83 \times 10^{-21},~9.666 \times 10^{-21},~9.508 \times 10^{-21},~9.355 \times 10^{-21},~9.207 \times 10^{-21},~9.065 \times 10^{-21}] \; \mathrm{\frac{erg}{s\,cm^{2}}}\]

Quick Plot

%matplotlib inline
cuba.plot(2.1,xlim=(0.1,10))
_images/CUBA_examples_10_0.png

Interpolate on redshift

jnu = cuba.zinterp_jnu(2.1)
jnu[0:5]
\[[1.3653469 \times 10^{-19},~1.3393469 \times 10^{-19},~1.3139388 \times 10^{-19},~1.2889388 \times 10^{-19},~1.2649388 \times 10^{-19}] \; \mathrm{\frac{erg}{s\,cm^{2}}}\]

Phi (Photon flux)

phi = cuba.phi(2.1)#,min_energy=50*u.eV)
print('Ionizing flux = {:g}'.format(phi))
cuba.phi: Assuming minimum energy = 13.6057 eV
Ionizing flux = 95459.4 1 / (cm2 s)

Matches JFH IDL code to 1%

print(phi)
95459.3988508 1 / (cm2 s)