Skip to content

Commit

Permalink
Merge pull request #348 from LSSTDESC/spin2_factors
Browse files Browse the repository at this point in the history
corrected spin-2 prefactors
  • Loading branch information
damonge committed Mar 13, 2018
2 parents 9bc9579 + b025bdf commit b778440
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 1 addition & 5 deletions src/ccl_cls.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,6 @@ static double transfer_mag(int l,double k,ccl_cosmology *cosmo,CCL_ClTracer *clt
return 0;
else
return -2*clt->prefac_lensing*l*(l+1)*wM/(a*chi*k*k);
//The actual prefactor on large scales should be sqrt((l+2.)*(l+1.)*l*(l-1.)) instead of l*(l+1)
// return clt->prefac_lensing*sqrt((l+2.)*(l+1.)*l*(l-1.))*gf*wL/(a*chi*k*k);
}
else
return 0;
Expand All @@ -581,9 +579,7 @@ static double transfer_wl(int l,double k,ccl_cosmology *cosmo,CCL_ClTracer *clt,
if(wL<=0)
return 0;
else
return clt->prefac_lensing*l*(l+1)*wL/(a*chi*k*k);
//The actual prefactor on large scales should be sqrt((l+2.)*(l+1.)*l*(l-1.)) instead of l*(l+1)
// return clt->prefac_lensing*sqrt((l+2.)*(l+1.)*l*(l-1.))*gf*wL/(a*chi*k*k);
return clt->prefac_lensing*sqrt((l+2.)*(l+1.)*l*(l-1.))*wL/(a*chi*k*k);
}
else
return 0;
Expand Down
11 changes: 8 additions & 3 deletions tests/ccl_test_cls.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ static void compare_cls(char *compare_type,struct cls_data * data)
double fraction_failed=0;
for(int ii=0;ii<3001;ii++) {
int l, rtn;
double ell_correct;
double cl_dd_11,cl_dd_12,cl_dd_22;
double cl_ll_11,cl_ll_12,cl_ll_22;
double cl_dd_11_h,cl_dd_12_h,cl_dd_22_h;
Expand All @@ -142,17 +143,21 @@ static void compare_cls(char *compare_type,struct cls_data * data)
rtn = fscanf(fi_ll_11,"%d %lf",&l,&cl_ll_11);
rtn = fscanf(fi_ll_12,"%d %lf",&l,&cl_ll_12);
rtn = fscanf(fi_ll_22,"%d %lf",&l,&cl_ll_22);
if(l<=0)
ell_correct=1;
else
ell_correct=l*(l+1.)/sqrt((l+2.)*(l+1.)*l*(l-1.));
cl_dd_11_h=ccl_angular_cl(cosmo,l,tr_nc_1,tr_nc_1,&status);
if (status) printf("%s\n",cosmo->status_message);
cl_dd_12_h=ccl_angular_cl(cosmo,l,tr_nc_1,tr_nc_2,&status);
if (status) printf("%s\n",cosmo->status_message);
cl_dd_22_h=ccl_angular_cl(cosmo,l,tr_nc_2,tr_nc_2,&status);
if (status) printf("%s\n",cosmo->status_message);
cl_ll_11_h=ccl_angular_cl(cosmo,l,tr_wl_1,tr_wl_1,&status);
cl_ll_11_h=ccl_angular_cl(cosmo,l,tr_wl_1,tr_wl_1,&status)*ell_correct*ell_correct;
if (status) printf("%s\n",cosmo->status_message);
cl_ll_12_h=ccl_angular_cl(cosmo,l,tr_wl_1,tr_wl_2,&status);
cl_ll_12_h=ccl_angular_cl(cosmo,l,tr_wl_1,tr_wl_2,&status)*ell_correct*ell_correct;
if (status) printf("%s\n",cosmo->status_message);
cl_ll_22_h=ccl_angular_cl(cosmo,l,tr_wl_2,tr_wl_2,&status);
cl_ll_22_h=ccl_angular_cl(cosmo,l,tr_wl_2,tr_wl_2,&status)*ell_correct*ell_correct;;
if (status) printf("%s\n",cosmo->status_message);

if(fabs(cl_dd_11_h/cl_dd_11-1)>CLS_TOLERANCE)
Expand Down

0 comments on commit b778440

Please sign in to comment.