Skip to content

vvinuv/kappabias

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This contains some utilities to estimate bias based on Amara 2011 et al.

INSTALL
--------
python setup.py install --prefix=/home/vinu/software/python_libs_vinu/

USAGE
-----------------
This can be run two ways. 1. from python interpreter 2. using script

Lets say we have a fits file (Mice.fits) contains the following columns  
RA, DEC, 'Z', KAPPA, GAMMA1, GAMMA2, then the program should be run as follows. 

1. In python interpreter
-------------------------

>>> from numpy import nan_to_num
>>> import bias.kappa_amara as kk
>>> k = kk.KappaAmara('.', 'Mice.fits', 'Mice.fits', '.', 4., zs=1., zmin_s=0.5, zmax_s=1.0, zmin_g=0.2, zmax_g=0.9)
>>> k.delta_rho_3d(200, 200, 20)
>>> k.true_values(g_to_k=False, e_sign = [1,-1], col_names=['RA', 'DEC', 'Z', 'GAMMA1', 'GAMMA2', '', '', ''])
>>> k.kappa_predicted()
>>> k.gamma_predicted()
>>> kk.linear_bias_kappa(k.kappa_true[10:-10,10:-10], k.kappa_pred[10:-10,10:-10])
>>> mask = k.mask[10:-10,10:-10]

>>> g1p = k.gamma_p[10:-10,10:-10].real
>>> g2p = k.gamma_p[10:-10,10:-10].imag
>>> g1t = k.gamma1_true[10:-10,10:-10]
>>> g2t = -k.gamma2_true[10:-10,10:-10]
>>> m = mask.ravel().astype(bool)
>>> g1t = nan_to_num(g1t).ravel()[m]
>>> g2t = nan_to_num(g2t).ravel()[m]
>>> g1p = nan_to_num(g1p).ravel()[m]
>>> g2p = nan_to_num(g2p).ravel()[m]
>>> b = kk.BiasModeling(g1t, g2t, g1p, g2p, bias_model='linear', do_plot=False, sigma=5, bin_no=50, boot_real=20)

2. Using script
-----------------

You will find run_mice_bcc.py in scripts/ directory, which does the same thing. All the parameter values should be set in scripts/config.py. Descriptions of these parameters are also included as comments


The details of the package are below
------------------------------------
kappa_amara.py - a class which returns 1. kappa map from input shear or true value from the simulation 2. gamma field from galaxy kappa map or the input simulated shear  

It has the following input parameters 
ipath - path to input files
shearfile - input shear catalog which has the following input columns 'RA', 'DEC', 'z', 'E1', 'E2' 
galaxyfile - input galaxy catalog which has the columns 'RA', 'DEC', z
opath - output path
smooth - smoothing scale in arcmin
zs - Source redshift
zmin_s, zmax_s - Minimum and maximum redshift of the galaxies to be included in the shear estimate
zmin_g, zmax_g - Minimum and maximum redshift of the galaxies to estimate galaxy density fluctuation

It also has the following member functions with input parameters

delta_rho_3d(bin_ra, bin_dec, bin_z)
bin_ra, bin_dec, bin_z are the number of bins in ra, dec and z directions, if it is just a number. If it those array then it will be treated as bins 

true_values(g_to_k=False, e_sign = [-1, -1], col_names=['RA', 'DEC', 'z', 'E1', 'E2', 'W', 'SN', 'Re'])

g_to_k = True means that the true kappa will be estimated from  gamma
e_sign - the sign to multiply gamma1 and gamma2
col_names = column names in the input shear file. 

 
kappa_utils.py - This has some utility functions for kappa_amara.py

A script to estimate the bias as a function of scale is attached which uses these tools. It will be easier to understand how to use the class. Please mail me if you find some problems (vvinuv@gmail.com)

 


About

Bias estimation from shear and galaxy distribution

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages