16 #define NORMPS 2.215e-9 29 void print_params(
int l_limber,
const char *fname_params,
const char *prefix_out)
31 FILE *fl=fopen(fname_params,
"w");
32 fprintf(fl,
"omega_m= %lf\n",
OC+
OB);
33 fprintf(fl,
"omega_l= %lf\n",1-
OC-
OB);
34 fprintf(fl,
"omega_b= %lf\n",
OB);
35 fprintf(fl,
"w0= %lf\n",
W0);
36 fprintf(fl,
"wa= %lf\n",
WA);
37 fprintf(fl,
"h= %lf\n",
HH);
38 fprintf(fl,
"ns= %lf\n",
NS);
39 fprintf(fl,
"s8= %lf\n",
NORMPS);
40 fprintf(fl,
"l_limber_min= %d\n",l_limber);
41 fprintf(fl,
"d_chi= 3.\n");
42 fprintf(fl,
"z_kappa= 20.\n");
43 fprintf(fl,
"z_isw= 20.\n");
44 fprintf(fl,
"l_max= %d\n",
NL);
45 fprintf(fl,
"do_nc= 1\n");
46 fprintf(fl,
"has_nc_dens= 1\n");
47 fprintf(fl,
"has_nc_rsd= 0\n");
48 fprintf(fl,
"has_nc_lensing= 0\n");
49 fprintf(fl,
"do_shear= 0\n");
50 fprintf(fl,
"has_sh_intrinsic= 0\n");
51 fprintf(fl,
"do_cmblens= 0\n");
52 fprintf(fl,
"do_isw= 0\n");
53 fprintf(fl,
"do_w_theta= 0\n");
54 fprintf(fl,
"use_logbin= 0\n");
55 fprintf(fl,
"theta_min= 0\n");
56 fprintf(fl,
"theta_max= 0\n");
57 fprintf(fl,
"n_bins_theta= 0\n");
58 fprintf(fl,
"n_bins_decade= 0\n");
59 fprintf(fl,
"window_1_fname= nz.txt\n");
60 fprintf(fl,
"window_2_fname= nz.txt\n");
61 fprintf(fl,
"bias_fname= bz.txt\n");
62 fprintf(fl,
"sbias_fname= nothing\n");
63 fprintf(fl,
"abias_fname= nothing\n");
64 fprintf(fl,
"pk_fname= pk.txt\n");
65 fprintf(fl,
"prefix_out= %s\n",prefix_out);
84 ccl_parameters params =
ccl_parameters_create(
OC,
OB,
OK,
NEFF, MNU, MNUTYPE,
W0,
WA,
HH,
NORMPS,
NS,-1,-1,-1,-1,NULL,NULL, &status);
90 FILE *fn=fopen(
"nz.txt",
"w");
91 FILE *fb=fopen(
"bz.txt",
"w");
92 double z_arr_gc[
NZ],nz_arr_gc[
NZ],bz_arr[
NZ];
93 double z1_arr_gc[
NZ],nz1_arr_gc[
NZ],bz1_arr[
NZ];
94 for(
int i=0;i<
NZ;i++) {
100 fprintf(fn,
"%lE %lE\n",z_arr_gc[i],nz_arr_gc[i]);
101 fprintf(fb,
"%lE %lE\n",z_arr_gc[i],bz_arr[i]);
106 FILE *fp=fopen(
"pk.txt",
"w");
107 for(
int i=0;i<1024;i++) {
108 double lk=-4.+5*(i+0.5)/1024.;
109 double kk=
pow(10.,lk);
111 fprintf(fp,
"%lE %lE\n",kk,pk);
115 print_params(-1,
"params_lj_limber.ini",
"out_lj_limber");
120 NZ,z_arr_gc,bz_arr,-1,NULL,NULL,&status);
122 NZ,z_arr_gc,bz_arr,-1,NULL,NULL,&status);
124 double cells_gg_angpow[
NL];
125 double cells_gg_native[
NL];
126 double cells_gg_limber[
NL];
127 for(
int ii=0;ii<
NL;ii++)
131 double logstep = 1.3;
135 CCL_ClWorkspace *wyl=ccl_cl_workspace_default(NL+1,-1 ,CCL_NONLIMBER_METHOD_ANGPOW,logstep,linstep,dchi,dlk,zmin,&status);
136 CCL_ClWorkspace *wnl=ccl_cl_workspace_default(NL+1,2*ells[NL-1],CCL_NONLIMBER_METHOD_NATIVE,logstep,linstep,dchi,dlk,zmin,&status);
137 CCL_ClWorkspace *wap=ccl_cl_workspace_default(NL+1,2*ells[NL-1],CCL_NONLIMBER_METHOD_ANGPOW,logstep,linstep,dchi,dlk,zmin,&status);
138 double start = clock();
139 ccl_angular_cls(cosmo,wyl,ct_gc_A,ct_gc_A,NL,ells,cells_gg_limber,&status);
140 double end = clock();
141 printf(
"Limber: %.6f seconds\n", (end-start)/CLOCKS_PER_SEC);
143 ccl_angular_cls(cosmo,wnl,ct_gc_B,ct_gc_B,NL,ells,cells_gg_native,&status);
145 printf(
"Native: %.6f seconds\n", (end-start)/CLOCKS_PER_SEC);
147 ccl_angular_cls(cosmo,wap,ct_gc_A,ct_gc_A,NL,ells,cells_gg_angpow,&status);
149 printf(
"Angpow: %.6f seconds\n", (end-start)/CLOCKS_PER_SEC);
152 FILE *fo=fopen(
"cls_val.txt",
"w");
153 for(
int ii=0;ii<
NL;ii++) {
154 double cl_gg_yl=cells_gg_limber[ii];
155 double cl_gg_nl=cells_gg_native[ii];
156 double cl_gg_ap=cells_gg_angpow[ii];
157 fprintf(fo,
"%d %lE %lE %lE\n",ells[ii],cl_gg_yl,cl_gg_nl,cl_gg_ap);
matter_power_spectrum_t matter_power_spectrum_method
double ccl_nonlin_matter_power(ccl_cosmology *cosmo, double k, double a, int *status)
void ccl_cl_tracer_free(CCL_ClTracer *clt)
transfer_function_t transfer_function_method
void ccl_angular_cls(ccl_cosmology *cosmo, CCL_ClWorkspace *w, CCL_ClTracer *clt1, CCL_ClTracer *clt2, int nl_out, int *l, double *cl, int *status)
Grid< NDIM, T > sqrt(Grid< NDIM, T > lhs)
ccl_cosmology * ccl_cosmology_create(ccl_parameters params, ccl_configuration config)
void ccl_cosmology_free(ccl_cosmology *cosmo)
void print_params(int l_limber, const char *fname_params, const char *prefix_out)
int main(int argc, char **argv)
CCL_ClTracer * ccl_cl_tracer_number_counts(ccl_cosmology *cosmo, int has_rsd, int has_magnification, int nz_n, double *z_n, double *n, int nz_b, double *z_b, double *b, int nz_s, double *z_s, double *s, int *status)
const ccl_configuration default_config
float pow(float base, unsigned long int exp)
void ccl_cl_workspace_free(CCL_ClWorkspace *w)
ccl_parameters ccl_parameters_create(double Omega_c, double Omega_b, double Omega_k, double Neff, double *mnu, ccl_mnu_convention mnu_type, double w0, double wa, double h, double norm_pk, double n_s, double bcm_log10Mc, double bcm_etab, double bcm_ks, int nz_mgrowth, double *zarr_mgrowth, double *dfarr_mgrowth, int *status)