Skip to content

Commit

Permalink
added param example
Browse files Browse the repository at this point in the history
  • Loading branch information
damonge committed Nov 9, 2021
1 parent c074de3 commit c4a64c2
Show file tree
Hide file tree
Showing 6 changed files with 183 additions and 34 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ DEFINEFLAGS += -D_BIAS_MODEL_2
#Use linear bias model
#DEFINEFLAGS += -D_BIAS_MODEL_3
#Use new lensing method
#DEFINEFLAGS += -D_USE_NEW_LENSING
#DEFINEFLAGS += -D_USE_FAST_LENSING
#Generate debug help. Only useful for development
DEFINEFLAGS += -D_DEBUG
#Use double precision floating point? Set to "yes" or "no"
USE_SINGLE_PRECISION = yes
#Add random perturbations to kappa from redshifts outside the box
ADD_EXTRA_KAPPA = yes
#ADD_EXTRA_KAPPA = yes
#Compile with HDF5 capability? Set to "yes" or "no"
USE_HDF5 = no
#Use OMP parallelization? Set to "yes" or "no"
Expand Down
149 changes: 149 additions & 0 deletions param_example.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
global:
{
#Output prefix. Output will be in prefix_<node ID>.<fits/txt>
prefix_out= "examples/simple/out";
#Output format. Select HDF5, FITS or ASCII
output_format= "FITS";
#Output Gaussian overdensity field at z=0?
output_density= true
#Path to power spectrum at z=0. Power spectrum file must
#be in CAMB format: k (h/Mpc), P(k) (Mpc/h)^3.
pk_filename= "examples/simple/Pk_CAMB_test.dat"
#This redshift range also defines the size of the box
z_min= 0.001
z_max= 0.450
#RNG seed note that output will depend on number of nodes, etc not only
#on the RNG seed
seed= 1003
#Set to true if you want to generate the theory prediction for the 3D power spectrum
#of the different tracers.
write_pred=false
#Intervals of redshift at which the prediction will be produced.
pred_dz=0.1
#If write_pred is true, set this to true if you just want to generate the prediction
#and then exit. This is also useful if you want to inspect the memory requirements
#before a run.
just_write_pred= true
}

field_par:
{
#Extra Gaussian smoothing scale [Mpc/h] (set to a
#negative value if you don't want any smoothing)
r_smooth= 5.
#Do you want to smooth the Newtonian potential as well?
smooth_potential= true
#Will use a Cartesian grid with n_grid^3 cells
n_grid= 256
#Density field type
# 0-lognormal
# 1-1LPT
# 2-1LPT
dens_type= 1
#If dens_type==1 or 2, buffer size (fraction per particle)
lpt_buffer_fraction= 0.6
#If dens_type==1 or 2, scheme to interpolate particle
#positions into a grid
# 0-NGP
# 1-CIC
# 2-TSC
lpt_interp_type= 1
#Set to 1 if you want to output the LPT particle positions
output_lpt= 0
}

cosmo_par:
{
#Non-relativistic matter
omega_M= 0.3
#Dark energy
omega_L= 0.7
#Baryons
omega_B= 0.05
#Hubble parameter (in units of 100 km/s/Mpc)
h= 0.7
#Dark energy equation of state
w= -1.0
#Primordial scalar spectral index, used only to extrapolate
#P(k) at low k end (-3 used at high k end)
ns= 0.96
#Power spectrum normalization. The input power spectrum will be
#renormalized to this sigma8
sigma_8= 0.803869
}

#For each galaxy population, create a section called srcsX, starting with X=1
srcs1:
{
#Path to N(z) file. Should contain two columns
# 1-> z, 2-> dN(z)/dz*dOmega
# with dN/dzdOmega in units of deg^-2
nz_filename= "examples/simple/Nz_test.txt"
#Path to bias file. Should contain two columns
# 1-> z, 2-> b(z)
bias_filename= "examples/simple/Bz_test.txt"
#Do you want to include shear ellipticities?
include_shear= true
#Do you want to store line-of-sight skewers for each object?
store_skewers= true
#You can also store the Gaussian density field (instead of the non-Gaussian one)
#This is false by default.
gaussian_skewers= false
}

srcs2:
{
nz_filename= "examples/simple/Nz2_test.txt"
bias_filename= "examples/simple/Bz2_test.txt"
include_shear= false
store_skewers= true
}

#For each intensity mapping species, create a section called imapX,
#starting with X=1
imap1:
{
#Tabulated background temperature as a function of redshift
tbak_filename= "examples/simple/Tz_test.txt"
#Tabulated linear bias as a function of redshift
bias_filename= "examples/simple/Bz_test.txt"
#Frequency bands in which to output maps. Should contain 2 columns:
# 1-> nu_ini, 2-> nu_end
freq_list= "examples/simple/nuTable.txt"
#Rest-frame frequency of this species (in the same units as the
#frequencies in freq_list).
freq_rest= 1420.405
#HEALPix resolution parameter.
nside= 64
}

#Include a section entitled kappa if you want to generate maps
#of the lensing convergence at specific redshifts.
kappa:
{
#Redshifts at which maps should be generated
z_out= [0.4]
nside= 64
}

#Include a section entitled isw if you want to generate maps
#of the ISW effect (time derivative of the gravitational potential).
isw:
{
z_out= [0.4]
nside= 64
}

#This section is needed if using the fast lensing method
lensing:
{
# Maximum Nside used for the lensing shells.
nside= 256
# Select number of slices.
n_lensing= 11
# Select spacing type ("r" or "log(1+z)").
spacing_type= "r"
# Set to true if you want to output the different
# lensing shells.
write=false
}
12 changes: 6 additions & 6 deletions src/beaming.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,10 @@ void get_beam_properties(ParamCoLoRe *par)

