There's been various concerns about the SHAMs I've made being done correctly. I'm going to take a look at the clustering of them all in the same notebook for easy comparison.


In [1]:
import numpy as np
import astropy
from halotools.mock_observables import tpcf

In [2]:
from matplotlib import pyplot as plt
%matplotlib inline
import seaborn as sns
sns.set()

In [3]:
%%bash
ls ../../bin/shams/*.npy


../../bin/shams/catalog_ab_halo_mpeak_catalog_cen_hod.npy
../../bin/shams/catalog_ab_halo_mpeak_catalog_sat_hod.npy
../../bin/shams/catalog_ab_halo_mpeak_shuffled_cen_hod.npy
../../bin/shams/catalog_ab_halo_mpeak_shuffled_sat_hod.npy
../../bin/shams/catalog_ab_halo_vmax@mpeak_catalog_cen_hod.npy
../../bin/shams/catalog_ab_halo_vmax@mpeak_catalog_sat_hod.npy
../../bin/shams/ds_mass_bins.npy

In [4]:
import h5py
f = h5py.File('/home/users/swmclau2/scratch/catalog_ab_halo_mpeak_shuffled.hdf5', 'r')
print f.keys()
f.close()


[u'halo_mpeak_shuffled']

In [5]:
simname = 'darksky'

if simname == 'darksky':
    vpeak_cat = astropy.table.Table.read('/home/users/swmclau2/scratch/catalog_ab_halo_vmax@mpeak.hdf5', format = 'hdf5',\
                                        path = 'halo_vmax@mpeak_catalog')
    mpeak_cat = astropy.table.Table.read('/home/users/swmclau2/scratch/catalog_ab_halo_mpeak.hdf5', format = 'hdf5',\
                                         path = 'halo_mpeak_catalog')
    shuffled_cat = astropy.table.Table.read('/home/users/swmclau2/scratch/catalog_ab_halo_mpeak_shuffled.hdf5', format = 'hdf5',\
                                           path = 'halo_mpeak_shuffled')

In [6]:
plt.hist(shuffled_cat['gal_smass'])


Out[6]:
(array([  9.18000000e+02,   9.91000000e+02,   5.90000000e+01,
          1.13500000e+03,   2.91800000e+03,   5.94800000e+03,
          1.80710000e+04,   5.95980000e+04,   1.14033000e+05,
          2.16329000e+05]),
 array([ 10.00875948,  10.11532879,  10.22189809,  10.3284674 ,
         10.43503671,  10.54160601,  10.64817532,  10.75474463,
         10.86131394,  10.96788324,  11.07445255]),
 <a list of 10 Patch objects>)

In [7]:
plt.hist(vpeak_cat['gal_smass'])


Out[7]:
(array([  9.18000000e+02,   9.91000000e+02,   5.90000000e+01,
          1.13500000e+03,   2.91800000e+03,   5.94800000e+03,
          1.80710000e+04,   5.95980000e+04,   1.14033000e+05,
          2.16329000e+05]),
 array([ 10.00875948,  10.11532879,  10.22189809,  10.3284674 ,
         10.43503671,  10.54160601,  10.64817532,  10.75474463,
         10.86131394,  10.96788324,  11.07445255]),
 <a list of 10 Patch objects>)

In [8]:
rbins = np.logspace(-1, 1.5, 15)
rpoints = (rbins[1:]+rbins[:-1])/2

In [9]:
pos = np.c_[vpeak_cat['halo_x'], vpeak_cat['halo_y'],vpeak_cat['halo_z']]
vpeak_xi = tpcf(pos, rbins, period=1000.0)

In [10]:
pos = np.c_[mpeak_cat['halo_x'], mpeak_cat['halo_y'],mpeak_cat['halo_z']]
mpeak_xi = tpcf(pos, rbins, period=1000.0)

In [11]:
pos = np.c_[shuffled_cat['halo_x'], shuffled_cat['halo_y'],shuffled_cat['halo_z']]
shuffled_xi = tpcf(pos, rbins, period=1000.0)
pos = np.c_[halocat.halo_table['halo_x'], halocat.halo_table['halo_y'],halocat.halo_table['halo_z']] rand_idxs = np.random.choice(pos.shape[0], len(final_catalog)*2) halo_xi = tpcf(pos, rbins, period=1000.0)

In [12]:
plt.plot(rpoints, vpeak_xi, label = 'Vpeak')
plt.plot(rpoints, mpeak_xi, label = 'Mpeak')
plt.plot(rpoints, shuffled_xi, label = 'Shuffled')

plt.loglog();
plt.legend(loc='best')
plt.xlabel('r [Mpc]')
plt.ylabel('xi')


Out[12]:
<matplotlib.text.Text at 0x7fa726d4a1d0>

In [13]:
plt.plot(rpoints, vpeak_xi/shuffled_xi, label = 'Vpeak/Shuffled')
plt.plot(rpoints, mpeak_xi/shuffled_xi, label = 'Mpeak/Shuffled')

plt.xscale('log');
plt.legend(loc='best')
plt.xlabel('r [Mpc]')
plt.ylabel('xi')


Out[13]:
<matplotlib.text.Text at 0x7fa726a0abd0>

In [14]:
%%bash
ls /home/users/swmclau2/Git/pearce/bin/shams/catalog*.npy -ltr


-rw-r--r-- 1 swmclau2 kipac 675 Apr 10 02:23 /home/users/swmclau2/Git/pearce/bin/shams/catalog_ab_halo_mpeak_shuffled_cen_hod.npy
-rw-r--r-- 1 swmclau2 kipac 675 Apr 10 02:23 /home/users/swmclau2/Git/pearce/bin/shams/catalog_ab_halo_mpeak_shuffled_sat_hod.npy
-rw-r--r-- 1 swmclau2 kipac 675 Apr 10 03:01 /home/users/swmclau2/Git/pearce/bin/shams/catalog_ab_halo_vmax@mpeak_catalog_cen_hod.npy
-rw-r--r-- 1 swmclau2 kipac 675 Apr 10 03:01 /home/users/swmclau2/Git/pearce/bin/shams/catalog_ab_halo_vmax@mpeak_catalog_sat_hod.npy
-rw-r--r-- 1 swmclau2 kipac 675 Apr 10 03:40 /home/users/swmclau2/Git/pearce/bin/shams/catalog_ab_halo_mpeak_catalog_cen_hod.npy
-rw-r--r-- 1 swmclau2 kipac 675 Apr 10 03:40 /home/users/swmclau2/Git/pearce/bin/shams/catalog_ab_halo_mpeak_catalog_sat_hod.npy
from math import ceil def compute_mass_bins(prim_haloprop, dlog10_prim_haloprop=0.05): lg10_min_prim_haloprop = np.log10(np.min(prim_haloprop))-0.001 lg10_max_prim_haloprop = np.log10(np.max(prim_haloprop))+0.001 num_prim_haloprop_bins = (lg10_max_prim_haloprop-lg10_min_prim_haloprop)/dlog10_prim_haloprop return np.logspace( lg10_min_prim_haloprop, lg10_max_prim_haloprop, num=int(ceil(num_prim_haloprop_bins)))

In [15]:
#scratch_path = '/home/users/swmclau2/scratch/'
#halo_catalog  = astropy.table.Table.read(scratch_path+'catalog_ab_%s_large.hdf5'%('halo_mpeak'), format = 'hdf5')
#mass_bins = compute_mass_bins(halo_catalog['halo_mvir'], 0.2)
mass_bins = np.loadtxt('ds_mass_bins.npy')
mass_bin_centers = (mass_bins[1:]+mass_bins[:-1])/2.0

In [16]:
hod_dict = {}
for catname in ['mpeak_catalog', 'vmax@mpeak_catalog', 'mpeak_shuffled']:
    hod_dict[catname] = {}
    for hodname in ['cen', 'sat']:
        hod_dict[catname][hodname] = np.loadtxt('/home/users/swmclau2/Git/pearce/bin/shams/catalog_ab_halo_%s_%s_hod.npy'%(catname, hodname))

In [17]:
type = 'cen'
for name, type_dict in hod_dict.iteritems():
    plt.plot(mass_bin_centers, type_dict[type], label = name)
    
plt.legend(loc = 'best')
plt.xscale('log')
plt.show()



In [18]:
hod_dict['mpeak_shuffled']['cen']


Out[18]:
array([  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   3.05071695e-07,   3.09166877e-07,
         7.49596483e-07,   5.61647297e-07,   1.03833549e-06,
         1.61424483e-06,   4.61998492e-06,   2.74404039e-05,
         1.62815554e-04,   1.33036591e-03,   9.42293290e-02,
         3.90308408e-01,   5.14061299e-01,   5.68296490e-01,
         6.21671892e-01,   6.67102425e-01,   7.19937020e-01,
         8.21621622e-01,   9.76377953e-01,   9.91718427e-01,
         1.00000000e+00,   9.85294118e-01,   1.00000000e+00])

In [19]:
type = 'sat'
for name, type_dict in hod_dict.iteritems():
    plt.plot(mass_bin_centers, type_dict[type], label = name)
    
plt.legend(loc = 'best')
plt.loglog()
plt.show()



In [20]:
for name, type_dict in hod_dict.iteritems():
    plt.plot(mass_bin_centers, type_dict['cen']+type_dict['sat'], label = name)
    
plt.legend(loc = 'best')
plt.loglog()
#plt.xscale('log')
plt.show()



In [ ]: