def paircount_data_random(datara,datadec,dataz,randomra,randomdec,randomz,cosmo_model,rmin,rmax,nbins,nproc=None,log=None,file=None,wdata=None,wrandom=None): """ r,dd,rr,dr=paircount_data_random(datara,datadec,dataz,randomra,randomdec,randomz,cosmo,rmin,rmax,nbins,log=None,file=None,wdata=None,wrandom=None) Returns the R,DD,RR,DR for a given set of data and random and a given cosmology """ # calculate proper distance for each object (data and random) pi=np.pi params=cosmo_model[0:4] h=cosmo_model[4] rdata=cosmology.get_dist(dataz,type='prop',params=params,h=h)*1000*h thdata=(90-datadec)*pi/180 phdata=datara*pi/180 rrandom=cosmology.get_dist(randomz,type='prop',params=params,h=h)*1000*h thrandom=(90-randomdec)*pi/180 phrandom=randomra*pi/180 # Count pairs r,dd,rr,dr=get_pairs(rdata,thdata,phdata,rrandom,thrandom,phrandom,rmin,rmax,nbins,nproc=nproc,log=log,wdata=wdata,wrandom=wrandom) # Write to file if required if file is not None: outfile=open(file,'w') outfile.write("Ng=%s Nr=%s \n" % (np.size(datara), np.size(randomra))) for xr,xdd,xrr,xdr in zip(r,dd,rr,dr): outfile.write("%s %s %s %s\n" % (xr,xdd,xrr,xdr)) outfile.close() # return result return(r,dd,rr,dr)
def paircount_data_random(datara, datadec, dataz, randomra, randomdec, randomz, cosmo_model, rmin, rmax, nbins, nproc=None, log=None, file=None, wdata=None, wrandom=None): """ r,dd,rr,dr=paircount_data_random(datara,datadec,dataz,randomra,randomdec,randomz,cosmo,rmin,rmax,nbins,log=None,file=None,wdata=None,wrandom=None) Returns the R,DD,RR,DR for a given set of data and random and a given cosmology """ # calculate proper distance for each object (data and random) pi = np.pi params = cosmo_model[0:4] h = cosmo_model[4] rdata = cosmology.get_dist(dataz, type='prop', params=params, h=h) * 1000 * h thdata = (90 - datadec) * pi / 180 phdata = datara * pi / 180 rrandom = cosmology.get_dist(randomz, type='prop', params=params, h=h) * 1000 * h thrandom = (90 - randomdec) * pi / 180 phrandom = randomra * pi / 180 # Count pairs r, dd, rr, dr = get_pairs(rdata, thdata, phdata, rrandom, thrandom, phrandom, rmin, rmax, nbins, nproc=nproc, log=log, wdata=wdata, wrandom=wrandom) # Write to file if required if file is not None: outfile = open(file, 'w') outfile.write("Ng=%s Nr=%s \n" % (np.size(datara), np.size(randomra))) for xr, xdd, xrr, xdr in zip(r, dd, rr, dr): outfile.write("%s %s %s %s\n" % (xr, xdd, xrr, xdr)) outfile.close() # return result return (r, dd, rr, dr)
h=0.7 om_global = 0.3 om_region_vide = 0. om_region_dense = ((x1-x0)*om_global - (xe-xs)*om_region_vide) / ((xs-x0) + (x1-xe)) params_region_vide = [om_region_vide,0,-1,0] params_region_dense = [om_region_dense,0,-1,0] params_global = [om_global, 0, -1, 0] nn = 1000 c=3e8 H0=1000*1000*h*100 zz = linspace(0,zmax, nn) hz_region_vide = cosmo.get_dist(zz,type='hz',params=params_region_vide, h=h)/H0 hz_region_dense = cosmo.get_dist(zz,type='hz',params=params_region_dense, h=h)/H0 hz_global = cosmo.get_dist(zz,type='hz',params=params_global, h=h)/H0 dp_region_vide = cosmo.get_dist(zz,type=dist_type,params=params_region_vide, h=h) dp_region_dense = cosmo.get_dist(zz,type=dist_type,params=params_region_dense, h=h) dp_global = cosmo.get_dist(zz,type=dist_type,params=params_global, h=h) clf() subplot(1,2,1) plot(zz,hz_global,'b',label='$\Omega_m = {0:4.2f}$'.format(om_global)) plot(zz,hz_region_vide,'r',label='$\Omega_m = {0:4.2f}$'.format(om_region_vide)) plot(zz,hz_region_dense,'g',label='$\Omega_m = {0:4.2f}$'.format(om_region_dense)) xlabel('z') ylabel('H(z)') legend(loc='upper left') subplot(1,2,2) plot(zz,dp_global,'b')