CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
Modelling_TwoPointCorrelation_projected.cpp
Go to the documentation of this file.
1 /********************************************************************
2  * Copyright (C) 2016 by Federico Marulli and Alfonso Veropalumbo *
3  * federico.marulli3@unibo.it *
4  * *
5  * This program is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU General Public License as *
7  * published by the Free Software Foundation; either version 2 of *
8  * the License, or (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public *
16  * License along with this program; if not, write to the Free *
17  * Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ********************************************************************/
20 
39 
40 using namespace std;
41 
42 using namespace cbl;
43 
44 
45 // ============================================================================================
46 
47 
49 {
50  // compute the fiducial dark matter two-point correlation function
51  set_fiducial_wpDM();
52 
53  // set the model parameters
54  const int nparameters = 3;
55 
56  vector<statistics::ParameterType> parameterType = {statistics::ParameterType::_Base_, statistics::ParameterType::_Base_, statistics::ParameterType::_Base_};
57 
58  vector<string> parameterName = {"alpha", "f*sigma8", "b*sigma8"};
59 
60  statistics::PriorDistribution alpha_prior (glob::DistributionType::_Constant_, 1);
61  statistics::PriorDistribution fsigma8_prior (glob::DistributionType::_Constant_, 0);
62 
63  vector<statistics::PriorDistribution> priors = {alpha_prior, fsigma8_prior, bsigma8_prior};
64 
65  // input data used to construct the model
66  m_data_model->poly_order = 0;
67 
68  //set the priors
69  m_set_prior(priors);
70 
71  // construct the model
72  m_model = make_shared<statistics::Model1D>(statistics::Model1D(&xi0_linear, nparameters, parameterType, parameterName, m_data_model));
73 }
74 
75 
76 // ============================================================================================
77 
78 
80 {
81  coutCBL << "Setting up the fiducial model for the projected correlation function of the dark matter" << endl;
82 
83  const vector<double> rad = logarithmic_bin_vector(m_data_model->step, max(m_data_model->r_min, 1.e-4), min(m_data_model->r_max, 100.));
84  vector<double> wpDM(m_data_model->step);
85 
86  for (size_t i=0; i<(size_t)m_data_model->step; i++)
87  wpDM[i] = m_data_model->cosmology->wp_DM(rad[i], m_data_model->method_Pk, m_data_model->NL, m_data_model->redshift, m_data_model->pi_max, true, m_data_model->output_root, m_data_model->norm, m_data_model->r_min, m_data_model->r_max, m_data_model->k_min, m_data_model->k_max, m_data_model->aa, m_data_model->GSL, m_data_model->prec, m_data_model->file_par);
88 
89  if(!m_data_model->store_output)
90  m_data_model->cosmology->remove_output_Pk_tables(m_data_model->method_Pk, m_data_model->NL, m_data_model->redshift, m_data_model->output_root);
91 
92  m_data_model->func_xi = make_shared<glob::FuncGrid>(glob::FuncGrid(rad, wpDM, "Spline"));
93 }
94 
95 
96 // ============================================================================================
97 
98 
100 {
101  // compute the fiducial dark matter power spectrum
102  set_fiducial_PkDM();
103 
104  // compute the fiducial mass variance and its logarithmic derivative
105  set_fiducial_sigma();
106 
107  // set the model parameters
108  const int nparameters = 5;
109 
110  vector<statistics::ParameterType> parameterType = {statistics::ParameterType::_Base_};
111 
112  vector<string> parameterName(nparameters);
113  parameterName[0] = "Mmin";
114  parameterName[1] = "sigmalgM";
115  parameterName[2] = "M0";
116  parameterName[3] = "M1";
117  parameterName[4] = "alpha";
118 
119  vector<statistics::PriorDistribution> priors = {Mmin_prior, sigmalgM_prior, M0_prior, M1_prior, alpha_prior};
120 
121  //set the priors
122  m_set_prior(priors);
123 
124  // construct the model
125  m_model = make_shared<statistics::Model1D>(statistics::Model1D(&wp_HOD, nparameters, parameterType, parameterName, m_data_HOD));
126 
127 }
#define coutCBL
CBL print message.
Definition: Kernel.h:734
The class Modelling_TwoPointCorrelation_projected.
The class FuncGrid.
Definition: FuncGrid.h:55
void set_fiducial_wpDM()
set the fiducial model for the dark matter projected correlation function
void set_model_HOD(const statistics::PriorDistribution Mmin_prior={}, const statistics::PriorDistribution sigmalgM_prior={}, const statistics::PriorDistribution M0_prior={}, const statistics::PriorDistribution M1_prior={}, const statistics::PriorDistribution alpha_prior={})
set the HOD parameters used to model the full shape of the projected two-point correlation function
void set_model_linearBias(const statistics::PriorDistribution bsigma8_prior)
set the model to fit the projected two-point correlation function assuming a linear bias
The class Model1D.
Definition: Model1D.h:60
The class PriorDistribution.
std::vector< double > xi0_linear(const std::vector< double > rad, const std::shared_ptr< void > inputs, std::vector< double > &parameter)
model for the monopole of the two-point correlation function
std::vector< double > wp_HOD(const std::vector< double > rp, const std::shared_ptr< void > inputs, std::vector< double > &parameter)
HOD model of the projected two-point correlation function.
The global namespace of the CosmoBolognaLib
Definition: CAMB.h:38
std::vector< T > logarithmic_bin_vector(const size_t nn, const T min, const T max)
fill a std::vector with logarithmically spaced values
Definition: Kernel.h:1621