return t1 * t2 def fn_get_A_tSZ(nu, nu_ref = 150e9): ysz_Tsz_conv_fac_ref = compton_y_to_delta_Tcmb(nu_ref) ysz_Tsz_conv_fac = compton_y_to_delta_Tcmb(nu) return ysz_Tsz_conv_fac/ysz_Tsz_conv_fac_ref import numpy as np import modules.scl_cmb as scl_cmb import scipy as sc from pylab import * sims = scl_cmb.simulations() h=6.62607004e-34 #Planck constant in m2 kg / s k_B=1.38064852e-23 #Boltzmann constant in m2 kg s-2 / K-1 Tcmb = 2.73 #Kelvin #pol = 1 which_exp = sys.argv[1]#'act' pol = int(sys.argv[2]) print '\n\tExp = %s; Pol = %s\n' %(which_exp, pol) if which_exp == 'spt': nuarr = [90e9,150e9, 220e9] #noisearr = [3,2,4] noisearr = [4.5,2.5,4.5]
""" input: takes in mass(in 1e14 solar mass), redshift of a cluster, and params file output: lensing convergence profile in output.pkl.gz ex: python PC_kappa_gen.py 2 0.7 """ import modules.scl_cmb as scl_cmb, sys import numpy as np, pickle, gzip clus_mass = float(sys.argv[1]) * 1e14 clus_redshift = float(sys.argv[2]) sims = scl_cmb.simulations() # read the params file paramfile = 'params/params.txt' params = np.recfromtxt(paramfile, usecols=[0], delimiter='=') paramvals = np.recfromtxt(paramfile, usecols=[1], delimiter='=') param_dict = {} for p, pval in zip(params, paramvals): tmp = pval.strip() try: float(tmp) if tmp.find('.') > -1: param_dict[p.strip()] = float(tmp) else: param_dict[p.strip()] = int(tmp) except: if tmp == 'None':
y_ip = fitting_func(p1,p1,x_ip, cluster_mass,return_fit = 1) linds, uinds = np.where(x_ip<=cluster_mass)[0], np.where(x_ip>=cluster_mass)[0] value_for_error = 1. interp_type = 'linear' fninterp = interp1d(y_ip[linds], x_ip[linds], kind = interp_type, bounds_error = 0, fill_value = 0.) l_err = fninterp(value_for_error) fninterp = interp1d(y_ip[uinds], x_ip[uinds], kind = interp_type, bounds_error = 0, fill_value = 0.) u_err = fninterp(value_for_error) width = (u_err - l_err)/2. if width == 0: width = default_width return width sims = scl.simulations() sims.tqulen = 1 ipfolder = sys.argv[1] noofsims = int(sys.argv[2]) minrich = float(sys.argv[3]) maxrich = float(sys.argv[4]) # Covariance matrix calculation files = sorted(glob.glob('%s/st*'%(ipfolder))) cov_file = '%s/kappa_COV_%s_simsJK.pkl.gz' %(ipfolder,noofsims) data_for_cov = pickle.load(gzip.open(files[0])) boxsize = data_for_cov['param_dict']['boxsize'] dx,dy = data_for_cov['param_dict']['reso_arcmin'],data_for_cov['param_dict']['reso_arcmin'] nx,ny = int(boxsize/dx), int(boxsize/dy)