CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
cbl::modelling::twopt::Modelling_TwoPointCorrelation2D Class Reference

The class Modelling_TwoPointCorrelation2D. More...

#include <Modelling_TwoPointCorrelation2D.h>

Inheritance diagram for cbl::modelling::twopt::Modelling_TwoPointCorrelation2D:
Collaboration diagram for cbl::modelling::twopt::Modelling_TwoPointCorrelation2D:

Public Member Functions

Constructors/destructors
 Modelling_TwoPointCorrelation2D ()=default
 default constuctor
 
 Modelling_TwoPointCorrelation2D (const std::shared_ptr< cbl::measure::twopt::TwoPointCorrelation > twop)
 constructor More...
 
 Modelling_TwoPointCorrelation2D (const std::shared_ptr< cbl::data::Data > dataset, const measure::twopt::TwoPType twoPType)
 constructor More...
 
virtual ~Modelling_TwoPointCorrelation2D ()=default
 default destructor
 
Member functions used to set the model parameters
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 More...
 
- Public Member Functions inherited from cbl::modelling::twopt::Modelling_TwoPointCorrelation
measure::twopt::TwoPType twoPType ()
 get the member m_twoPType More...
 
std::shared_ptr< modelling::twopt::STR_data_modeldata_model ()
 get the member m_data_model More...
 
 Modelling_TwoPointCorrelation ()=default
 default constuctor
 
virtual ~Modelling_TwoPointCorrelation ()=default
 default destructor
 
- Public Member Functions inherited from cbl::modelling::Modelling
void m_set_posterior (const int seed)
 set the interal variable m_posterior More...
 
 Modelling ()=default
 default constuctor
 
virtual ~Modelling ()=default
 default destructor
 
std::shared_ptr< data::Datadata ()
 return the dataset More...
 
std::shared_ptr< data::Datadata_fit ()
 return the dataset More...
 
std::shared_ptr< statistics::Likelihoodlikelihood ()
 return the likelihood parameters More...
 
std::shared_ptr< statistics::Posteriorposterior ()
 return the posterior parameters More...
 
std::shared_ptr< statistics::ModelParameterslikelihood_parameters ()
 return the likelihood parameters More...
 
std::shared_ptr< statistics::ModelParametersposterior_parameters ()
 return the posterior parameters More...
 
virtual void set_parameter_from_string (const std::string parameter, const double value)
 set the value of a parameter providing its name string More...
 
virtual double get_parameter_from_string (const std::string parameter) const
 get the value of a parameter providing its name string More...
 
std::shared_ptr< statistics::PriorDistributionget_prior (const int i)
 get the internal variable m_parameter_priors More...
 
std::shared_ptr< statistics::Modelget_response_function ()
 return the response function used to compute the super-sample covariance More...
 
void reset_fit_range ()
 reset the fit range More...
 
void set_fit_range (const double xmin, const double xmax)
 set the fit range More...
 
void set_fit_range (const double xmin, const double xmax, const double ymin, const double ymax)
 set the fit range More...
 
void set_data (const std::shared_ptr< data::Data > dataset)
 set the dataset More...
 
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 More...
 
void set_likelihood (const cbl::statistics::Likelihood_function log_likelihood_function)
 set the likelihood function, given a user-defined log-likelihood function More...
 
void maximize_likelihood (const std::vector< double > start, const std::vector< std::vector< double >> parameter_limits, const unsigned int max_iter=10000, const double tol=1.e-6, const double epsilon=1.e-3)
 function that maximizes the posterior, finds the best-fit parameters and stores them in the model More...
 
void maximize_posterior (const std::vector< double > start, const unsigned int max_iter=10000, const double tol=1.e-6, const double epsilon=1.e-3, const int seed=666)
 function that maximizes the posterior, finds the best-fit parameters and stores them in the model More...
 
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 More...
 
void sample_posterior (const int chain_size, const int nwalkers, const double radius, const std::vector< double > start, const unsigned int max_iter=10000, const double tol=1.e-6, const double epsilon=1.e-3, const int seed=666, const double aa=2, const bool parallel=true)
 sample the posterior, initializing the chains in a ball around the posterior best-fit parameters values More...
 
void sample_posterior (const int chain_size, const int nwalkers, std::vector< double > &value, const double radius, const int seed=666, const double aa=2, const bool parallel=true)
 sample the posterior, initializing the chains by drawing from the prior distributions More...
 
void sample_posterior (const int chain_size, const std::vector< std::vector< double >> chain_value, const int seed=666, const double aa=2, const bool parallel=true)
 sample the posterior, initializing the chains with input values More...
 
void sample_posterior (const int chain_size, const int nwalkers, const std::string input_dir, const std::string input_file, const int seed=666, const double aa=2, const bool parallel=true)
 sample the posterior, initializing the chains reading the input values from an input file More...
 
void importance_sampling (const std::string input_dir, const std::string input_file, const int seed=666, const std::vector< size_t > column={}, const int header_lines_to_skip=1, const bool is_FITS_format=false, const bool apply_to_likelihood=false)
 perform importance sampling More...
 
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 More...
 
void read_chain (const std::string input_dir, const std::string input_file, const int nwalkers, const std::vector< size_t > columns={}, const int skip_header=1, const bool fits=false)
 read the chains More...
 
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 More...
 
void write_results (const std::string output_dir, const std::string root_file, const int start=0, const int thin=1, const int nbins=50, const bool fits=false, const bool compute_mode=false, const int ns=-1)
 write the results of the MCMC sampling to file More...
 
virtual void write_model (const std::string output_dir, const std::string output_file, const std::vector< double > xx, const std::vector< double > parameters)
 write the model at xx for given parameters More...
 
virtual void write_model (const std::string output_dir, const std::string output_file, const std::vector< double > xx, const std::vector< double > yy, const std::vector< double > parameters)
 write the model at xx, yy for given parameters More...
 
virtual void write_model_at_bestfit (const std::string output_dir, const std::string output_file, const std::vector< double > xx)
 write the model at xx with best-fit parameters obtained from posterior maximization More...
 
virtual void write_model_at_bestfit (const std::string output_dir, const std::string output_file, const std::vector< double > xx, const std::vector< double > yy)
 write the model at xx, yy with best-fit parameters obtained from likelihood maximization More...
 
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 More...
 
virtual void write_model_from_chains (const std::string output_dir, const std::string output_file, const std::vector< double > xx, const std::vector< double > yy, const int start=0, const int thin=1)
 write the model at xx, yy computing 16th, 50th and 84th percentiles from the chains More...
 
double reduced_chi2 (const std::vector< double > parameter={})
 the reduced \(\chi^2\) More...
 

Additional Inherited Members

- Static Public Member Functions inherited from cbl::modelling::twopt::Modelling_TwoPointCorrelation
static std::shared_ptr< Modelling_TwoPointCorrelationCreate (const std::shared_ptr< measure::twopt::TwoPointCorrelation > twop)
 static factory used to construct modelling of two-point correlation functions of any type More...
 
static std::shared_ptr< Modelling_TwoPointCorrelationCreate (const measure::twopt::TwoPType twoPType, const std::shared_ptr< data::Data > twop_dataset)
 static factory used to construct modelling of two-point correlation functions of any type More...
 
- Protected Member Functions inherited from cbl::modelling::Modelling
void m_set_prior (std::vector< statistics::PriorDistribution > prior_distribution)
 set the internal variable m_parameter_priors More...
 
void m_isSet_response ()
 check if the response function used to compute the super-sample covariance is set
 
- Protected Attributes inherited from cbl::modelling::twopt::Modelling_TwoPointCorrelation
measure::twopt::TwoPType m_twoPType
 the two-point correlation function type
 
std::shared_ptr< modelling::twopt::STR_data_modelm_data_model
 the container of parameters for two-point correlation function model computation
 
- Protected Attributes inherited from cbl::modelling::Modelling
std::shared_ptr< data::Datam_data = NULL
 input data to be modelled
 
bool m_fit_range = false
 check if fit range has been set
 
std::shared_ptr< data::Datam_data_fit
 input data restricted to the range used for the fit
 
