Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions class-sz/include/class_sz.h
Original file line number Diff line number Diff line change
Expand Up @@ -1594,6 +1594,10 @@ double szcounts_ntot;
double * f_unwise_filter;
int unwise_filter_size;

double * l_unwise_filter2;
double * f_unwise_filter2;
int unwise_filter2_size;

double * M_min_of_z_z;
double * M_min_of_z_M_min;
int M_min_of_z_size;
Expand Down Expand Up @@ -2497,6 +2501,8 @@ double get_tau_profile_at_z_m_l(double z,

double get_ksz_filter_at_l(double l,
struct class_sz_structure * pclass_sz);
double get_ksz_filter_at_l2(double l,
struct class_sz_structure * pclass_sz);

double get_M_min_of_z(double l,
struct class_sz_structure * pclass_sz);
Expand Down
1 change: 1 addition & 0 deletions class-sz/include/class_sz_precisions.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class_sz_string_parameter(cib_Snu_file_nu,"/class_sz_auxiliary_files/includes/fi


class_sz_string_parameter(ksz_filter_file,"/class_sz_auxiliary_files/UNWISE_galaxy_distributions/unwise_filter_functions_l_fl.txt","ksz filter file")
class_sz_string_parameter(ksz_filter_file2,"/class_sz_auxiliary_files/UNWISE_galaxy_distributions/unwise_filter_functions_l_fl2.txt","ksz filter file2")
class_sz_string_parameter(ksz_template_file,"/class_sz_auxiliary_files/cl_ksz_bat.dat","ksz template file")
class_sz_string_parameter(ksz_reio_template_file,"/class_sz_auxiliary_files/FBN_kSZ_PS_patchy.d.txt","ksz template file, reio contribution")

Expand Down
1 change: 1 addition & 0 deletions class-sz/include/class_sz_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ double delta_to_delta_prime_nfw(
int load_unbinned_nl_yy(struct class_sz_structure * pclass_sz);
int load_unbinned_nl_tt(struct class_sz_structure * pclass_sz);
int load_ksz_filter(struct class_sz_structure * pclass_sz);
int load_ksz_filter2(struct class_sz_structure * pclass_sz);
int load_M_min_of_z(struct class_sz_structure * pclass_sz);
double get_T10_alpha_at_z(double z_asked, struct class_sz_structure * pclass_sz);
double get_knl_at_z(double z_asked, struct class_sz_structure * pclass_sz);
Expand Down
53 changes: 38 additions & 15 deletions class-sz/source/class_sz.c
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ if (pclass_sz->has_kSZ_kSZ_gal_1h
|| pclass_sz->has_kSZ_kSZ_gal_3h
|| pclass_sz->has_kSZ_kSZ_gal_hf)
load_ksz_filter(pclass_sz);

load_ksz_filter2(pclass_sz);

if (pclass_sz->has_tSZ_gal_1h
|| pclass_sz->has_tSZ_gal_2h
Expand Down Expand Up @@ -2194,6 +2194,7 @@ double cl_tt_lensed_fft[N];
double cl_ksz_fft[N];
double cl_noise_fft[N];
double Fl_bl;
double Fl_bl2;
double cl_ttf[N];
int i;
double * cl_tot;
Expand Down Expand Up @@ -2238,15 +2239,15 @@ cl_noise_fft[i] = pwl_value_1d(pclass_sz->unbinned_nl_tt_size,pclass_sz->unbinne
cl_ksz_fft[i] = cl_ksz_fft[i]/l[i]/(l[i]+1.)*2.*_PI_*1e-12/pba->T_cmb/pba->T_cmb;
cl_noise_fft[i] = cl_noise_fft[i]*1e-12/pba->T_cmb/pba->T_cmb;
Fl_bl = get_ksz_filter_at_l(l[i],pclass_sz);

Fl_bl2 = get_ksz_filter_at_l2(l[i],pclass_sz);

double result_ttf;
if (pclass_sz->compute_ksz2ksz2==1){
result_ttf = Fl_bl*Fl_bl*(cl_ksz_fft[i])*sqrt(2./(2.*_PI_)/(2.*_PI_)); // divide by 2pi^2 and multiply by 2 -- see formula
result_ttf = Fl_bl*Fl_bl2*(cl_ksz_fft[i])*sqrt(2./(2.*_PI_)/(2.*_PI_)); // divide by 2pi^2 and multiply by 2 -- see formula

}
else{
result_ttf = Fl_bl*Fl_bl*(cl_tt_lensed_fft[i]+cl_ksz_fft[i]+cl_noise_fft[i])*sqrt(2./(2.*_PI_)/(2.*_PI_)); // divide by 2pi^2 and multiply by 2 -- see formula
result_ttf = Fl_bl*Fl_bl2*(cl_tt_lensed_fft[i]+cl_ksz_fft[i]+cl_noise_fft[i])*sqrt(2./(2.*_PI_)/(2.*_PI_)); // divide by 2pi^2 and multiply by 2 -- see formula
}

if (l[i]<l_lensed[0]){
Expand Down Expand Up @@ -2514,7 +2515,7 @@ double l = pclass_sz->ell[i];

double flprime = get_ksz_filter_at_l(lprime,pclass_sz);
double abs_l_plus_lprime = sqrt(l*l+lprime*lprime+2.*l*lprime*cos(theta));
double fl_plus_lprime = get_ksz_filter_at_l(abs_l_plus_lprime,pclass_sz);
double fl_plus_lprime = get_ksz_filter_at_l2(abs_l_plus_lprime,pclass_sz);

double clprime_tt_unlensed = pwl_value_1d(ppt->l_scalar_max-2,l_unlensed,cl_tt_unlensed,lprime);
if (lprime<l_unlensed[0])
Expand Down Expand Up @@ -3284,6 +3285,8 @@ if(pclass_sz->has_kSZ_kSZ_gal_1h
// free(pclass_sz->theta_kSZ2_gal_theta_grid);
free(pclass_sz->l_unwise_filter);
free(pclass_sz->f_unwise_filter);
free(pclass_sz->l_unwise_filter2);
free(pclass_sz->f_unwise_filter2);
}
if(pclass_sz->has_kSZ_kSZ_gal_1h
|| pclass_sz->has_kSZ_kSZ_gal_2h
Expand Down Expand Up @@ -7959,6 +7962,7 @@ if ((int) pvectsz[pclass_sz->index_part_id_cov_hsv] == 6) {
double lnk[N],lnpk[N];
int ik;
double fl;
double fl2;
double taul;
double l;
double m = exp(logM);
Expand All @@ -7968,12 +7972,13 @@ if ((int) pvectsz[pclass_sz->index_part_id_cov_hsv] == 6) {
lnk[ik] = log(l_min)+ik/(N-1.)*(log(l_max)-log(l_min));
l = k[ik];
fl = get_ksz_filter_at_l(l,pclass_sz);
fl2 = get_ksz_filter_at_l2(l,pclass_sz);

// pvectsz[pclass_sz->index_multipole_for_tau_profile] = l;
evaluate_tau_profile((l+0.5)/chi,pvecback,pvectsz,pba,pclass_sz);
taul = pvectsz[pclass_sz->index_tau_profile];
Pk[ik] = fl*taul;
Pko[ik] = fl*taul;
Pko[ik] = fl2*taul;
}

double r[N], xi[N];
Expand Down Expand Up @@ -8024,6 +8029,7 @@ if ((int) pvectsz[pclass_sz->index_part_id_cov_hsv] == 6) {
double lnk[N],lnpk[N];
int ik;
double fl;
double fl2;
double taul;
double l;
double m = exp(logM);
Expand All @@ -8033,12 +8039,13 @@ if ((int) pvectsz[pclass_sz->index_part_id_cov_hsv] == 6) {
lnk[ik] = log(l_min)+ik/(N-1.)*(log(l_max)-log(l_min));
l = k[ik];
fl = get_ksz_filter_at_l(l,pclass_sz);
fl2 = get_ksz_filter_at_l2(l,pclass_sz);

// pvectsz[pclass_sz->index_multipole_for_tau_profile] = l;
evaluate_tau_profile((l+0.5)/chi,pvecback,pvectsz,pba,pclass_sz);
taul = pvectsz[pclass_sz->index_tau_profile];
Pk[ik] = fl*taul;
Pko[ik] = fl*taul;
Pko[ik] = fl2*taul;
}

double r[N], xi[N];
Expand Down Expand Up @@ -8088,6 +8095,7 @@ if ((int) pvectsz[pclass_sz->index_part_id_cov_hsv] == 6) {
double lnk[N],lnpk[N];
int ik;
double fl;
double fl2;
double taul;
double l;
double m = exp(logM);
Expand All @@ -8097,13 +8105,13 @@ if ((int) pvectsz[pclass_sz->index_part_id_cov_hsv] == 6) {
lnk[ik] = log(l_min)+ik/(N-1.)*(log(l_max)-log(l_min));
l = k[ik];
fl = get_ksz_filter_at_l(l,pclass_sz);

fl2 = get_ksz_filter_at_l2(l,pclass_sz);
// pvectsz[pclass_sz->index_multipole_for_tau_profile] = l;
double kp = (l+0.5)/chi;
evaluate_galaxy_profile_2h(kp,m_delta_gal,r_delta_gal,c_delta_gal,pvecback,pvectsz,pba,pclass_sz);
taul = pvectsz[pclass_sz->index_galaxy_profile];
Pk[ik] = fl*taul;
Pko[ik] = fl*taul;
Pko[ik] = fl2*taul;
}

double r[N], xi[N];
Expand Down Expand Up @@ -8236,6 +8244,7 @@ double k[N], Pk[N],Pko[N];
double lnk[N],lnpk[N];
int ik;
double fl;
double fl2;
double taul;
double l;
// double m = exp(logM);
Expand All @@ -8245,12 +8254,12 @@ k[ik] = exp(log(l_min)+ik/(N-1.)*(log(l_max)-log(l_min)));
lnk[ik] = log(l_min)+ik/(N-1.)*(log(l_max)-log(l_min));
l = k[ik];
fl = get_ksz_filter_at_l(l,pclass_sz);

fl2 = get_ksz_filter_at_l2(l,pclass_sz);
// pvectsz[pclass_sz->index_multipole_for_tau_profile] = l;//pclass_sz->ell_kSZ2_gal_multipole_grid[index_l_2];
evaluate_tau_profile((l+0.5)/chi,pvecback,pvectsz,pba,pclass_sz);
taul = pvectsz[pclass_sz->index_tau_profile];//get_tau_profile_at_z_m_l(z,m,l,pclass_sz,pba);
Pk[ik] = fl*taul;
Pko[ik] = fl*taul;
Pko[ik] = fl2*taul;
// if(l>3e3)
// printf("k = %.5e pk = %.5e\n",l,Pk[ik]);
}
Expand Down Expand Up @@ -8335,6 +8344,7 @@ double k[N], Pk[N],Pko[N];
double lnk[N],lnpk[N];
int ik;
double fl;
double fl2;
double taul;
double l;
// double m = exp(logM);
Expand All @@ -8344,7 +8354,7 @@ k[ik] = exp(log(l_min)+ik/(N-1.)*(log(l_max)-log(l_min)));
lnk[ik] = log(l_min)+ik/(N-1.)*(log(l_max)-log(l_min));
l = k[ik];
fl = get_ksz_filter_at_l(l,pclass_sz);

fl2 = get_ksz_filter_at_l2(l,pclass_sz);
// pvectsz[pclass_sz->index_multipole_for_tau_profile] = l;//pclass_sz->ell_kSZ2_gal_multipole_grid[index_l_2];
// evaluate_tau_profile((l+0.5)/chi,pvecback,pvectsz,pba,pclass_sz);

Expand All @@ -8354,7 +8364,7 @@ fl = get_ksz_filter_at_l(l,pclass_sz);

taul = pvectsz[pclass_sz->index_galaxy_profile];//get_tau_profile_at_z_m_l(z,m,l,pclass_sz,pba);
Pk[ik] = fl*taul;
Pko[ik] = fl*taul;
Pko[ik] = fl2*taul;
// if(l>3e3)
// printf("k = %.5e pk = %.5e\n",l,Pk[ik]);
}
Expand Down Expand Up @@ -8439,6 +8449,7 @@ double k[N], Pk[N],Pko[N];
double lnk[N],lnpk[N];
int ik;
double fl;
double fl2;
double taul;
double l;
// double m = exp(logM);
Expand All @@ -8448,12 +8459,12 @@ k[ik] = exp(log(l_min)+ik/(N-1.)*(log(l_max)-log(l_min)));
lnk[ik] = log(l_min)+ik/(N-1.)*(log(l_max)-log(l_min));
l = k[ik];
fl = get_ksz_filter_at_l(l,pclass_sz);

fl2 = get_ksz_filter_at_l2(l,pclass_sz);
// pvectsz[pclass_sz->index_multipole_for_tau_profile] = l;//pclass_sz->ell_kSZ2_gal_multipole_grid[index_l_2];
evaluate_tau_profile((l+0.5)/chi,pvecback,pvectsz,pba,pclass_sz);
taul = pvectsz[pclass_sz->index_tau_profile];//get_tau_profile_at_z_m_l(z,m,l,pclass_sz,pba);
Pk[ik] = fl*taul;
Pko[ik] = fl*taul;
Pko[ik] = fl2*taul;
// if(l>3e3)
// printf("k = %.5e pk = %.5e\n",l,Pk[ik]);
}
Expand Down Expand Up @@ -11075,6 +11086,18 @@ else
ell);
return fl;
}
double get_ksz_filter_at_l2(double ell,
struct class_sz_structure * pclass_sz){
double fl = 1.;
if (ell <= pclass_sz->l_unwise_filter2[0] || ell >= pclass_sz->l_unwise_filter2[pclass_sz->unwise_filter2_size-1])
fl = 0.;
else
fl = pwl_value_1d(pclass_sz->unwise_filter2_size,
pclass_sz->l_unwise_filter2,
pclass_sz->f_unwise_filter2,
ell);
return fl;
}

double get_M_min_of_z(double ell,
struct class_sz_structure * pclass_sz){
Expand Down
2 changes: 2 additions & 0 deletions class-sz/source/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -6557,6 +6557,8 @@ class_read_int("no_tt_noise_in_kSZ2X_cov",pclass_sz->no_tt_noise_in_kSZ2X_cov);
// class_read_string("sBBN_file",ppr->sBBN_file);
class_read_string("ksz_filter_file",pclass_sz->ksz_filter_file);
class_read_string("projected_field_filter_file",pclass_sz->ksz_filter_file);
class_read_string("ksz_filter_file2",pclass_sz->ksz_filter_file2);
class_read_string("projected_field_filter_file2",pclass_sz->ksz_filter_file2);
class_read_string("full_path_to_dndz_gal",pclass_sz->full_path_to_dndz_gal);
class_read_string("full_path_and_prefix_to_dndz_ngal",pclass_sz->full_path_and_prefix_to_dndz_ngal);
class_read_string("full_path_to_redshift_dependent_M_min",pclass_sz->full_path_to_redshift_dependent_M_min);
Expand Down
Loading