My training of AB emus isn't working... going to explore
In [1]:
import matplotlib
#matplotlib.use('Agg')
from matplotlib import pyplot as plt
%matplotlib inline
import seaborn as sns
sns.set()
In [2]:
import numpy as np
from pearce.mocks.kittens import TrainingBox, MDHR
In [3]:
cat = TrainingBox(boxno=0, system = 'ki-ls')
In [4]:
cat.load(1.0, HOD = 'corrZheng07', biased_satellites = True, hod_kwargs={'sec_haloprop_key': 'halo_local_density_10'})
In [5]:
cat.halocat.halo_table.colnames
Out[5]:
In [6]:
cat.model.param_dict
Out[6]:
In [7]:
print cat.model.param_dict.keys()
In [8]:
default_params = cat.model.param_dict
default_params['mean_occupation_centrals_assembias_corr1'] = 0.0
default_params['mean_occupation_satellites_assembias_corr1'] = 0.0
#default_params['mean_occupation_centrals_assembias_split1'] = 0.5
#default_params['mean_occupation_satellites_assembias_split1'] = 0.5
In [9]:
default_params['sigma_logM'] = 0.5
default_params['logMmin'] = 13.5
In [10]:
cat.model.model_dictionary['centrals_occupation'].sec_haloprop_key
Out[10]:
In [11]:
r_bins = np.logspace(-1.1, 1.6, 19)
rbc = (r_bins[1:]+r_bins[:-1])/2.0
In [12]:
#default_y = np.zeros((18,))
#for i in xrange(N):
# print i,
cat.populate(default_params)
default_y= cat.calc_xi(r_bins)
#default_y/=N
In [26]:
N = 10
cmap = sns.color_palette("GnBu_d", N)
In [27]:
pname = 'conc_gal_bias'
l, h = -2, 2
#l, h = 0.0, 1.0
d = default_params.copy()
for v, c in zip(np.logspace(l,h,N), cmap):
d[pname] = v
#y = np.zeros((18,))
#for i in xrange(N):
# print i,
cat.populate(d)
y= cat.calc_xi(r_bins)
print v, (y/default_y)[0]
#y/=N
plt.plot(rbc, y/default_y, label = v, c = c)
plt.xscale('log')
#plt.loglog()
plt.legend(loc = 'best')
plt.show();
In [28]:
d['conc_gal_bias'] = 50.0
In [29]:
cat.populate(d)
In [30]:
sat_cut = cat.model.mock.galaxy_table['gal_type'] == 'satellites'
In [31]:
cat.model.mock.galaxy_table.colnames
Out[31]:
In [32]:
plt.hist(cat.model.mock.galaxy_table[sat_cut]['conc_galaxy']*1.0/cat.model.mock.galaxy_table[sat_cut]['conc_NFWmodel'])
plt.yscale('log')
In [33]:
set(cat.model.mock.galaxy_table['gal_type'])
Out[33]:
In [34]:
cat.model._input_model_dictionary['satellites_profile']._conc_NFWmodel_lookup_table_min,\
cat.model._input_model_dictionary['satellites_profile']._conc_NFWmodel_lookup_table_max
Out[34]:
In [35]:
plt.hist(cat.halocat.halo_table['halo_nfw_conc'][np.isfinite(cat.halocat.halo_table['halo_nfw_conc'])][:1000])
plt.yscale('log')
In [36]:
finite_idxs = np.isfinite(cat.halocat.halo_table['halo_nfw_conc'])
np.sum(cat.halocat.halo_table[finite_idxs]['halo_nfw_conc']>100)*1.0/finite_idxs.shape[0]
Out[36]:
In [37]:
plt.hist(cat.model.mock.galaxy_table['conc_galaxy'])
plt.yscale('log')
In [ ]: