CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
3pt.cpp

This example shows how to measure the three-point correlation function

// ========================================================================================
// Example code: how to measure the connected and reduced three-point correlation functions
// ========================================================================================
#include "GlobalFunc.h"
int main () {
try {
// --------------------------------------------------------------
// ---------------- set the cosmological parameters ------------
// --------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------
// ---------------- read the input catalogue (with observed coordinates: R.A., Dec, redshift) ----------------
// -----------------------------------------------------------------------------------------------------------
std::string file_catalogue = "../input/cat.dat";
// --------------------------------------------------------------------------------------
// ---------------- construct the random catalogue (with cubic geometry) ----------------
// --------------------------------------------------------------------------------------
const double N_R = 2.; // random/data ratio
// construct the sub-regions used for jackknife and bootstrap
std::cout << "I'm constructing the sub-regions used for jackknife and bootstrap..." << std::endl;
const int nx = 3, ny = 3, nz = 3;
cbl::set_ObjectRegion_SubBoxes(catalogue, random_catalogue, nx, ny, nz);
// -------------------------------------------------------------------------------
// ---------------- measure the three-point correlation functions ----------------
// -------------------------------------------------------------------------------
// binning parameters
const double side_s = 5.; // 1st side of the triangle
const double side_u = 2.; // ratio between the 1st and 2nd sides of the triangle (u*s)
const int nbins = 10; // number of bins
// output data
const std::string dir_output = "../output/";
const std::string dir_triplets = dir_output;
const std::string dir_2pt = dir_output;
const std::string file_output = "3ptJK.dat";
// measure the connected and reduced three-point correlation functions and write the output
ThreeP->measure(cbl::measure::ErrorType::_None_, dir_triplets);
ThreeP->write(dir_output, file_output);
}
catch(cbl::glob::Exception &exc) { std::cerr << exc.what() << std::endl; exit(1); }
return 0;
}
Generic functions that use one or more classes of the CosmoBolognaLib.
int main()
main function to create the logo of the CosmoBolognaLib
Definition: Logo.cpp:41
The class ThreePointCorrelation_comoving_reduced.
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
static std::shared_ptr< ThreePointCorrelation > Create(const ThreePType type, const catalogue::Catalogue data, const catalogue::Catalogue random, const triplets::TripletType tripletType, const double side_s, const double side_u, const double perc_increase, const int nbins)
static factory used to construct three-point correlation functions of any type
@ _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.
@ _comoving_connected_
the connected three-point correlation function in comoving coordinates
@ _None_
No error computed.
@ _comoving_side_
1D triplet in comoving coordinates and linear bins
@ _observed_
observed coordinates (R.A., Dec, redshift)
void set_ObjectRegion_SubBoxes(catalogue::Catalogue &data, const int nx, const int ny, const int nz)
set the object region in sub-boxes
Definition: SubSample.cpp:236