![]() |
CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
|
The class Modelling_TwoPointCorrelation2D. More...
#include <Modelling_TwoPointCorrelation2D.h>
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... | |
![]() | |
measure::twopt::TwoPType | twoPType () |
get the member m_twoPType More... | |
std::shared_ptr< modelling::twopt::STR_data_model > | data_model () |
get the member m_data_model More... | |
Modelling_TwoPointCorrelation ()=default | |
default constuctor | |
virtual | ~Modelling_TwoPointCorrelation ()=default |
default destructor | |
![]() | |
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::Data > | data () |
return the dataset More... | |
std::shared_ptr< data::Data > | data_fit () |
return the dataset More... | |
std::shared_ptr< statistics::Likelihood > | likelihood () |
return the likelihood parameters More... | |
std::shared_ptr< statistics::Posterior > | posterior () |
return the posterior parameters More... | |
std::shared_ptr< statistics::ModelParameters > | likelihood_parameters () |
return the likelihood parameters More... | |
std::shared_ptr< statistics::ModelParameters > | posterior_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::PriorDistribution > | get_prior (const int i) |
get the internal variable m_parameter_priors More... | |
std::shared_ptr< statistics::Model > | get_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 std::shared_ptr< Modelling_TwoPointCorrelation > | Create (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_TwoPointCorrelation > | Create (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... | |
![]() | |
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 | |
![]() | |
measure::twopt::TwoPType | m_twoPType |
the two-point correlation function type | |
std::shared_ptr< modelling::twopt::STR_data_model > | m_data_model |
the container of parameters for two-point correlation function model computation | |
![]() | |
std::shared_ptr< data::Data > | m_data = NULL |
input data to be modelled | |
bool | m_fit_range = false |
check if fit range has been set | |
std::shared_ptr< data::Data > | m_data_fit |
input data restricted to the range used for the fit | |
std::shared_ptr< statistics::Model > | m_model = NULL |
input model | |
std::shared_ptr< statistics::Model > | m_response_func = NULL |
response function for the computation of the super-sample covariance | |
std::shared_ptr< statistics::Likelihood > | m_likelihood = NULL |
likelihood | |
std::vector< std::shared_ptr< statistics::PriorDistribution > > | m_parameter_priors |
prior | |
std::shared_ptr< statistics::Posterior > | m_posterior = NULL |
posterior | |
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.
cbl::modelling::twopt::Modelling_TwoPointCorrelation2D::Modelling_TwoPointCorrelation2D | ( | const std::shared_ptr< cbl::measure::twopt::TwoPointCorrelation > | twop | ) |
constructor
twop | the two-point correlation function to model |
Definition at line 47 of file Modelling_TwoPointCorrelation2D.cpp.
cbl::modelling::twopt::Modelling_TwoPointCorrelation2D::Modelling_TwoPointCorrelation2D | ( | const std::shared_ptr< cbl::data::Data > | dataset, |
const measure::twopt::TwoPType | twoPType | ||
) |
constructor
dataset | the two-point correlation dataset |
twoPType | the two-point correlation type |
Definition at line 57 of file Modelling_TwoPointCorrelation2D.cpp.
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
cosmology | the cosmology used |
redshift | redshift |
method_Pk | method 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] |
sigmaNL | damping of the wiggles in the linear power spectrum |
NL | 0 → linear power spectrum; 1 → non-linear power spectrum |
FV | 0 → exponential form for f(v); 1 → Gaussian form for f(v); where f(v) is the velocity distribution function |
store_output | if true the output files created by the Boltzmann solver are stored; if false the output files are removed |
output_root | output_root of the parameter file used to compute the power spectrum and σ(mass); it can be any name |
bias_nl | 0 → linear bias; 1 → non-linear bias |
bA | ba non-linear bias parameter |
xiType | 0 → standard; 1 → Chuang & Wang model |
k_star | k* of the Chuang & Wang model |
xiNL | 0 → linear power spectrum; 1 → non-linear power spectrum |
v_min | minimum velocity used in the convolution of the correlation function |
v_max | maximum velocity used in the convolution of the correlation function |
step_v | number of steps used in the convolution of the correlation function |
norm | 0 → don't normalize the power spectrum; 1 → normalize the power spectrum |
r_min | minimum separation up to which the binned dark matter correlation function is computed |
r_max | maximum separation up to which the binned dark matter correlation function is computed |
k_min | minimum wave vector module up to which the binned power spectrum is computed |
k_max | maximum wave vector module up to which the binned power spectrum is computed |
step | number of steps used to compute the binned dark matter correlation function |
aa | parameter a of Eq. 24 of Anderson et al. 2012 |
GSL | 0 → the Numerical libraries are used; 1 → the GSL libraries are used |
prec | accuracy of the GSL integration |
file_par | name 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 |
Definition at line 67 of file Modelling_TwoPointCorrelation2D.cpp.