CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
2pt_monopole.cpp

This example shows how to measure the monopole of the two-point correlation function

// =================================================================================================
// Example code: how to measure the angle-averaged two-point correlation function, i.e. the monopole
// =================================================================================================
int main () {
try {
// -----------------------------------------------------------------
// ---------------- use default cosmological parameters ------------
// -----------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------
// ---------------- read the input catalogue (with observed coordinates: R.A., Dec, redshift) ----------------
// -----------------------------------------------------------------------------------------------------------
const std::string file_catalogue = "../input/cat.dat";
// --------------------------------------------------------------------------------------
// ---------------- construct the random catalogue (with cubic geometry) ----------------
// --------------------------------------------------------------------------------------
const double N_R = 1.; // random/data ratio
// --------------------------------------------------------------------------------------------
// ---------------- measure the monopole of the two-point correlation function ----------------
// --------------------------------------------------------------------------------------------
// binning parameters and output data
const double rMin = 5.; // minimum separation
const double rMax = 20.; // maximum separation
const int nbins = 5; // number of bins
const double shift = 0.5; // spatial shift used to set the bin centre
const std::string dir = "../output/";
const std::string file = "xi.dat";
// measure the monopole and compute Poisson errors
cbl::measure::twopt::TwoPointCorrelation1D_monopole TwoP {catalogue, random_catalogue, cbl::BinType::_logarithmic_, rMin, rMax, nbins, shift};
// store the output data
TwoP.write(dir, file);
}
catch(cbl::glob::Exception &exc) { std::cerr << exc.what() << std::endl; exit(1); }
return 0;
}
int main()
main function to create the logo of the CosmoBolognaLib
Definition: Logo.cpp:41
The class TwoPointCorrelation1D_monopole.
The class Catalogue.
Definition: Catalogue.h:654
The class Cosmology.
Definition: Cosmology.h:277
The class Exception.
Definition: Exception.h:111
const char * what() const noexcept override
the error description
Definition: Exception.h:203
@ _createRandom_box_
random catalogue with cubic geometry (or parallelepiped) in comoving coordinates
@ _Planck15_
Planck collaboration 2015, paper XIII: Table 4, TT,TE,EE+lowP+lensing.
@ _Poisson_
Poissonian error.
@ _observed_
observed coordinates (R.A., Dec, redshift)
@ _logarithmic_
logarithmic binning