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

The class Modelling_ThreePointCorrelation. More...

#include <Modelling_ThreePointCorrelation.h>

Inheritance diagram for cbl::modelling::threept::Modelling_ThreePointCorrelation:
Collaboration diagram for cbl::modelling::threept::Modelling_ThreePointCorrelation:

Public Member Functions

measure::threept::ThreePType threePType ()
 return the type of correlation function More...
 
void set_data_model (const std::vector< double > Q_DM)
 set the data model for the three-point correlation function More...
 
void set_data_model_zeta_RSD (const double r1, const double r2, const cbl::cosmology::Cosmology cosmology, const double redshift, const std::string method_Pk="CAMB", const bool NL=false, const int max_ll=5, const double k_min=1.e-4, const double k_max=100, const int step_k=500, const double r_min=1.e-4, const double r_max=200, const int step_r=200, const bool force_realSpace=false, const bool use_k=false, const bool store_output=true, const std::string output_root=cbl::par::defaultString, const int norm=-1, const double prec=1.e-4)
 set the data model for the three-point correlation function (see Slepian, Eisenstein 2017) More...
 
void set_data_Q_nonlocal (const cosmology::Cosmology cosmology, const double r1, const double r2, const std::vector< double > theta, const std::string model, const std::vector< double > kk, const std::vector< double > Pk_matter)
 set the data model for the three-point correlation function with non-local contributions More...
 
- 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...
 

Protected Attributes

measure::threept::ThreePType m_threePType
 the three-point correlation function type
 
modelling::threept::STR_data_model_threept m_data_model
 the container of parameters for three-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
 

Constructors/destructors

 Modelling_ThreePointCorrelation ()=default
 default constuctor ThreePointCorrelation
 
 Modelling_ThreePointCorrelation (const std::shared_ptr< cbl::measure::threept::ThreePointCorrelation > threep)
 constuctor More...
 
virtual ~Modelling_ThreePointCorrelation ()=default
 default destructor
 
static std::shared_ptr< Modelling_ThreePointCorrelationCreate (const std::shared_ptr< measure::threept::ThreePointCorrelation > threep)
 static factory used to construct modelling of three-point correlation functions of any type More...
 
static std::shared_ptr< Modelling_ThreePointCorrelationCreate (const measure::threept::ThreePType threePType, const std::shared_ptr< data::Data > threept_dataset)
 static factory used to construct modelling of three-point correlation functions of any type More...
 

Additional Inherited Members

- 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
 

Detailed Description

The class Modelling_ThreePointCorrelation.

Modelling_ThreePointCorrelation.h "Headers/Modelling_ThreePointCorrelation.h"

This file defines the interface of the base class Modelling_ThreePointCorrelation, used for modelling any kind of three-point correlation function measurements

Definition at line 72 of file Modelling_ThreePointCorrelation.h.

Constructor & Destructor Documentation

◆ Modelling_ThreePointCorrelation()

cbl::modelling::threept::Modelling_ThreePointCorrelation::Modelling_ThreePointCorrelation ( const std::shared_ptr< cbl::measure::threept::ThreePointCorrelation threep)
inline

constuctor

Parameters
threepthe three-point correlation function to model _ThreePointCorrelation

Definition at line 100 of file Modelling_ThreePointCorrelation.h.

Member Function Documentation

◆ Create() [1/2]

std::shared_ptr< cbl::modelling::threept::Modelling_ThreePointCorrelation > cbl::modelling::threept::Modelling_ThreePointCorrelation::Create ( const measure::threept::ThreePType  threePType,
const std::shared_ptr< data::Data threept_dataset 
)
static

static factory used to construct modelling of three-point correlation functions of any type

Parameters
threePTypetype of the three-point correlation function
threept_datasetthe dataset containing the three-point correlation function to model
Returns
a pointer to an object of class Modelling_ThreePointCorrelation of a given type

Definition at line 78 of file Modelling_ThreePointCorrelation.cpp.

◆ Create() [2/2]

