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

This example shows how to construct a log-normal density field catalogue

// ===================================================================
// Example code: how to construct a log-normal density field catalogue
// ===================================================================
#include "LogNormal.h"
int main () {
try {
// --------------------------------------
// ----- set the cosmological model -----
// --------------------------------------
// -------------------------------------------------------------
// ----- set the object to construct log-normal catalogues -----
// -------------------------------------------------------------
// the random catalogues used to construct the mask
// mean number of objects in the log-normal catalogues
const int nObjects = 1110;
// mean redshit of the log-normal catalogues
const double redshift = 1.;
// the bias of the log-normal density field catalogues
const double bias = 1.;
// the cell size in comoving scale [Mpc/h]
const double cell_size = 5.;
cbl::lognormal::LogNormal logNormal(random, cosmology, nObjects, redshift, bias, cell_size);
// ---------------------------------------------------------------------------------------------
// ----- construct one log-normal calalogue and get the number of objects in the catalogue -----
// ---------------------------------------------------------------------------------------------
if (system("mkdir -p ../output/")) {}
logNormal.generate(1, "../output/");
std::cout << "The number of objects in the log-normal catalogue is " << logNormal.catalogue(0)->nObjects() << std::endl;
}
catch(cbl::glob::Exception &exc) { std::cerr << exc.what() << std::endl; exit(1); }
return 0;
}
Implementation of the log-normal data structure.
int main()
main function to create the logo of the CosmoBolognaLib
Definition: Logo.cpp:41
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
The class LogNormal.
Definition: LogNormal.h:58
void generate(const int n_lognormal_mocks, const std::string output_dir, const std::string filename="lognormal", const int start=1, const int seed=3213)
generate the log-normal mock catalogues
Definition: LogNormal.cpp:62
std::shared_ptr< catalogue::Catalogue > catalogue(const size_t i)
get the private member LogNormal::m_LNCat[i]
Definition: LogNormal.cpp:47
@ _Planck18_
Planck collaboration 2018, Paper VI: Table 2, TT,TE,EE+lowE+lensing.
double bias(const double Mmin, const double sigmalgM, const double M0, const double M1, const double alpha, const std::shared_ptr< void > inputs)
the mean galaxy bias
@ _comoving_
comoving coordinates (x, y, z)