In [68]:
%matplotlib inline
import matplotlib.pyplot as plt
from scipy.stats import norm, lognorm
import pandas as pd
import numpy as np
from bigmali.grid import Grid
from bigmali.prior import TinkerPrior
tmp = pd.read_csv('~/Code/PanglossNotebooks/MassLuminosityProject/mock_data.csv')
mass = tmp.mass.as_matrix()
z = tmp.z.as_matrix()
In [69]:
# tmp.drop('mass', axis=1)
np.random.seed(5)
tp = TinkerPrior(Grid())
for i in xrange(len(z)):
mass[i] = tp.fetch(z[i]).rvs()
In [70]:
np.random.seed(0)
alpha1 = norm(10.709, 0.022).rvs()
alpha2 = norm(0.359, 0.009).rvs()
alpha3 = 2.35e14
alpha4 = norm(1.10, 0.06).rvs()
S = norm(0.155, 0.0009).rvs()
sigma_L = 0.05
mu_li = np.exp(alpha1) * ((mass / alpha3) ** (alpha2))* ((1+z) ** (alpha4))
li = lognorm(S, scale=mu_li).rvs()
observed = lognorm(sigma_L, scale=li).rvs()
tmp['lum'] = li
tmp['lum_obs'] = observed
In [71]:
tmp.lum_obs.mean()
Out[71]:
In [75]:
tmp[['z', 'lum_obs']].to_csv('mock_data_prior.txt', sep=' ', header=None, index=False)
In [77]:
! head -n 20 mock_data_prior.txt
In [74]:
! ls
In [79]:
tmp[['z', 'lum_obs', 'mass', 'ra', 'dec']].to_csv('mass_mapping.txt', sep=' ', header=None, index=False)
In [80]:
!head mass_mapping.txt
In [ ]: