SkillAgentSearch skills...

KDTPCF

Two-point correlation code using k-d tree method. Active developing; many more functions to be added.

Install / Use

/learn @wll745881210/KDTPCF
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

#+STARTUP: indent #+TITLE: Two-point correlation with k-d tree method #+AUTHOR: Lile Wang #+EMAIL: lilew@princeton.edu #+UPDATE: June 22 2013 #+LANGUAGE: en

  • Copyright and warranty info

KDTPCF: Two-point statistics using k-d tree. Copyright (C) 2013 Lile Wang; lilew@princeton.edu

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

** The following people also contributed to the code:

  • Martin White
  • Jeremy Tinker
  • Introduction

This code calculates the two-point statistics for a given catalog of galaxies. Basic schemes are based on

  • Dolence & Brunner (2007) http://goo.gl/KCiez

with some simplifications as well as extensions. It now can calculate spatial (can be azimuthal averaged or 2-D, i.e. along and perpandicular to the line of sight) and angular correlation, using jackknife method to estimate the errors. With OpenMP equipped, it can be run parallely.

Please be careful about the changes, made by some updates, to the definitions of parameter file and the output files.

  • Compilation

This code does not depend on any non-standard C++ library; it uses nothing more than the STL.

Just type in "make" in your terminal if you have:

  • [X] GNU make;
  • [X] g++;

and the name of the exectuable file is "kdtpcf".

Note: If necessary, you should feel free to modify the Makefile: it is written by a human instead of being generated by the computer.

  • Usage

** Input file

This code requires a catalog and a random (with the same boundary as the catalog) to calculate auto pair-countings DD, RR and cross pair-counting DR. Those two files should be ascii files without header.

*** Unweighted catalog/random for spatial correlation

| Column | Value | |--------+------------------------------| | 1 | RA (in deg) | | 2 | Dec (in deg) | | 3 | Redshift z | | Others | Ignored (max 128 characters) |

*** Weighted catalog/random for spatial correlation

| Column | Value | |--------+------------------------------| | 1 | RA (in deg) | | 2 | Dec (in deg) | | 3 | Redshift z | | 4 | Weight | | Others | Ignored (max 128 characters) |

*** Unweighted catalog/random for angular correlation

| Column | Value | |--------+------------------------------| | 1 | RA (in deg) | | 2 | Dec (in deg) | | Others | Ignored (max 128 characters) |

*** Weighted catalog/random for angular correlation

| Column | Value | |--------+------------------------------| | 1 | RA (in deg) | | 2 | Dec (in deg) | | 3 | Weight | | Others | Ignored (max 128 characters) |

** Parameter file

Please refer to "par.txt" as an example. The parameter file is case sensitive. You may create your own parameter file and modify the sequence of items, but please do leave header "CORR_FUNC" and "Init" intact. The "par.txt" file looks like this:

| CORR_FUNC | | |-----------------+--------------------| | Init | | | s_max | 130 | | s_min | 1 | | s_bin_num | 20 | | phi_bin_num | 40 | | regular_phi_bin | 0 | | log_bin | 0 | | file_data | <data_file_name> | | file_rand | <random_file_name> | | out_name_base | <out_name_base> | | lambda | 0.7 | | z_max | 5 | | corr_stat | 1 | | weighted_bin | 0 | | jackknife_depth | 4 | | bin_count_type | 1 | | num_threads | 2 |

Explanations to keys:

  • s_max, s_min, s_bin_num, phi_bin_num:

This code gives pair-counting results in different distance (spatial or angular separation) bins. Those values will specify a binning system with constant binning width in linear manner. "s_max" and "s_min" for maximum and minimum separatuib respectively (in deg for angular separation and Mpc/h for spatial separation); "s_bin_num" gives the number of bins in separation; "phi_bin_num" gives binning number of the angle ("phi"), or its cosine (see "regular_phi_bin"), between the separation vector and the line of sight (this key can be missing if you do not calculate the 2-D correlation). If missing, s_max = 30, s_min = 1, s_bin_num = 20 and phi_bin_num = 40;

  • regular_phi_bin:

0 or missing for angular bins that are regularly distributed in cos(phi) (which is typically referred to as "mu"), 1 for those that are regularly distributed in phi.

  • log_bin:

0 or missing for linear binning distribution, and 1 for logarithm binning distribution. Please do not set s_min <= 0 when using log binning!

  • file_data, file_rand:

File names, for the catalog and the random file, respectively. If missing, file_data = "catalog" and file_rand = "random".

  • out_name_base:

"Base" for the output file name. If specified, the name of the outputs are named as (if they are to be output):

"<out_name_base>_ddbins"

"<out_name_base>_rrbins"

"<out_name_base>_drbins"

"<out_name_base>_corr"

If this entry is missing, the output files are:

"<data_file_name>_ddbins"

"<random_file_name>_rrbins"

"<data_file_name>_<random_file_name>_drbins"

"<data_file_name>_<random_file_name>_corr"

  • lambda, z_max:

Cosmological lambda and maximum value of redshift. If missing, lambda = 0.7 and z_max = 5 respectively. Can be missing when doing angular correlations.

  • weighted_bin:

0 or missing for unweighted correlation calculation (in other words, the weight for each galaxy is set to 1), 1 for weighted correlation.

  • corr_stat:

0 for angular correlation; 1 or missing for azimuthaly averaged spatial correlation; 2 for 2-D spatial correlation.

  • jackknife_depth

Logarithm of the number of jackknife samples with base 2. Should be an integer. If jackknife_depth <= 0 or this key is missing, the default value (jackknife_depth = 4) will be automatically adopted.

  • bin_count_type

| bin_count_type | What will be calculated | |----------------+-------------------------| | 0 | dd, dr, rr | | 1 | dd, dr, rr, ls | | 2 | dd | | 3 | rr | | 4 | dr | | 5 | dd, dr | | 6 | dd, rr | | 7 | dr, rr |

"dd": auto pair-counts of the data catalog;

"rr": auto pair-counts of the random sample;

"dr": cross pair-counts between the data catalog and the random;

"ls": estimation of correlation function using Landy-Sazlay estimator and jackknife method.

Please note that the pair-counts are normalized!

  • num_threads:

Number of threads with which the program is parallelized. A number that equals to (or slightly greater than) some power of 2 works better. If this key is set to 1, 0 or the key is missing, the program is run serially.

** Run!

$ ./test_corr <parameter_file>

** Output

*** For "_ddbins", "_rrbins" and "_drbins" (pair-counts) files:

Special Notes!

Please note that the pair-counts are normalized by the square of source number in the sample for dd and rr, and by the product of source number between the catalog and the random for dr.

1-D correlation:

| Column | Content | |----------+------------------------------------------| | 1 | Minimum of s (in Mpc/h) in the bin | | 2 | Central value of s (in Mpc/h) in the bin | | 3 | Maximum of s (in Mpc/h) in the bin | | 4 | Pair-counts in the bin | | The rest | "Jackknife" pair-counts in the bin |

s is the redshift space separation.

2-D correlation:

| Column | Content | |----------+------------------------------------------| | 1 | Minimum of s (in Mpc/h) in the bin | | 2 | Central value of s (in Mpc/h) in the bin | | 3 | Maximum of s (in Mpc/h) in the bin | | 4 | Minimum of phi (in deg) in the bin | | 5 | Central value of phi (in deg) in the bin | | 6 | Minimum of phi (in deg) in the bin | | 7 | Pair-counts in the bin | | The rest | "Jackknife" pair-counts in the bin |

phi (in deg) indicates the angle between the line of sight and the separation vector.

*** For "_corr" files:

1-D correlation:

| Column | Content | |----------+------------------------------------------| | 1 | Minimum of s (in Mpc/h) in the bin | | 2 | Central value of s (in Mpc/h) in the bin | | 3 | Maximum of s (in Mpc/h) in the bin | | 4 | LS estimate of correlation function | | 5 | "Jackknife" error estimate |

s is the redshift-space separation.

2-D correlation:

| Column | Content | |----------+------------------------------------------| | 1 | Minimum of s (in Mpc/h) in the bin | | 2 | Central value of s (in Mpc/h) in the bin | | 3 | Maximum of s (in Mpc/h) in the bin | | 4 | Minimum of phi (in deg) in the bin | | 5 | Central value of phi (in deg) in the bin | | 6 | Minimum of phi (in

Related Skills

View on GitHub
GitHub Stars14
CategoryDevelopment
Updated2y ago
Forks2

Languages

C++

Security Score

75/100

Audited on Mar 6, 2024

No findings