2 #include "../include/ccl_params.h" 10 #define CORR_ERROR_FRACTION 0.1 11 #define ELL_MAX_CL 10000 36 while((fgets(ch,
sizeof(ch),f))!=NULL) {
60 if(!strcmp(compare_type,
"histo")) {
69 double *zarr_1,*pzarr_1,*zarr_2,*pzarr_2,*bzarr,*az1arr,*rz1arr,*az2arr,*rz2arr;
70 if(!strcmp(compare_type,
"analytic")) {
74 FILE *ampz1=fopen(
"./tests/benchmark/codecomp_step2_outputs/cclamparranalytic1nz512nb.txt",
"r");
76 FILE *ampz2=fopen(
"./tests/benchmark/codecomp_step2_outputs/cclamparranalytic2nz512nb.txt",
"r");
79 double zmean_1=1.0,sigz_1=0.15;
80 double zmean_2=1.5,sigz_2=0.15;
82 zarr_1=malloc(nz*
sizeof(
double));
83 pzarr_1=malloc(nz*
sizeof(
double));
84 zarr_2=malloc(nz*
sizeof(
double));
85 pzarr_2=malloc(nz*
sizeof(
double));
86 bzarr=malloc(nz*
sizeof(
double));
87 az1arr=malloc(nz*
sizeof(
double));
88 rz1arr=malloc(nz*
sizeof(
double));
89 az2arr=malloc(nz*
sizeof(
double));
90 rz2arr=malloc(nz*
sizeof(
double));
91 for(ii=0;ii<
nz;ii++) {
92 double zia1,zia2,aia1,aia2;
93 stat = fscanf(ampz1,
"%lf %lf",&zia1,&aia1);
94 stat = fscanf(ampz2,
"%lf %lf",&zia2,&aia2);
99 double z1=zmean_1-5*sigz_1+10*sigz_1*(ii+0.5)/
nz;
100 double z2=zmean_2-5*sigz_2+10*sigz_2*(ii+0.5)/
nz;
101 double pz1=exp(-0.5*((z1-zmean_1)*(z1-zmean_1)/(sigz_1*sigz_1)));
102 double pz2=exp(-0.5*((z2-zmean_2)*(z2-zmean_2)/(sigz_2*sigz_2)));
113 FILE *fnz1=fopen(
"./tests/benchmark/codecomp_step2_outputs/bin1_histo.txt",
"r");
115 FILE *fnz2=fopen(
"./tests/benchmark/codecomp_step2_outputs/bin2_histo.txt",
"r");
117 FILE *ampz1=fopen(
"./tests/benchmark/codecomp_step2_outputs/cclamparrhisto1nznb.txt",
"r");
119 FILE *ampz2=fopen(
"./tests/benchmark/codecomp_step2_outputs/cclamparrhisto2nznb.txt",
"r");
122 zarr_1=malloc(nz*
sizeof(
double));
123 pzarr_1=malloc(nz*
sizeof(
double));
124 zarr_2=malloc(nz*
sizeof(
double));
125 pzarr_2=malloc(nz*
sizeof(
double));
126 bzarr=malloc(nz*
sizeof(
double));
127 az1arr=malloc(nz*
sizeof(
double));
128 rz1arr=malloc(nz*
sizeof(
double));
129 az2arr=malloc(nz*
sizeof(
double));
130 rz2arr=malloc(nz*
sizeof(
double));
131 rtn=fgets(str,1024,fnz1);
132 rtn=fgets(str,1024,fnz2);
134 for(ii=0;ii<
nz;ii++) {
136 double z1,
z2,nz1,nz2,zia1,zia2,aia1,aia2;
137 stat=fscanf(fnz1,
"%lf %lf",&z1,&nz1);
138 stat=fscanf(fnz2,
"%lf %lf",&z2,&nz2);
139 stat = fscanf(ampz1,
"%lf %lf",&zia1,&aia1);
140 stat = fscanf(ampz2,
"%lf %lf",&zia2,&aia2);
141 zarr_1[ii]=
z1; zarr_2[ii]=
z2;
142 pzarr_1[ii]=nz1; pzarr_2[ii]=nz2;
154 FILE *fi_dd_11,*fi_dd_12,*fi_dd_22;
155 FILE *fi_ll_11_pp,*fi_ll_12_pp,*fi_ll_22_pp;
156 FILE *fi_ll_11_mm,*fi_ll_12_mm,*fi_ll_22_mm;
157 FILE *fi_li_11_pp,*fi_li_12_pp,*fi_li_22_pp;
158 FILE *fi_li_11_mm,*fi_li_12_mm,*fi_li_22_mm;
159 FILE *fi_ii_11_pp,*fi_ii_12_pp,*fi_ii_22_pp;
160 FILE *fi_ii_11_mm,*fi_ii_12_mm,*fi_ii_22_mm;
161 FILE *fi_lltot_11_pp,*fi_lltot_12_pp,*fi_lltot_22_pp;
162 FILE *fi_lltot_11_mm,*fi_lltot_12_mm,*fi_lltot_22_mm;
163 FILE *fi_dl_11,*fi_dl_12,*fi_dl_21,*fi_dl_22;
164 FILE *fi_di_11,*fi_di_12,*fi_di_21,*fi_di_22;
165 FILE *fi_dltot_11,*fi_dltot_12,*fi_dltot_21,*fi_dltot_22;
166 int has_rsd=0,has_magnification=0, has_intrinsic_alignment=0;
169 nz,zarr_1,bzarr,&status2);
172 nz,zarr_2,bzarr,&status2);
178 CCL_ClTracer *tr_wli_1=
ccl_cl_tracer_lensing(cosmo,1,nz,zarr_1,pzarr_1,nz,zarr_1,az1arr,nz,zarr_1,rz1arr,&status);
180 CCL_ClTracer *tr_wli_2=
ccl_cl_tracer_lensing(cosmo,1,nz,zarr_2,pzarr_2,nz,zarr_2,az2arr,nz,zarr_2,rz2arr,&status);
184 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b1%s_log_wt_dd.txt",compare_type);
186 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b2%s_log_wt_dd.txt",compare_type);
188 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b2b2%s_log_wt_dd.txt",compare_type);
190 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b1%s_log_wt_ll_pp.txt",compare_type);
192 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b2%s_log_wt_ll_pp.txt",compare_type);
194 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b2b2%s_log_wt_ll_pp.txt",compare_type);
196 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b1%s_log_wt_ll_mm.txt",compare_type);
198 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b2%s_log_wt_ll_mm.txt",compare_type);
200 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b2b2%s_log_wt_ll_mm.txt",compare_type);
202 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b1%s_log_wt_li_pp.txt",compare_type);
204 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b2%s_log_wt_li_pp.txt",compare_type);
206 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b2b2%s_log_wt_li_pp.txt",compare_type);
208 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b1%s_log_wt_li_mm.txt",compare_type);
210 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b2%s_log_wt_li_mm.txt",compare_type);
212 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b2b2%s_log_wt_li_mm.txt",compare_type);
214 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b1%s_log_wt_ii_pp.txt",compare_type);
216 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b2%s_log_wt_ii_pp.txt",compare_type);
218 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b2b2%s_log_wt_ii_pp.txt",compare_type);
220 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b1%s_log_wt_ii_mm.txt",compare_type);
222 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b2%s_log_wt_ii_mm.txt",compare_type);
224 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b2b2%s_log_wt_ii_mm.txt",compare_type);
226 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b1%s_log_wt_lltot_pp.txt",compare_type);
228 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b2%s_log_wt_lltot_pp.txt",compare_type);
230 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b2b2%s_log_wt_lltot_pp.txt",compare_type);
232 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b1%s_log_wt_lltot_mm.txt",compare_type);
234 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b2%s_log_wt_lltot_mm.txt",compare_type);
236 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b2b2%s_log_wt_lltot_mm.txt",compare_type);
238 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b1%s_log_wt_dl.txt",compare_type);
240 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b2%s_log_wt_dl.txt",compare_type);
242 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b2b1%s_log_wt_dl.txt",compare_type);
244 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b2b2%s_log_wt_dl.txt",compare_type);
246 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b1%s_log_wt_di.txt",compare_type);
248 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b2%s_log_wt_di.txt",compare_type);
250 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b2b1%s_log_wt_di.txt",compare_type);
252 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b2b2%s_log_wt_di.txt",compare_type);
254 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b1%s_log_wt_dltot.txt",compare_type);
256 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b1b2%s_log_wt_dltot.txt",compare_type);
258 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b2b1%s_log_wt_dltot.txt",compare_type);
260 sprintf(fname,
"tests/benchmark/codecomp_step2_outputs/run_b2b2%s_log_wt_dltot.txt",compare_type);
264 double taper_cl_limits[4]={1,2,10000,15000};
265 double wt_dd_11[nofl],wt_dd_12[nofl],wt_dd_22[nofl];
266 double wt_ll_11_mm[nofl],wt_ll_12_mm[nofl],wt_ll_22_mm[nofl];
267 double wt_ll_11_pp[nofl],wt_ll_12_pp[nofl],wt_ll_22_pp[nofl];
268 double wt_li_11_mm[nofl],wt_li_12_mm[nofl],wt_li_22_mm[nofl];
269 double wt_li_11_pp[nofl],wt_li_12_pp[nofl],wt_li_22_pp[nofl];
270 double wt_ii_11_mm[nofl],wt_ii_12_mm[nofl],wt_ii_22_mm[nofl];
271 double wt_ii_11_pp[nofl],wt_ii_12_pp[nofl],wt_ii_22_pp[nofl];
272 double wt_lltot_11_mm[nofl],wt_lltot_12_mm[nofl],wt_lltot_22_mm[nofl];
273 double wt_lltot_11_pp[nofl],wt_lltot_12_pp[nofl],wt_lltot_22_pp[nofl];
274 double wt_dl_11[nofl],wt_dl_12[nofl],wt_dl_21[nofl],wt_dl_22[nofl];
275 double wt_di_11[nofl],wt_di_12[nofl],wt_di_21[nofl],wt_di_22[nofl];
276 double wt_dltot_11[nofl],wt_dltot_12[nofl],wt_dltot_21[nofl],wt_dltot_22[nofl];
277 double *wt_dd_11_h,*wt_dd_12_h,*wt_dd_22_h;
278 double *wt_ll_11_h_mm,*wt_ll_12_h_mm,*wt_ll_22_h_mm;
279 double *wt_ll_11_h_pp,*wt_ll_12_h_pp,*wt_ll_22_h_pp;
280 double *wt_li_11_h_mm,*wt_li_12_h_mm,*wt_li_22_h_mm;
281 double *wt_li_11_h_pp,*wt_li_12_h_pp,*wt_li_22_h_pp;
282 double *wt_ii_11_h_mm,*wt_ii_12_h_mm,*wt_ii_22_h_mm;
283 double *wt_ii_11_h_pp,*wt_ii_12_h_pp,*wt_ii_22_h_pp;
284 double *wt_lltot_11_h_mm,*wt_lltot_12_h_mm,*wt_lltot_22_h_mm;
285 double *wt_lltot_11_h_pp,*wt_lltot_12_h_pp,*wt_lltot_22_h_pp;
286 double *wt_dl_11_h,*wt_dl_12_h,*wt_dl_21_h,*wt_dl_22_h;
287 double *wt_di_11_h,*wt_di_12_h,*wt_di_21_h,*wt_di_22_h;
288 double *wt_dltot_11_h,*wt_dltot_12_h,*wt_dltot_21_h,*wt_dltot_22_h;
289 double theta_in[nofl];
291 for(ii=0;ii<nofl;ii++) {
294 stat=fscanf(fi_dd_11,
"%lf %lf",&theta_in[ii],&wt_dd_11[ii]);
295 stat=fscanf(fi_dd_12,
"%lf %lf",&dum,&wt_dd_12[ii]);
296 stat=fscanf(fi_dd_22,
"%lf %lf",&dum,&wt_dd_22[ii]);
297 stat=fscanf(fi_ll_11_pp,
"%lf %lf",&dum,&wt_ll_11_pp[ii]);
298 stat=fscanf(fi_ll_12_pp,
"%lf %lf",&dum,&wt_ll_12_pp[ii]);
299 stat=fscanf(fi_ll_22_pp,
"%lf %lf",&dum,&wt_ll_22_pp[ii]);
300 stat=fscanf(fi_ll_11_mm,
"%lf %lf",&dum,&wt_ll_11_mm[ii]);
301 stat=fscanf(fi_ll_12_mm,
"%lf %lf",&dum,&wt_ll_12_mm[ii]);
302 stat=fscanf(fi_ll_22_mm,
"%lf %lf",&dum,&wt_ll_22_mm[ii]);
303 stat=fscanf(fi_li_11_pp,
"%lf %lf",&dum,&wt_li_11_pp[ii]);
304 stat=fscanf(fi_li_12_pp,
"%lf %lf",&dum,&wt_li_12_pp[ii]);
305 stat=fscanf(fi_li_22_pp,
"%lf %lf",&dum,&wt_li_22_pp[ii]);
306 stat=fscanf(fi_li_11_mm,
"%lf %lf",&dum,&wt_li_11_mm[ii]);
307 stat=fscanf(fi_li_12_mm,
"%lf %lf",&dum,&wt_li_12_mm[ii]);
308 stat=fscanf(fi_li_22_mm,
"%lf %lf",&dum,&wt_li_22_mm[ii]);
309 stat=fscanf(fi_ii_11_pp,
"%lf %lf",&dum,&wt_ii_11_pp[ii]);
310 stat=fscanf(fi_ii_12_pp,
"%lf %lf",&dum,&wt_ii_12_pp[ii]);
311 stat=fscanf(fi_ii_22_pp,
"%lf %lf",&dum,&wt_ii_22_pp[ii]);
312 stat=fscanf(fi_ii_11_mm,
"%lf %lf",&dum,&wt_ii_11_mm[ii]);
313 stat=fscanf(fi_ii_12_mm,
"%lf %lf",&dum,&wt_ii_12_mm[ii]);
314 stat=fscanf(fi_ii_22_mm,
"%lf %lf",&dum,&wt_ii_22_mm[ii]);
315 stat=fscanf(fi_lltot_11_pp,
"%lf %lf",&dum,&wt_lltot_11_pp[ii]);
316 stat=fscanf(fi_lltot_12_pp,
"%lf %lf",&dum,&wt_lltot_12_pp[ii]);
317 stat=fscanf(fi_lltot_22_pp,
"%lf %lf",&dum,&wt_lltot_22_pp[ii]);
318 stat=fscanf(fi_lltot_11_mm,
"%lf %lf",&dum,&wt_lltot_11_mm[ii]);
319 stat=fscanf(fi_lltot_12_mm,
"%lf %lf",&dum,&wt_lltot_12_mm[ii]);
320 stat=fscanf(fi_lltot_22_mm,
"%lf %lf",&dum,&wt_lltot_22_mm[ii]);
321 stat=fscanf(fi_dl_11,
"%lf %lf",&dum,&wt_dl_11[ii]);
322 stat=fscanf(fi_dl_12,
"%lf %lf",&dum,&wt_dl_12[ii]);
323 stat=fscanf(fi_dl_21,
"%lf %lf",&dum,&wt_dl_21[ii]);
324 stat=fscanf(fi_dl_22,
"%lf %lf",&dum,&wt_dl_22[ii]);
325 stat=fscanf(fi_di_11,
"%lf %lf",&dum,&wt_di_11[ii]);
326 stat=fscanf(fi_di_12,
"%lf %lf",&dum,&wt_di_12[ii]);
327 stat=fscanf(fi_di_21,
"%lf %lf",&dum,&wt_di_21[ii]);
328 stat=fscanf(fi_di_22,
"%lf %lf",&dum,&wt_di_22[ii]);
329 stat=fscanf(fi_dltot_11,
"%lf %lf",&dum,&wt_dltot_11[ii]);
330 stat=fscanf(fi_dltot_12,
"%lf %lf",&dum,&wt_dltot_12[ii]);
331 stat=fscanf(fi_dltot_21,
"%lf %lf",&dum,&wt_dltot_21[ii]);
332 stat=fscanf(fi_dltot_22,
"%lf %lf",&dum,&wt_dltot_22[ii]);
334 fclose(fi_dd_11); fclose(fi_dd_12); fclose(fi_dd_22);
335 fclose(fi_ll_11_pp); fclose(fi_ll_12_pp); fclose(fi_ll_22_pp);
336 fclose(fi_ll_11_mm); fclose(fi_ll_12_mm); fclose(fi_ll_22_mm);
337 fclose(fi_li_11_pp); fclose(fi_li_12_pp); fclose(fi_li_22_pp);
338 fclose(fi_li_11_mm); fclose(fi_li_12_mm); fclose(fi_li_22_mm);
339 fclose(fi_ii_11_pp); fclose(fi_ii_12_pp); fclose(fi_ii_22_pp);
340 fclose(fi_ii_11_mm); fclose(fi_ii_12_mm); fclose(fi_ii_22_mm);
341 fclose(fi_lltot_11_pp); fclose(fi_lltot_12_pp); fclose(fi_lltot_22_pp);
342 fclose(fi_lltot_11_mm); fclose(fi_lltot_12_mm); fclose(fi_lltot_22_mm);
343 fclose(fi_dl_11); fclose(fi_dl_12); fclose(fi_dl_21); fclose(fi_dl_22);
344 fclose(fi_di_11); fclose(fi_di_12); fclose(fi_di_21); fclose(fi_di_22);
345 fclose(fi_dltot_11); fclose(fi_dltot_12); fclose(fi_dltot_21); fclose(fi_dltot_22);
348 double *clarr=malloc(
ELL_MAX_CL*
sizeof(
double));
349 double *clarr1=malloc(
ELL_MAX_CL*
sizeof(
double));
350 double *clarr2=malloc(
ELL_MAX_CL*
sizeof(
double));
351 double *clarr3=malloc(
ELL_MAX_CL*
sizeof(
double));
352 double *clarr4=malloc(
ELL_MAX_CL*
sizeof(
double));
353 double *larr=malloc(
ELL_MAX_CL*
sizeof(
double));
359 for(
int il=0;il<2;il++){
371 double l_logstep = 1.05;
372 double l_linstep = 20.;
374 wt_dd_11_h=malloc(nofl*
sizeof(
double));
375 ccl_angular_cls(cosmo,wyl,tr_nc_1,tr_nc_1,ELL_MAX_CL,ells,clarr,&status);
377 0,taper_cl_limits,algorithm,&status);
378 wt_dd_12_h=malloc(nofl*
sizeof(
double));
379 ccl_angular_cls(cosmo,wyl,tr_nc_1,tr_nc_2,ELL_MAX_CL,ells,clarr,&status);
381 0,taper_cl_limits,algorithm,&status);
382 wt_dd_22_h=malloc(nofl*
sizeof(
double));
383 ccl_angular_cls(cosmo,wyl,tr_nc_2,tr_nc_2,ELL_MAX_CL,ells,clarr,&status);
385 0,taper_cl_limits,algorithm,&status);
387 wt_ll_11_h_mm=malloc(nofl*
sizeof(
double));
388 wt_ll_11_h_pp=malloc(nofl*
sizeof(
double));
389 ccl_angular_cls(cosmo,wyl,tr_wl_1,tr_wl_1,ELL_MAX_CL,ells,clarr,&status);
391 0,taper_cl_limits,algorithm,&status);
393 0,taper_cl_limits,algorithm,&status);
394 wt_ll_12_h_mm=malloc(nofl*
sizeof(
double));
395 wt_ll_12_h_pp=malloc(nofl*
sizeof(
double));
396 ccl_angular_cls(cosmo,wyl,tr_wl_1,tr_wl_2,ELL_MAX_CL,ells,clarr,&status);
398 0,taper_cl_limits,algorithm,&status);
400 0,taper_cl_limits,algorithm,&status);
401 wt_ll_22_h_mm=malloc(nofl*
sizeof(
double));
402 wt_ll_22_h_pp=malloc(nofl*
sizeof(
double));
403 ccl_angular_cls(cosmo,wyl,tr_wl_2,tr_wl_2,ELL_MAX_CL,ells,clarr,&status);
405 0,taper_cl_limits,algorithm,&status);
407 0,taper_cl_limits,algorithm,&status);
410 wt_li_11_h_mm=malloc(nofl*
sizeof(
double));
411 wt_li_11_h_pp=malloc(nofl*
sizeof(
double));
412 ccl_angular_cls(cosmo,wyl,tr_wl_1,tr_wli_1,ELL_MAX_CL,ells,clarr1,&status);
413 ccl_angular_cls(cosmo,wyl,tr_wl_1,tr_wl_1,ELL_MAX_CL,ells,clarr2,&status);
415 clarr[il]=2*(clarr1[il]-clarr2[il]);
418 0,taper_cl_limits,algorithm,&status);
420 0,taper_cl_limits,algorithm,&status);
421 wt_li_12_h_mm=malloc(nofl*
sizeof(
double));
422 wt_li_12_h_pp=malloc(nofl*
sizeof(
double));
423 ccl_angular_cls(cosmo,wyl,tr_wl_1,tr_wli_2,ELL_MAX_CL,ells,clarr1,&status);
424 ccl_angular_cls(cosmo,wyl,tr_wli_1,tr_wl_2,ELL_MAX_CL,ells,clarr2,&status);
425 ccl_angular_cls(cosmo,wyl,tr_wl_1,tr_wl_2,ELL_MAX_CL,ells,clarr3,&status);
427 clarr[il]=clarr1[il]+clarr2[il]-2*clarr3[il];
430 0,taper_cl_limits,algorithm,&status);
432 0,taper_cl_limits,algorithm,&status);
433 wt_li_22_h_mm=malloc(nofl*
sizeof(
double));
434 wt_li_22_h_pp=malloc(nofl*
sizeof(
double));
435 ccl_angular_cls(cosmo,wyl,tr_wl_2,tr_wli_2,ELL_MAX_CL,ells,clarr1,&status);
436 ccl_angular_cls(cosmo,wyl,tr_wl_2,tr_wl_2,ELL_MAX_CL,ells,clarr2,&status);
438 clarr[il]=2*(clarr1[il]-clarr2[il]);
441 0,taper_cl_limits,algorithm,&status);
443 0,taper_cl_limits,algorithm,&status);
446 wt_ii_11_h_mm=malloc(nofl*
sizeof(
double));
447 wt_ii_11_h_pp=malloc(nofl*
sizeof(
double));
448 ccl_angular_cls(cosmo,wyl,tr_wli_1,tr_wli_1,ELL_MAX_CL,ells,clarr1,&status);
449 ccl_angular_cls(cosmo,wyl,tr_wl_1,tr_wl_1,ELL_MAX_CL,ells,clarr2,&status);
450 ccl_angular_cls(cosmo,wyl,tr_wl_1,tr_wli_1,ELL_MAX_CL,ells,clarr3,&status);
452 clarr[il]=clarr1[il]+clarr2[il]-2*clarr3[il];
455 0,taper_cl_limits,algorithm,&status);
457 0,taper_cl_limits,algorithm,&status);
458 wt_ii_12_h_mm=malloc(nofl*
sizeof(
double));
459 wt_ii_12_h_pp=malloc(nofl*
sizeof(
double));
460 ccl_angular_cls(cosmo,wyl,tr_wli_1,tr_wli_2,ELL_MAX_CL,ells,clarr1,&status);
461 ccl_angular_cls(cosmo,wyl,tr_wl_1,tr_wl_2,ELL_MAX_CL,ells,clarr2,&status);
462 ccl_angular_cls(cosmo,wyl,tr_wl_1,tr_wli_2,ELL_MAX_CL,ells,clarr3,&status);
463 ccl_angular_cls(cosmo,wyl,tr_wli_1,tr_wl_2,ELL_MAX_CL,ells,clarr4,&status);
465 clarr[il]=clarr1[il]+clarr2[il]-clarr3[il]-clarr4[il];
468 0,taper_cl_limits,algorithm,&status);
470 0,taper_cl_limits,algorithm,&status);
471 wt_ii_22_h_mm=malloc(nofl*
sizeof(
double));
472 wt_ii_22_h_pp=malloc(nofl*
sizeof(
double));
473 ccl_angular_cls(cosmo,wyl,tr_wli_2,tr_wli_2,ELL_MAX_CL,ells,clarr1,&status);
474 ccl_angular_cls(cosmo,wyl,tr_wl_2,tr_wl_2,ELL_MAX_CL,ells,clarr2,&status);
475 ccl_angular_cls(cosmo,wyl,tr_wl_2,tr_wli_2,ELL_MAX_CL,ells,clarr3,&status);
477 clarr[il]=clarr1[il]+clarr2[il]-2*clarr3[il];
480 0,taper_cl_limits,algorithm,&status);
482 0,taper_cl_limits,algorithm,&status);
485 wt_lltot_11_h_mm=malloc(nofl*
sizeof(
double));
486 wt_lltot_11_h_pp=malloc(nofl*
sizeof(
double));
487 ccl_angular_cls(cosmo,wyl,tr_wli_1,tr_wli_1,ELL_MAX_CL,ells,clarr,&status);
489 0,taper_cl_limits,algorithm,&status);
491 0,taper_cl_limits,algorithm,&status);
492 wt_lltot_12_h_mm=malloc(nofl*
sizeof(
double));
493 wt_lltot_12_h_pp=malloc(nofl*
sizeof(
double));
494 ccl_angular_cls(cosmo,wyl,tr_wli_1,tr_wli_2,ELL_MAX_CL,ells,clarr,&status);
496 0,taper_cl_limits,algorithm,&status);
498 0,taper_cl_limits,algorithm,&status);
499 wt_lltot_22_h_mm=malloc(nofl*
sizeof(
double));
500 wt_lltot_22_h_pp=malloc(nofl*
sizeof(
double));
501 ccl_angular_cls(cosmo,wyl,tr_wli_2,tr_wli_2,ELL_MAX_CL,ells,clarr,&status);
503 0,taper_cl_limits,algorithm,&status);
505 0,taper_cl_limits,algorithm,&status);
508 wt_dl_11_h=malloc(nofl*
sizeof(
double));
509 ccl_angular_cls(cosmo,wyl,tr_nc_1,tr_wl_1,ELL_MAX_CL,ells,clarr,&status);
511 0,taper_cl_limits,algorithm,&status);
512 wt_dl_12_h=malloc(nofl*
sizeof(
double));
513 ccl_angular_cls(cosmo,wyl,tr_nc_1,tr_wl_2,ELL_MAX_CL,ells,clarr,&status);
515 0,taper_cl_limits,algorithm,&status);
516 wt_dl_21_h=malloc(nofl*
sizeof(
double));
517 ccl_angular_cls(cosmo,wyl,tr_nc_2,tr_wl_1,ELL_MAX_CL,ells,clarr,&status);
519 0,taper_cl_limits,algorithm,&status);
520 wt_dl_22_h=malloc(nofl*
sizeof(
double));
521 ccl_angular_cls(cosmo,wyl,tr_nc_2,tr_wl_2,ELL_MAX_CL,ells,clarr,&status);
523 0,taper_cl_limits,algorithm,&status);
526 wt_dltot_11_h=malloc(nofl*
sizeof(
double));
527 ccl_angular_cls(cosmo,wyl,tr_nc_1,tr_wli_1,ELL_MAX_CL,ells,clarr,&status);
529 0,taper_cl_limits,algorithm,&status);
530 wt_dltot_12_h=malloc(nofl*
sizeof(
double));
531 ccl_angular_cls(cosmo,wyl,tr_nc_1,tr_wli_2,ELL_MAX_CL,ells,clarr,&status);
533 0,taper_cl_limits,algorithm,&status);
534 wt_dltot_21_h=malloc(nofl*
sizeof(
double));
535 ccl_angular_cls(cosmo,wyl,tr_nc_2,tr_wli_1,ELL_MAX_CL,ells,clarr,&status);
537 0,taper_cl_limits,algorithm,&status);
538 wt_dltot_22_h=malloc(nofl*
sizeof(
double));
539 ccl_angular_cls(cosmo,wyl,tr_nc_2,tr_wli_2,ELL_MAX_CL,ells,clarr,&status);
541 0,taper_cl_limits,algorithm,&status);
544 wt_di_11_h=malloc(nofl*
sizeof(
double));
545 ccl_angular_cls(cosmo,wyl,tr_nc_1,tr_wl_1,ELL_MAX_CL,ells,clarr1,&status);
546 ccl_angular_cls(cosmo,wyl,tr_nc_1,tr_wli_1,ELL_MAX_CL,ells,clarr2,&status);
548 clarr[il]=clarr2[il]-clarr1[il];
551 0,taper_cl_limits,algorithm,&status);
552 wt_di_12_h=malloc(nofl*
sizeof(
double));
553 ccl_angular_cls(cosmo,wyl,tr_nc_1,tr_wl_2,ELL_MAX_CL,ells,clarr1,&status);
554 ccl_angular_cls(cosmo,wyl,tr_nc_1,tr_wli_2,ELL_MAX_CL,ells,clarr2,&status);
556 clarr[il]=clarr2[il]-clarr1[il];
559 0,taper_cl_limits,algorithm,&status);
560 wt_di_21_h=malloc(nofl*
sizeof(
double));
561 ccl_angular_cls(cosmo,wyl,tr_nc_2,tr_wl_1,ELL_MAX_CL,ells,clarr1,&status);
562 ccl_angular_cls(cosmo,wyl,tr_nc_2,tr_wli_1,ELL_MAX_CL,ells,clarr2,&status);
564 clarr[il]=clarr2[il]-clarr1[il];
567 0,taper_cl_limits,algorithm,&status);
568 wt_di_22_h=malloc(nofl*
sizeof(
double));
569 ccl_angular_cls(cosmo,wyl,tr_nc_2,tr_wl_2,ELL_MAX_CL,ells,clarr1,&status);
570 ccl_angular_cls(cosmo,wyl,tr_nc_2,tr_wli_2,ELL_MAX_CL,ells,clarr2,&status);
572 clarr[il]=clarr2[il]-clarr1[il];
575 0,taper_cl_limits,algorithm,&status);
590 double sigwt_dd_11[15], sigwt_dd_22[15];
591 double sigwt_dl_11[15], sigwt_dl_12[15], sigwt_dl_21[15], sigwt_dl_22[15];
592 double sigwt_ll_12_mm[15], sigwt_ll_12_pp[15];
593 double sigwt_ll_11_mm[15], sigwt_ll_22_mm[15];
594 double sigwt_ll_11_pp[15], sigwt_ll_22_pp[15];
595 double sig_theta_in[15];
598 FILE *fi_dl_sig=fopen(
"tests/benchmark/cov_corr/sigma_ggl_Nbin5",
"r");
599 FILE *fi_dd_sig=fopen(
"tests/benchmark/cov_corr/sigma_clustering_Nbin5",
"r");
600 FILE *fi_mm_sig=fopen(
"tests/benchmark/cov_corr/sigma_xi-_Nbin5",
"r");
601 FILE *fi_pp_sig=fopen(
"tests/benchmark/cov_corr/sigma_xi+_Nbin5",
"r");
602 if(fgets(bs,
sizeof(bs),fi_dd_sig)==NULL) {
603 fprintf(stderr,
"Error reading file\n");
606 if(fgets(bs,
sizeof(bs),fi_mm_sig)==NULL) {
607 fprintf(stderr,
"Error reading file\n");
610 if(fgets(bs,
sizeof(bs),fi_pp_sig)==NULL) {
611 fprintf(stderr,
"Error reading file\n");
614 if(fgets(bs,
sizeof(bs),fi_dl_sig)==NULL) {
615 fprintf(stderr,
"Error reading file\n");
618 for(
int ii=0;ii<nsig;ii++) {
621 stat=fscanf(fi_dd_sig,
"%le %le %le %le",&sig_theta_in[ii],&sigwt_dd_11[ii],&sigwt_dd_22[ii],&dum);
622 stat=fscanf(fi_dl_sig,
"%le %le %le %le %le",&sig_theta_in[ii],&sigwt_dl_12[ii],&sigwt_dl_11[ii],&sigwt_dl_22[ii],&sigwt_dl_21[ii]);
623 stat=fscanf(fi_pp_sig,
"%le %le %le %le",&sig_theta_in[ii],&sigwt_ll_11_pp[ii],&sigwt_ll_22_pp[ii],&sigwt_ll_12_pp[ii]);
624 stat=fscanf(fi_mm_sig,
"%le %le %le %le",&sig_theta_in[ii],&sigwt_ll_11_mm[ii],&sigwt_ll_22_mm[ii],&sigwt_ll_12_mm[ii]);
625 sig_theta_in[ii]=sig_theta_in[ii]/60.;
632 gsl_spline *spl_sigwt_dd_11 =gsl_spline_alloc(
L_SPLINE_TYPE,nsig);
633 gsl_spline_init(spl_sigwt_dd_11 ,sig_theta_in,sigwt_dd_11 ,nsig);
634 gsl_spline *spl_sigwt_dd_22 =gsl_spline_alloc(
L_SPLINE_TYPE,nsig);
635 gsl_spline_init(spl_sigwt_dd_22 ,sig_theta_in,sigwt_dd_22 ,nsig);
636 gsl_spline *spl_sigwt_ll_11_pp=gsl_spline_alloc(
L_SPLINE_TYPE,nsig);
637 gsl_spline_init(spl_sigwt_ll_11_pp,sig_theta_in,sigwt_ll_11_pp,nsig);
638 gsl_spline *spl_sigwt_ll_22_pp=gsl_spline_alloc(
L_SPLINE_TYPE,nsig);
639 gsl_spline_init(spl_sigwt_ll_22_pp,sig_theta_in,sigwt_ll_22_pp,nsig);
640 gsl_spline *spl_sigwt_ll_12_pp=gsl_spline_alloc(
L_SPLINE_TYPE,nsig);
641 gsl_spline_init(spl_sigwt_ll_12_pp,sig_theta_in,sigwt_ll_12_pp,nsig);
642 gsl_spline *spl_sigwt_ll_11_mm=gsl_spline_alloc(
L_SPLINE_TYPE,nsig);
643 gsl_spline_init(spl_sigwt_ll_11_mm,sig_theta_in,sigwt_ll_11_mm,nsig);
644 gsl_spline *spl_sigwt_ll_22_mm=gsl_spline_alloc(
L_SPLINE_TYPE,nsig);
645 gsl_spline_init(spl_sigwt_ll_22_mm,sig_theta_in,sigwt_ll_22_mm,nsig);
646 gsl_spline *spl_sigwt_ll_12_mm=gsl_spline_alloc(
L_SPLINE_TYPE,nsig);
647 gsl_spline_init(spl_sigwt_ll_12_mm,sig_theta_in,sigwt_ll_12_mm,nsig);
648 gsl_spline *spl_sigwt_dl_11 =gsl_spline_alloc(
L_SPLINE_TYPE,nsig);
649 gsl_spline_init(spl_sigwt_dl_11,sig_theta_in,sigwt_dl_11 ,nsig);
650 gsl_spline *spl_sigwt_dl_12 =gsl_spline_alloc(
L_SPLINE_TYPE,nsig);
651 gsl_spline_init(spl_sigwt_dl_12,sig_theta_in,sigwt_dl_12 ,nsig);
652 gsl_spline *spl_sigwt_dl_21 =gsl_spline_alloc(
L_SPLINE_TYPE,nsig);
653 gsl_spline_init(spl_sigwt_dl_21,sig_theta_in,sigwt_dl_21 ,nsig);
654 gsl_spline *spl_sigwt_dl_22 =gsl_spline_alloc(
L_SPLINE_TYPE,nsig);
655 gsl_spline_init(spl_sigwt_dl_22,sig_theta_in,sigwt_dl_22 ,nsig);
658 for(ii=0;ii<nofl;ii++) {
661 if((theta_in[ii]<sig_theta_in[0]) ||(theta_in[ii]>sig_theta_in[nsig-1]))
668 tol=gsl_spline_eval(spl_sigwt_dd_11,theta_in[ii],NULL);
673 tol=gsl_spline_eval(spl_sigwt_dd_22,theta_in[ii],NULL);
678 tol=gsl_spline_eval(spl_sigwt_ll_11_pp,theta_in[ii],NULL);
680 tol=gsl_spline_eval(spl_sigwt_ll_12_pp,theta_in[ii],NULL);
682 tol=gsl_spline_eval(spl_sigwt_ll_22_pp,theta_in[ii],NULL);
684 tol=gsl_spline_eval(spl_sigwt_ll_11_mm,theta_in[ii],NULL);
686 tol=gsl_spline_eval(spl_sigwt_ll_12_mm,theta_in[ii],NULL);
688 tol=gsl_spline_eval(spl_sigwt_ll_22_mm,theta_in[ii],NULL);
690 tol=gsl_spline_eval(spl_sigwt_ll_11_pp,theta_in[ii],NULL);
692 tol=gsl_spline_eval(spl_sigwt_ll_12_pp,theta_in[ii],NULL);
694 tol=gsl_spline_eval(spl_sigwt_ll_22_pp,theta_in[ii],NULL);
696 tol=gsl_spline_eval(spl_sigwt_ll_11_mm,theta_in[ii],NULL);
698 tol=gsl_spline_eval(spl_sigwt_ll_12_mm,theta_in[ii],NULL);
700 tol=gsl_spline_eval(spl_sigwt_ll_22_mm,theta_in[ii],NULL);
702 tol=gsl_spline_eval(spl_sigwt_ll_11_pp,theta_in[ii],NULL);
704 tol=gsl_spline_eval(spl_sigwt_ll_12_pp,theta_in[ii],NULL);
706 tol=gsl_spline_eval(spl_sigwt_ll_22_pp,theta_in[ii],NULL);
708 tol=gsl_spline_eval(spl_sigwt_ll_11_mm,theta_in[ii],NULL);
710 tol=gsl_spline_eval(spl_sigwt_ll_12_mm,theta_in[ii],NULL);
712 tol=gsl_spline_eval(spl_sigwt_ll_22_mm,theta_in[ii],NULL);
714 tol=gsl_spline_eval(spl_sigwt_ll_11_pp,theta_in[ii],NULL);
716 tol=gsl_spline_eval(spl_sigwt_ll_12_pp,theta_in[ii],NULL);
718 tol=gsl_spline_eval(spl_sigwt_ll_22_pp,theta_in[ii],NULL);
720 tol=gsl_spline_eval(spl_sigwt_ll_11_mm,theta_in[ii],NULL);
722 tol=gsl_spline_eval(spl_sigwt_ll_12_mm,theta_in[ii],NULL);
724 tol=gsl_spline_eval(spl_sigwt_ll_22_mm,theta_in[ii],NULL);
728 tol=gsl_spline_eval(spl_sigwt_dl_11,theta_in[ii],NULL);
730 tol=gsl_spline_eval(spl_sigwt_dl_12,theta_in[ii],NULL);
732 tol=gsl_spline_eval(spl_sigwt_dl_21,theta_in[ii],NULL);
734 tol=gsl_spline_eval(spl_sigwt_dl_22,theta_in[ii],NULL);
736 tol=gsl_spline_eval(spl_sigwt_dl_11,theta_in[ii],NULL);
738 tol=gsl_spline_eval(spl_sigwt_dl_12,theta_in[ii],NULL);
740 tol=gsl_spline_eval(spl_sigwt_dl_21,theta_in[ii],NULL);
742 tol=gsl_spline_eval(spl_sigwt_dl_22,theta_in[ii],NULL);
744 tol=gsl_spline_eval(spl_sigwt_dl_11,theta_in[ii],NULL);
746 tol=gsl_spline_eval(spl_sigwt_dl_12,theta_in[ii],NULL);
748 tol=gsl_spline_eval(spl_sigwt_dl_21,theta_in[ii],NULL);
750 tol=gsl_spline_eval(spl_sigwt_dl_22,theta_in[ii],NULL);
755 gsl_spline_free(spl_sigwt_dd_11);
756 gsl_spline_free(spl_sigwt_dd_22);
757 gsl_spline_free(spl_sigwt_dl_11);
758 gsl_spline_free(spl_sigwt_dl_12);
759 gsl_spline_free(spl_sigwt_dl_21);
760 gsl_spline_free(spl_sigwt_dl_22);
761 gsl_spline_free(spl_sigwt_ll_11_pp);
762 gsl_spline_free(spl_sigwt_ll_22_pp);
763 gsl_spline_free(spl_sigwt_ll_12_pp);
764 gsl_spline_free(spl_sigwt_ll_11_mm);
765 gsl_spline_free(spl_sigwt_ll_22_mm);
766 gsl_spline_free(spl_sigwt_ll_12_mm);
767 free(wt_dd_11_h); free(wt_dd_12_h); free(wt_dd_22_h);
768 free(wt_ll_11_h_pp); free(wt_ll_12_h_pp); free(wt_ll_22_h_pp);
769 free(wt_ll_11_h_mm); free(wt_ll_12_h_mm); free(wt_ll_22_h_mm);
770 free(wt_li_11_h_pp); free(wt_li_12_h_pp); free(wt_li_22_h_pp);
771 free(wt_li_11_h_mm); free(wt_li_12_h_mm); free(wt_li_22_h_mm);
772 free(wt_ii_11_h_pp); free(wt_ii_12_h_pp); free(wt_ii_22_h_pp);
773 free(wt_ii_11_h_mm); free(wt_ii_12_h_mm); free(wt_ii_22_h_mm);
774 free(wt_lltot_11_h_pp); free(wt_lltot_12_h_pp); free(wt_lltot_22_h_pp);
775 free(wt_lltot_11_h_mm); free(wt_lltot_12_h_mm); free(wt_lltot_22_h_mm);
776 free(wt_dl_11_h); free(wt_dl_12_h); free(wt_dl_21_h); free(wt_dl_22_h);
777 free(wt_di_11_h); free(wt_di_12_h); free(wt_di_21_h); free(wt_di_22_h);
778 free(wt_dltot_11_h); free(wt_dltot_12_h); free(wt_dltot_21_h); free(wt_dltot_22_h);
779 free(zarr_1); free(zarr_2);
780 free(pzarr_1); free(pzarr_2);
782 free(az1arr); free(az2arr);
783 free(rz1arr); free(rz2arr);
786 if(!strcmp(compare_type,
"histo")) {
void ccl_set_debug_policy(CCLDebugModePolicy debug_policy)
CCL_ClTracer * ccl_cl_tracer_lensing(ccl_cosmology *cosmo, int has_alignment, int nz_n, double *z_n, double *n, int nz_ba, double *z_ba, double *ba, int nz_rf, double *z_rf, double *rf, int *status)
#define ASSERT_TRUE(real)
#define CTEST_SETUP(sname)
#define CTEST_DATA(sname)
transfer_function_t transfer_function_method
CCL_ClWorkspace * ccl_cl_workspace_new_limber(int lmax, double l_logstep, int l_linstep, int *status)
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)
ccl_cosmology * ccl_cosmology_create(ccl_parameters params, ccl_configuration config)
double INTEGRATION_EPSREL
CCL_ClTracer * ccl_cl_tracer_number_counts_simple(ccl_cosmology *cosmo, int nz_n, double *z_n, double *n, int nz_b, double *z_b, double *b, int *status)
void ccl_cosmology_free(ccl_cosmology *cosmo)
static int linecount(FILE *f)
CCL_BEGIN_DECLS void ccl_correlation(ccl_cosmology *cosmo, int n_ell, double *ell, double *cls, int n_theta, double *theta, double *wtheta, int corr_type, int do_taper_cl, double *taper_cl_limits, int flag_method, int *status)
static void compare_corr(char *compare_type, int algorithm, struct corrs_data *data)
const ccl_configuration default_config
void ccl_cl_workspace_free(CCL_ClWorkspace *w)
#define ASSERT_NOT_NULL(real)
#define CORR_ERROR_FRACTION
ccl_parameters ccl_parameters_create_flat_lcdm(double Omega_c, double Omega_b, double h, double norm_pk, double n_s, int *status)
double INTEGRATION_LIMBER_EPSREL
#define CTEST2(sname, tname)
CCL_ClTracer * ccl_cl_tracer_lensing_simple(ccl_cosmology *cosmo, int nz_n, double *z_n, double *n, int *status)