std::shared_ptr< cbl::modelling::threept::Modelling_ThreePointCorrelation > cbl::modelling::threept::Modelling_ThreePointCorrelation::Create ( const std::shared_ptr< measure::threept::ThreePointCorrelation threep)
static

static factory used to construct modelling of three-point correlation functions of any type

Parameters
threepthe three-point correlation function to model
Returns
a pointer to an object of class Modelling_ThreePointCorrelation of a given type

Definition at line 55 of file Modelling_ThreePointCorrelation.cpp.

◆ set_data_model()

void cbl::modelling::threept::Modelling_ThreePointCorrelation::set_data_model ( const std::vector< double >  Q_DM)

set the data model for the three-point correlation function

Parameters
Q_DMvector contaning the DM reduced three-point correlation function
Examples
model_3pt.cpp.

Definition at line 100 of file Modelling_ThreePointCorrelation.cpp.

◆ set_data_model_zeta_RSD()

void cbl::modelling::threept::Modelling_ThreePointCorrelation::set_data_model_zeta_RSD ( const double  r1,
const double  r2,
const cbl::cosmology::Cosmology  cosmology,
const double  redshift,
const std::string  method_Pk = "CAMB",
const bool  NL = false,
const int  max_ll = 5,
const double  k_min = 1.e-4,
const double  k_max = 100,
const int  step_k = 500,
const double  r_min = 1.e-4,
const double  r_max = 200,
const int  step_r = 200,
const bool  force_realSpace = false,
const bool  use_k = false,
const bool  store_output = true,
const std::string  output_root = cbl::par::defaultString,
const int  norm = -1,
const double  prec = 1.e-4 
)

set the data model for the three-point correlation function (see Slepian, Eisenstein 2017)

Parameters
r1the first triangle side
r2the second triangle side
cosmologythe fiducial cosmology
redshiftthe redshift
method_Pkmethod used to compute the power spectrum; 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]
NL0 → linear power spectrum; 1 → non-linear power spectrum
max_llthe maximum legendre multipole in 3pcf model
k_minminimum wave vector module up to which the binned dark matter power spectrum is computed
k_maxmaximum wave vector module up to which the binned dark matter power spectrum is computed
step_knumber of steps used to compute the binned dark matter correlation function
r_minminimum separation up to which the integrals of the tree-level 3pcf are computed
r_maxmaximum separation up to which the integrals of the tree-level 3pcf are computed
step_rnumber of steps used to compute the integrals of the tree-level 3pcf
force_realSpace\( \rightarrow \) redshift-space model; 1 \( \rightarrow \) real-space model
use_kfalse \( \rightarrow \) do not compute k-integrals; true \( \rightarrow \) compute k-integrals
@param use_k  &rarr; do not compute the k-integrals; 1
→ compute the k-integrals
store_outputif true the output files created by the Boltmann solver are stored; if false the output files are removed
output_rootthe output file root
norm0 → don't normalize the power spectrum; 1 → normalize the power spectrum
precaccuracy of the GSL integration

Definition at line 124 of file Modelling_ThreePointCorrelation.cpp.

◆ set_data_Q_nonlocal()

void cbl::modelling::threept::Modelling_ThreePointCorrelation::set_data_Q_nonlocal ( const cosmology::Cosmology  cosmology,
const double  r1,
const double  r2,
const std::vector< double >  theta,
const std::string  model,
const std::vector< double >  kk,
const std::vector< double >  Pk_matter 
)

set the data model for the three-point correlation function with non-local contributions

Parameters
cosmologythe fiducial cosmology
r1the first triangle side
r2the second triangle side
thetavector of theta
modelmethod used to compute the 3pcf
kkvector containing wavevector moduls
Pk_mattervector containing the theoretical dark matter power-spectrum

Definition at line 109 of file Modelling_ThreePointCorrelation.cpp.

◆ threePType()

measure::threept::ThreePType cbl::modelling::threept::Modelling_ThreePointCorrelation::threePType ( )
inline

return the type of correlation function

Returns
the type of correlation function

Definition at line 143 of file Modelling_ThreePointCorrelation.h.


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