if(par->do_kappa)
kappa_beams_preproc(par);
#ifdef _USE_NEW_LENSING
#ifdef _USE_FAST_LENSING
if(par->do_lensing)
lensing_beams_preproc(par);
#endif //_USE_NEW_LENSING
#endif //_USE_FAST_LENSING
if(par->do_isw)
isw_beams_preproc(par);
if(par->do_srcs)
Expand Down Expand Up @@ -337,10 +337,10 @@ void get_beam_properties(ParamCoLoRe *par)

if(par->do_kappa)
kappa_get_beam_properties(par);
#ifdef _USE_NEW_LENSING
#ifdef _USE_FAST_LENSING
if(par->do_lensing)
lensing_get_beam_properties(par);
#endif //_USE_NEW_LENSING
#endif //_USE_FAST_LENSING
if(par->do_isw)
isw_get_beam_properties(par);
if(par->do_srcs)
Expand All @@ -356,10 +356,10 @@ void get_beam_properties(ParamCoLoRe *par)

if(par->do_kappa)
kappa_beams_postproc(par);
#ifdef _USE_NEW_LENSING
#ifdef _USE_FAST_LENSING
if(par->do_lensing)
lensing_beams_postproc(par);
#endif //_USE_NEW_LENSING
#endif //_USE_FAST_LENSING
if(par->do_isw)
isw_beams_postproc(par);
if(par->do_srcs)
Expand Down
12 changes: 6 additions & 6 deletions src/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ ParamCoLoRe *read_run_params(char *fname,int test_memory)
conf_read_int(conf,"kappa","nside",&(par->nside_kappa));
}

#ifdef _USE_NEW_LENSING
#ifdef _USE_FAST_LENSING
//Lensing maps
cset=config_lookup(conf,"lensing");
if(cset!=NULL) {
Expand All @@ -416,7 +416,7 @@ ParamCoLoRe *read_run_params(char *fname,int test_memory)
// Check lensing exists if requested with catalog
if(par->do_srcs_lensing && !(par->do_lensing))
report_error(1,"Include a \"lensing\" section if you want lensing with your galaxies\n");
#endif //_USE_NEW_LENSING
#endif //_USE_FAST_LENSING

cset=config_lookup(conf,"isw");
if(cset!=NULL) {
Expand Down Expand Up @@ -542,15 +542,15 @@ ParamCoLoRe *read_run_params(char *fname,int test_memory)
if(par->do_kappa)
par->kmap=hp_shell_alloc(1,par->nside_kappa,par->nside_base,par->n_kappa);

#ifdef _USE_NEW_LENSING
#ifdef _USE_FAST_LENSING
if(par->do_lensing) {
flouble *r_arr=compute_lensing_spacing(par);
par->smap = hp_shell_adaptive_alloc(5, par->nside_lensing, par->nside_base,
par->n_lensing, r_arr, par->l_box/par->n_grid,
1.);
free(r_arr);
}
#endif //_USE_NEW_LENSING
#endif //_USE_FAST_LENSING

if(par->do_isw)
par->pd_map=hp_shell_alloc(1,par->nside_isw,par->nside_base,par->n_isw);
Expand Down Expand Up @@ -1317,12 +1317,12 @@ void param_colore_free(ParamCoLoRe *par)
#endif //_ADD_EXTRA_KAPPA
}

#ifdef _USE_NEW_LENSING
#ifdef _USE_FAST_LENSING
if(par->do_lensing) {
if(par->smap!=NULL)
hp_shell_adaptive_free(par->smap);
}
#endif //_USE_NEW_LENSING
#endif //_USE_FAST_LENSING

if(par->do_isw) {
if(par->pd_map!=NULL)
Expand Down
16 changes: 8 additions & 8 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ int main(int argc,char **argv)
//Get information from slabs
if(par->do_kappa)
kappa_set_cartesian(par);
#ifdef _USE_NEW_LENSING
#ifdef _USE_FAST_LENSING
if(par->do_lensing)
lensing_set_cartesian(par);
#endif //_USE_NEW_LENSING
#endif //_USE_FAST_LENSING
if(par->do_isw)
isw_set_cartesian(par);
if(par->do_srcs)
Expand All @@ -90,10 +90,10 @@ int main(int argc,char **argv)
//Distribute information across
if(par->do_kappa)
kappa_distribute(par);
#ifdef _USE_NEW_LENSING
#ifdef _USE_FAST_LENSING
if(par->do_lensing)
lensing_distribute(par);
#endif //_USE_NEW_LENSING
#endif //_USE_FAST_LENSING
if(par->do_isw)
isw_distribute(par);
if(par->do_srcs)
Expand All @@ -106,10 +106,10 @@ int main(int argc,char **argv)
//Postprocess after
if(par->do_kappa)
kappa_get_local_properties(par);
#ifdef _USE_NEW_LENSING
#ifdef _USE_FAST_LENSING
if(par->do_lensing)
lensing_get_local_properties(par);
#endif //_USE_NEW_LENSING
#endif //_USE_FAST_LENSING
if(par->do_isw)
isw_get_local_properties(par);
if(par->do_srcs)
Expand All @@ -127,10 +127,10 @@ int main(int argc,char **argv)
//Write output
if(par->do_kappa)
write_kappa(par);
#ifdef _USE_NEW_LENSING
#ifdef _USE_FAST_LENSING
if(par->do_lensing && par->write_lensing)
write_lensing(par);
#endif ///_USE_NEW_LENSING
#endif ///_USE_FAST_LENSING
if(par->do_isw)
write_isw(par);
if(par->do_srcs)
Expand Down
Loading

0 comments on commit c4a64c2

Please sign in to comment.