Examples for the CUBA Class

Designed to work with the CUBA output from Haardt & Madau


In [1]:
# import
from xastropy.igm import cuba as xcuba # Location may move


-----------------------------------------------------------
-----------------------------------------------------------
WARNING: Not loading model in xastropy.fN   
 Install pymc if you want it
-----------------------------------------------------------
/Users/xavier/anaconda/lib/python2.7/site-packages/astroquery/sdss/__init__.py:33: UserWarning: Experimental: SDSS has not yet been refactored to have its API match the rest of astroquery (but it's nearly there).
  warnings.warn("Experimental: SDSS has not yet been refactored to have its API "

Initialize


In [104]:
reload(xcuba)
cuba = xcuba.CUBA()
cuba


read_cuba: Using CUBA file -- /Users/xavier/local/Python/xastropy/xastropy/data/quasar/cuba_uvbapr2011_q1g01.hiz.out
Out[104]:
[CUBA: cuba_file=/Users/xavier/local/Python/xastropy/xastropy/data/quasar/cuba_uvbapr2011_q1g01.hiz.out]

Data in Attributes


In [59]:
# Redshifts
cuba.z[0:10]


Out[59]:
array([ 0.     ,  0.04912,  0.1006 ,  0.1547 ,  0.2114 ,  0.2709 ,
        0.3333 ,  0.3988 ,  0.4675 ,  0.5396 ])

In [60]:
# Wavelengths
cuba.wave[0:10]


Out[60]:
$[0.0002481,~0.001489,~0.001562,~0.001639,~0.00172,~0.001804,~0.001893,~0.001986,~0.002083,~0.002186] \; \mathrm{\mathring{A}}$

In [61]:
# Jnu
cuba.Jnu[0:10,0]


Out[61]:
$[1.196 \times 10^{-33},~1.424 \times 10^{-32},~1.535 \times 10^{-32},~1.655 \times 10^{-32},~1.785 \times 10^{-32},~1.924 \times 10^{-32},~2.075 \times 10^{-32},~2.237 \times 10^{-32},~2.412 \times 10^{-32},~2.6 \times 10^{-32}] \; \mathrm{\frac{erg}{s\,cm^{2}}}$

Quick Plot


In [62]:
%matplotlib inline

In [107]:
cuba.plot(2.1,xlim=(0.1,10))


Interpolate on redshift


In [113]:
jnu = cuba.zinterp_jnu(2.1)
jnu[0:5]


Out[113]:
$[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)


In [119]:
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%


In [118]:
print(phi)


8171.47189724 1 / (cm2 s)

In [ ]: