51 namespace statistics {
91 Model2D (
model_function_2D function,
const size_t nparameters, std::vector<ParameterType> parameterTypes={}, std::vector<std::string> parameterNames={}, std::shared_ptr<void>
inputs=NULL)
125 std::vector<std::vector<double>> xvec(2); xvec[0] = {xx}; xvec[1] = {yy};
142 std::vector<std::vector<double>>
operator () (
const std::vector<double> xx,
const std::vector<double> yy, std::vector<double> &
parameters)
const override
144 std::vector<std::vector<double>> xvec = {xx, yy};
163 void stats_from_chains (
const std::vector<double> xx,
const std::vector<double> yy, std::vector<std::vector<double>> &median_model, std::vector<std::vector<double>> &low_model, std::vector<std::vector<double>> &up_model,
const int start=0,
const int thin=1)
override;
181 void write (
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)
override;
197 void write_at_bestfit (
const std::string output_dir,
const std::string output_file,
const std::vector<double> xx,
const std::vector<double> yy)
override;
215 void write_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)
override;
double operator()(const double xx, const double yy, std::vector< double > ¶meters) const override
evaluate the model function at xx, yy
void write_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) override
write the model at xx, yy computing 16th, 50th and 84th percentiles from the chains.
Model2D(model_function_2D function, const size_t nparameters, std::vector< ParameterType > parameterTypes={}, std::vector< std::string > parameterNames={}, std::shared_ptr< void > inputs=NULL)
constructor
void stats_from_chains(const std::vector< double > xx, const std::vector< double > yy, std::vector< std::vector< double >> &median_model, std::vector< std::vector< double >> &low_model, std::vector< std::vector< double >> &up_model, const int start=0, const int thin=1) override
compute the median and percentiles of the model from MCMC chains
void set_function(const model_function_2D function)
set the model function
Model2D()
default constructor
void write_at_bestfit(const std::string output_dir, const std::string output_file, const std::vector< double > xx, const std::vector< double > yy) override
write the model at xx, yy with best-fit parameters obtained from likelihood maximization
void write(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) override
write the model at xx, yy for given parameters
~Model2D()=default
default destructor
std::shared_ptr< ModelParameters > parameters()
return the model parameters
Dim m_dimension
the model dimension
std::vector< std::vector< double > > operator()(const std::vector< std::vector< double >> xx, std::vector< double > ¶meters) const
evalueate the model function at xx, for Model1D
Model()=default
default constructor
std::shared_ptr< void > inputs()
return the model inputs
std::function< std::vector< std::vector< double > >std::vector< double >, std::vector< double >, std::shared_ptr< void >, std::vector< double > &)> model_function_2D
2D function: the inputs are the values at which the function is computed, a pointer to a set of data ...
The global namespace of the CosmoBolognaLib
@ _2D_
2D pair, used e.g. for 2D pairs, in Cartesian or polar coordinates