Esempio n. 1
0
 def test_error_when_linemax_invalid(self):
     """Check errors are thrown in line max<2 or >5"""
     pars={}
     
     pars["lineNumStop"] = 1
     self.assertRaises(ValueError, lambda: igmModel.MadauIGM(pars))
     
     pars["lineNumStop"] = 6
     self.assertRaises(ValueError, lambda: igmModel.MadauIGM(pars))
Esempio n. 2
0
 def test_error_thrown_negative_lam(self):
     """Check error is thrown when negative wavelength supplied"""
     
     m = igmModel.MadauIGM()
     lam = -3.5e-7
     z = 1.
     self.assertRaises(ValueError, lambda: m.getObserverFrameTransmission(lam, z))
Esempio n. 3
0
 def test_tranmission_always_0_to_1(self):
     """Check transmission always between zero and 1 for decent range of variables"""
     
     for line in range(2,6):
         for lam in range(1,1000000,1000):
             for z in range(0,10,1):
                 
                 pars={}
                 pars["lineNumStop"] = line
                 m = igmModel.MadauIGM(pars)
                 
                 lam *= 1e-10 # convert from A to m
                 t = m.getObserverFrameTransmission(lam, z)
                 self.assertTrue(t>=0 and t<=1)
Esempio n. 4
0
"""Example script to plot Madau IGM absorption model

   Compare plot to Figure 3 in Madau 1995

"""
import igmModel
import numpy as np
import matplotlib.pyplot as plt

d = {}
d["lineNumStop"] = 5  # max number of Lyman lines to account for
d["doLyCont"] = True  # turn on/off Lyman continuum contribution
madauIGM = igmModel.MadauIGM(d)

# custom instance printing
print madauIGM

# source galaxy redshifts to compute IGM stransmission for
z1 = 2.5
z2 = 3.5
z3 = 4.5

# observed wavelengths to compute end IGM transission at
# angstroms
lamMin = 2000.
lamMax = 8000.
nLam = 1000
dLam = (lamMax - lamMin) / (nLam - 1.)

wavelengths = []
madau = np.zeros([nLam, 3])