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

This example shows how to how to measure the number counts of a catalogue

// ==============================================================================================
// Example code: how to measure the number counts of a catalogue, i.e. the redshift distribution
// ==============================================================================================
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";
// -------------------------------------------------------------------
// ---------------- measure the redshift distribution ----------------
// -------------------------------------------------------------------
// binning parameters and output data
const int nbin = 10;
const std::string dir = "../output/";
const std::string file = "redshift_distribution.dat";
// measure the redshift distribution and compute Poisson errors
// store the output data
NC.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 NumberCounts1D_Redshift.
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
void measure(const ErrorType errorType=ErrorType::_Poisson_, const std::string dir_output_resample=par::defaultString, const int nResamplings=0, const int seed=3213, const bool conv=false, const double sigma=0.) override
measure the number counts
@ _Planck15_
Planck collaboration 2015, paper XIII: Table 4, TT,TE,EE+lowP+lensing.
@ _Poisson_
Poissonian error.
@ _observed_
observed coordinates (R.A., Dec, redshift)