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

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

// =======================================================================
// Example code: how to measure the angular two-point correlation function
// =======================================================================
int main () {
try {
// -----------------------------------------------------------------------------------------------------------------
// ---------------- read the input catalogue (with observed coordinates: R.A., Dec) --------------------------------
// -----------------------------------------------------------------------------------------------------------------
const std::string file_catalogue = "../input/cat2d.dat";
// ----------------------------------------------------------------
// ---------------- construct the random catalogue ----------------
// ----------------------------------------------------------------
const double N_R = 1.; // random/data ratio
// ------------------------------------------------------------------------------------
// ---------------- measure the angular two-point correlation function ----------------
// ------------------------------------------------------------------------------------
// binning parameters and output data
const double angMin = 0.01; // minimum angular separation
const double angMax = 1.; // maximum angular separation
const int nbins = 20; // number of bins
const double shift = 0.5; // shift used to set the bin centre
const cbl::CoordinateUnits angularUnits = cbl::CoordinateUnits::_degrees_; // angular units
const std::string dir = "../output/";
const std::string file = "xi_angular.dat";
// measure the angular two-point correlation function and store the results
cbl::measure::twopt::TwoPointCorrelation1D_angular TwoP {catalogue, random_catalogue, cbl::BinType::_linear_, angMin, angMax, nbins, shift, angularUnits};
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_angular.
The class Catalogue.
Definition: Catalogue.h:654
The class Exception.
Definition: Exception.h:111
const char * what() const noexcept override
the error description
Definition: Exception.h:203
@ _createRandom_square_
random catalogue with square geometry in observed coordinates (R.A., Dec)
@ _Poisson_
Poissonian error.
@ _observed_
observed coordinates (R.A., Dec, redshift)
CoordinateUnits
the coordinate units
Definition: Kernel.h:562
@ _degrees_
angle in degrees
@ _linear_
linear binning