In [14]:
from bigmali.grid import Grid
from bigmali.prior import MassPrior, TinkerPrior

In [15]:
g = Grid()
tp = TinkerPrior(g)

In [16]:
g.redshifts


Out[16]:
array([ 0.        ,  0.18421053,  0.36842105,  0.55263158,  0.73684211,
        0.92105263,  1.10526316,  1.28947368,  1.47368421,  1.65789474,
        1.84210526,  2.02631579,  2.21052632,  2.39473684,  2.57894737,
        2.76315789,  2.94736842,  3.13157895,  3.31578947,  3.5       ])

In [22]:
z = g.redshifts[2]
print z


0.368421052632

In [23]:
masses = tp.fetch(z).rvs(10)
print masses


[  1.27517403e+10   6.57014442e+10   1.28729220e+10   1.64031814e+10
   1.45682529e+10   2.81852896e+10   4.27987219e+10   1.81146280e+10
   2.94432191e+10   1.25655630e+10]

In [24]:
tp.pdf(masses, z)


Out[24]:
array([  6.87659445e-11,   3.12520296e-12,   6.75313231e-11,
         4.27707713e-11,   5.34858292e-11,   1.54085104e-11,
         7.01332485e-12,   3.54620626e-11,   1.41915870e-11,
         4.08566844e-11])

In [25]:
masses = tp.fetch(z).rvs(10)
print masses


[  1.25655630e+10   3.71010919e+10   2.02765244e+10   1.27606744e+10
   1.97899980e+10   1.39379240e+10   1.56501794e+10   2.31781364e+10
   4.02230166e+10   2.56033315e+10]

In [36]:
tp.pdf(masses, 3.5)


Out[36]:
array([  2.45650104e-11,   9.20683340e-12,   3.37791559e-11,
         8.97423486e-11,   3.55705920e-11,   7.45804349e-11,
         5.84480278e-11,   2.54090818e-11,   7.72317284e-12,
         2.05261379e-11])

In [35]:
for i in masses:
    print str(i) + ","


12565562999.1,
37101091908.6,
20276524417.6,
12760674392.2,
19789997964.2,
13937924000.6,
15650179359.0,
23178136425.8,
40223016628.0,
25603331470.3,

In [28]:
tp.pdf(2e16, z)


Out[28]:
9.9999999996464585e-31

In [29]:
tp.pdf(1e10, z)


Out[29]:
9.9999999996464585e-31

In [30]:
tp.pdf(masses, 0)


Out[30]:
array([  1.85127005e-11,   9.14599233e-12,   2.84245212e-11,
         6.78511542e-11,   2.97522822e-11,   5.74805191e-11,
         4.62351919e-11,   2.21196030e-11,   7.86394057e-12,
         1.83449747e-11])

In [31]:
tp.pdf(masses, 0.184210526316)


Out[31]:
array([  1.87392139e-11,   9.17723477e-12,   2.86713804e-11,
         6.86742124e-11,   3.00164027e-11,   5.81420366e-11,
         4.67284339e-11,   2.22877359e-11,   7.88467537e-12,
         1.84690623e-11])

In [52]:
import numpy as np
np.mean(tp.rvs(0, 10**6))


Out[52]:
26319725239.705513

In [ ]: