/* * logsim1.0 by Oliver Friedrich */ /*** Installation ***/ For installation you need a compiler that is capable of the c++11 standard. Further more the gsl and cfitsio libraries must be available. In case you have installed them in a non-standard directory you will have to add a link to the path of these libraries manually into the Makefile. Type "make single" for single precision. This spares RAM, i.e. it allows you to generate more random fields simultaneously. From experience the single precision can be deemed as completely sufficient for the code. Type "make double" if you want to use double precision. /*** Features ***/ Logsim provides the following features: - Simulate several CORRELATED 2D-matter_density and/or shear fields according to ANY desired input power spectra and cross power spectra. - Have Gaussian and/or log-normal PDF for the simulated convergence and matter density fields. - Place galaxies onto the simulated shear fields, including shape noise and reduced shear. - Place galaxies onto the simulated 2D-matter densities according to linear or quadratic bias models. If you simulate two matter density fields with the power spectra P_d2(l) = P_d1_(l) * b^2(l) and with the cross power spectrum P_d12(l) = P_d1(l) * b(l), where b(l) is some scale dependent bias function, you can furthermore mimic the effect of a scale dependent bias. For details on how the code generates Gaussian and log-normal fields, please consider Simon et al 2004, Takahashi et al. 2015 and Friedrich et al. (in prep). /*** Configuration ***/ - Edit the file "configure_general" to set the general options of logsim. These are: 1. theta_max: in arcmin; the simulated patch will be a square with an area of theta_max^2 2. l_max: maximum wave number in the Fourier grid 3. p: N = 2^{2p} is the number of points of the Fourier grid 4. n_delta: number of bins of clustered galaxies 5. n_shear: number of shear fields 6. n_of_threads: Number of cores to be used (should be a power of two) - Edit the file "configure_delta_fields" to configure the different bins of clustered galaxies. Leave the headline unchanged and enter the required values into the table. Note that the number of lines in the table should agree with the value of "n_delta" that was given in "configure_general". - Edit the file "configure_kappa_fields" to configure the different bins shear fields. Leave the headline unchanged and enter the required values into the table. Note that the number of lines in the table should agree with the value of "n_kappa" that was given in "configure_general". - In the file "power_spectra" you should provide the input power spectra for the simulation. The format should become clear from the following example: Suppose you want to simulate one catalog of clustered galaxies and two shear fields. Let P_d be the power spectrum of the clustered galaxies and P_ki, i = 1,2, be the shear power spectra. Then the file "power_spectra" should contain the power spectra and cross power spectra in the following order: l P_d P_d_k1 P_d_k2 P_k1 P_k1_k2 P_k2. If you want 2 bins of clustered galaxies and one shear catalog, then the order must be: l P_d1 P_d1_d2 P_d1_k P_d2 P_d2_k P_k. Note that you should always start with the 2D-Matter power spectra. You can in principle simulate as many random fields as you like. Note however, that your file "power_spectra" should be consistent with the values for n_delta and n_kappa that were entered into "configure_general". Furthermore, your computer might run out of RAM if you try to simulate too many fields or choose a too high grid resolution. Please consider also the examplary file "power_spectra" that comes with this package. But note, that the power spectra DON'T have to be given in logarithmic steps. On a node of 64GB RAM the following table provides a guideline on how many fields can be simultaneously simulated for a given value of p, where 2^{2p} is the number of points of the simulated grid in Fourier space: p | number of fields -------------------------- 16 | 1 15 | 4 14 | 16 13 | 64 (assuming single precision, which from experience yields sufficiently accurate results) /*** Usage ***/ (Please also consult the file logsim_demo.cpp and the comments in Grid_output.cpp) Including the statements #include "Grid.cpp" into you source file will provide you with the following functions Grid::Grid(int seed) - constructor of the class Grid, seed being an integer seed value for the random number generator. Grid::print_shear_catalog(n_gal, sigma_eps, bin, output_file); Grid::print_clustered_galaxies(n_gal, bias, quadr_bias, matter_gal_correlation, bin, output_file); Grid::print_random_points(n_rand, output_file); - Functions that place catalogs of galaxies onto the generated random fields and print them. The input parameter are described in more detail inside the file Grid_output.cpp; Grid::print_delta_grid(output_file, bin); Grid::print_shear_grid(output_file, bin); - Functions that print the generated random fields on a discrete grid. /*** Exemplary data ***/ The file "power_spectra" contains exemplary power spectra, and the files "w_theta", "shear_correlations" and "xi_delta_cross_kappa" contain 2-pt statistics that should be expected from these power spectra. /*** Credits/Contact ***/ I am grateful for any comment and suggestions on this code. If you want to use it in a published scientific work, please quote Friedrich et al 2015 (in prep). For questions or comments please contact me under: oliverf@usm.uni-muenchen.de.