std::shared_ptr< statistics::Modelm_model = NULL
 input model
 
std::shared_ptr< statistics::Modelm_response_func = NULL
 response function for the computation of the super-sample covariance
 
std::shared_ptr< statistics::Likelihoodm_likelihood = NULL
 likelihood
 
std::vector< std::shared_ptr< statistics::PriorDistribution > > m_parameter_priors
 prior
 
std::shared_ptr< statistics::Posteriorm_posterior = NULL
 posterior
 

Detailed Description

The class Modelling_TwoPointCorrelation2D.

Modelling_TwoPointCorrelation2D.h "Headers/Modelling_TwoPointCorrelation2D.h"

This file defines the interface of the base class Modelling_TwoPointCorrelation2D, used for modelling the 2D two-point correlation function in cartesian coordinates

Definition at line 62 of file Modelling_TwoPointCorrelation2D.h.

Constructor & Destructor Documentation

◆ Modelling_TwoPointCorrelation2D() [1/2]

cbl::modelling::twopt::Modelling_TwoPointCorrelation2D::Modelling_TwoPointCorrelation2D ( const std::shared_ptr< cbl::measure::twopt::TwoPointCorrelation twop)

constructor

Parameters
twopthe two-point correlation function to model

Definition at line 47 of file Modelling_TwoPointCorrelation2D.cpp.

◆ Modelling_TwoPointCorrelation2D() [2/2]

cbl::modelling::twopt::Modelling_TwoPointCorrelation2D::Modelling_TwoPointCorrelation2D ( const std::shared_ptr< cbl::data::Data dataset,
const measure::twopt::TwoPType  twoPType 
)

constructor

Parameters
datasetthe two-point correlation dataset
twoPTypethe two-point correlation type

Definition at line 57 of file Modelling_TwoPointCorrelation2D.cpp.

Member Function Documentation

◆ set_data_model()

void cbl::modelling::twopt::Modelling_TwoPointCorrelation2D::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

Parameters
cosmologythe cosmology used
redshiftredshift
method_Pkmethod used to compute the power spectrum and σ(mass) (i.e. the Boltzmann solver); valid choices for method_Pk are: CAMB [http://camb.info/], CLASS [http://class-code.net/], MPTbreeze-v1 [http://arxiv.org/abs/1207.1465], EisensteinHu [http://background.uchicago.edu/~whu/transfer/transferpage.html]
sigmaNLdamping of the wiggles in the linear power spectrum
NL0 → linear power spectrum; 1 → non-linear power spectrum
FV0 → exponential form for f(v); 1 → Gaussian form for f(v); where f(v) is the velocity distribution function
store_outputif true the output files created by the Boltzmann solver are stored; if false the output files are removed
output_rootoutput_root of the parameter file used to compute the power spectrum and σ(mass); it can be any name
bias_nl0 → linear bias; 1 → non-linear bias
bAba non-linear bias parameter
xiType0 → standard; 1 → Chuang & Wang model
k_stark* of the Chuang & Wang model
xiNL0 → linear power spectrum; 1 → non-linear power spectrum
v_minminimum velocity used in the convolution of the correlation function
v_maxmaximum velocity used in the convolution of the correlation function
step_vnumber of steps used in the convolution of the correlation function
norm0 → don't normalize the power spectrum; 1 → normalize the power spectrum
r_minminimum separation up to which the binned dark matter correlation function is computed
r_maxmaximum separation up to which the binned dark matter correlation function is computed
k_minminimum wave vector module up to which the binned power spectrum is computed
k_maxmaximum wave vector module up to which the binned power spectrum is computed
stepnumber of steps used to compute the binned dark matter correlation function
aaparameter a of Eq. 24 of Anderson et al. 2012
GSL0 → the Numerical libraries are used; 1 → the GSL libraries are used
precaccuracy of the GSL integration
file_parname of the parameter file; if a parameter file is provided (i.e. file_par!=NULL), it will be used, ignoring the cosmological parameters of the object
Examples
model_2pt_2D.cpp.

Definition at line 67 of file Modelling_TwoPointCorrelation2D.cpp.


The documentation for this class was generated from the following files: