This example shows how to model the 2D two-point correlation function in redshift space
try {
const std::string file_catalogue = "../input/cat.dat";
const double N_R = 3.;
const double rMin = 5.;
const double rMax = 50.;
const int nbins = 10;
const double shift = 0.5;
const std::string dir = "../output/";
const std::string file = "xi2D.dat";
const auto TwoP =
cbl::measure::twopt::TwoPointCorrelation::Create(
cbl::measure::twopt::TwoPType::_2D_Cartesian_, catalogue, random_catalogue,
cbl::BinType::_linear_, rMin, rMax, nbins, shift,
cbl::BinType::_linear_, rMin, rMax, nbins, shift);
TwoP->write(dir, file);
const std::vector<double> fsigma8_limits = {0., 1.};
const std::vector<double> bsigma8_limits = {0.8*cosmology.
sigma8(), 3.*cosmology.
sigma8()};
const double redshift = 1.;
const double min = 1., max = 40.;
const int chain_size = 100;
const int nwalkers = 10;
const int seed = 666;
std::vector<double> starting_parameters = {0.5, 1.5, 100.};
const std::string chain_file = "chain_cartesian_bias_sigmav.dat";
const int burn_in = 0;
const int thin = 1;
model_twop.
write_chain(dir, chain_file, burn_in, thin);
}
return 0;
}
int main()
main function to create the logo of the CosmoBolognaLib
The class Modelling_TwoPointCorrelation2D_cartesian.
void set_sigma8(const double sigma8=-1.)
set the value of σ8
double sigma8() const
get the private member Cosmology::m_sigma8
const char * what() const noexcept override
the error description
static std::shared_ptr< TwoPointCorrelation > Create(const TwoPType type, const catalogue::Catalogue data, const catalogue::Catalogue random, const BinType binType, const double Min, const double Max, const int nbins, const double shift, const CoordinateUnits angularUnits=CoordinateUnits::_radians_, std::function< double(double)> angularWeight=nullptr, const bool compute_extra_info=false, const double random_dilution_fraction=1.)
static factory used to construct two-point correlation functions of any type
void write_chain(const std::string output_dir, const std::string output_file, const int start=0, const int thin=1, const bool is_FITS_format=false, const int prec=5, const int ww=14)
write the chains obtained after the MCMC sampling
void show_results(const int start=0, const int thin=1, const int nbins=50, const bool show_mode=false, const int ns=-1)
show the results of the MCMC sampling on screen
virtual void write_model_from_chains(const std::string output_dir, const std::string output_file, const std::vector< double > xx, const int start=0, const int thin=1)
write the model at xx computing 16th, 50th and 84th percentiles from the chains
void set_likelihood(const statistics::LikelihoodType likelihood_type, const std::vector< size_t > x_index={0, 2}, const int w_index=-1, const double prec=1.e-10, const int Nres=-1)
set the likelihood function
void sample_posterior(const int chain_size, const int nwalkers, const int seed=666, const double aa=2, const bool parallel=true)
sample the posterior, initializing the chains by drawing from the prior distributions
void set_fit_range(const double xmin, const double xmax)
set the fit range
The class Modelling_TwoPointCorrelation2D_cartesian.
void set_model_dispersion(const statistics::PriorDistribution fsigma8_prior={}, const statistics::PriorDistribution bsigma8_prior={}, const statistics::PriorDistribution sigmav_prior={}, const statistics::PriorDistribution alpha_perp_prior={cbl::glob::DistributionType::_Constant_, 1.}, const statistics::PriorDistribution alpha_par_prior={cbl::glob::DistributionType::_Constant_, 1.})
set the dispersion model to fit the 2D two-point correlation function, in Cartesian coordinates
void set_data_model(const cbl::cosmology::Cosmology cosmology={}, const double redshift=0., const std::string method_Pk="CAMB", const double sigmaNL=0, const bool NL=true, const int FV=0, const bool store_output=true, const std::string output_root="test", const bool bias_nl=false, const double bA=-1., const bool xiType=false, const double k_star=-1., const bool xiNL=false, const double v_min=-5000., const double v_max=5000., const int step_v=500, const int norm=-1, const double r_min=0.1, const double r_max=150., const double k_min=0., const double k_max=100., const int step=200, const double aa=0., const bool GSL=true, const double prec=1.e-2, const std::string file_par=par::defaultString)
set the parameters for the computation of the dark matter two-point correlation function
The class PriorDistribution.
@ _createRandom_box_
random catalogue with cubic geometry (or parallelepiped) in comoving coordinates
@ _Constant_
Constant function.
@ _Uniform_
Identity function.
@ _2D_Cartesian_
2D two-point correlation function in Cartesian coordinates, ξ(rp,π)
@ _Poisson_
Poissonian error.
@ _Gaussian_Error_
Gaussian likelihood error.
@ _observed_
observed coordinates (R.A., Dec, redshift)