aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/fitter.hpp6
-rw-r--r--statistics/chisq.hpp28
-rw-r--r--statistics/cstat.hpp6
-rw-r--r--statistics/leastsq.hpp4
4 files changed, 22 insertions, 22 deletions
diff --git a/core/fitter.hpp b/core/fitter.hpp
index 34f9203..c4bcc51 100644
--- a/core/fitter.hpp
+++ b/core/fitter.hpp
@@ -685,7 +685,7 @@ namespace opt_utilities
}
}
- const data_set<Ty,Tx>& datas()const
+ const data_set<Ty,Tx>& get_data_set()const
{
if(p_data_set==0)
{
@@ -935,13 +935,13 @@ namespace opt_utilities
}
- const data_set<Ty,Tx>& datas()const
+ const data_set<Ty,Tx>& get_data_set()const
{
if(p_fitter==0)
{
throw fitter_unset();
}
- return p_fitter->datas();
+ return p_fitter->get_data_set();
}
};
diff --git a/statistics/chisq.hpp b/statistics/chisq.hpp
index 4054c22..5f28d86 100644
--- a/statistics/chisq.hpp
+++ b/statistics/chisq.hpp
@@ -37,9 +37,9 @@ namespace opt_utilities
Ts do_eval(const Tp& p)
{
Ts result(0);
- for(int i=(this->datas()).size()-1;i>=0;--i)
+ for(int i=(this->get_data_set()).size()-1;i>=0;--i)
{
- Ty chi=(this->datas().get_data(i).get_y()-eval_model(this->datas().get_data(i).get_x(),p))/this->datas().get_data(i).get_y_upper_err();
+ Ty chi=(this->get_data_set().get_data(i).get_y()-eval_model(this->get_data_set().get_data(i).get_x(),p))/this->get_data_set().get_data(i).get_y_upper_err();
result+=chi*chi;
}
@@ -101,13 +101,13 @@ namespace opt_utilities
Ty do_eval(const Tp& p)
{
Ty result(0);
- for(int i=(this->datas()).size()-1;i>=0;--i)
+ for(int i=(this->get_data_set()).size()-1;i>=0;--i)
{
#ifdef HAVE_X_ERROR
- Tx x1=this->datas().get_data(i).get_x()-this->datas().get_data(i).get_x_lower_err();
- Tx x2=this->datas().get_data(i).get_x()+this->datas().get_data(i).get_x_upper_err();
- Tx x=this->datas().get_data(i).get_x();
+ Tx x1=this->get_data_set().get_data(i).get_x()-this->get_data_set().get_data(i).get_x_lower_err();
+ Tx x2=this->get_data_set().get_data(i).get_x()+this->get_data_set().get_data(i).get_x_upper_err();
+ Tx x=this->get_data_set().get_data(i).get_x();
Ty errx1=(eval_model(x1,p)-eval_model(x,p));
Ty errx2=(eval_model(x2,p)-eval_model(x,p));
//Ty errx=0;
@@ -116,8 +116,8 @@ namespace opt_utilities
Ty errx2=0;
#endif
- Ty y_model=eval_model(this->datas().get_data(i).get_x(),p);
- Ty y_obs=this->datas().get_data(i).get_y();
+ Ty y_model=eval_model(this->get_data_set().get_data(i).get_x(),p);
+ Ty y_obs=this->get_data_set().get_data(i).get_y();
Ty y_err;
Ty errx=0;
@@ -147,22 +147,22 @@ namespace opt_utilities
if(y_model>y_obs)
{
- y_err=this->datas().get_data(i).get_y_upper_err();
+ y_err=this->get_data_set().get_data(i).get_y_upper_err();
}
else
{
- y_err=this->datas().get_data(i).get_y_lower_err();
+ y_err=this->get_data_set().get_data(i).get_y_lower_err();
}
Ty chi=(y_obs-y_model)/std::sqrt(y_err*y_err+errx*errx);
- // Ty chi=(this->datas().get_data(i).get_y()-eval_model(this->datas().get_data(i).get_x(),p));
+ // Ty chi=(this->get_data_set().get_data(i).get_y()-eval_model(this->get_data_set().get_data(i).get_x(),p));
// cerr<<chi<<"\n";
result+=chi*chi;
//std::cerr<<chi<<std::endl;
- //cerr<<eval_model(this->datas()[i].x,p)<<endl;
- //cerr<<this->datas()[i].y_upper_err<<endl;
- // cerr<<this->datas()[i].x<<"\t"<<this->datas()[i].y<<"\t"<<eval_model(this->datas()[i].x,p)<<endl;
+ //cerr<<eval_model(this->get_data_set()[i].x,p)<<endl;
+ //cerr<<this->get_data_set()[i].y_upper_err<<endl;
+ // cerr<<this->get_data_set()[i].x<<"\t"<<this->get_data_set()[i].y<<"\t"<<eval_model(this->get_data_set()[i].x,p)<<endl;
}
if(verb)
{
diff --git a/statistics/cstat.hpp b/statistics/cstat.hpp
index b6b401d..ce8469e 100644
--- a/statistics/cstat.hpp
+++ b/statistics/cstat.hpp
@@ -35,10 +35,10 @@ namespace opt_utilities
Ts do_eval(const Tp& p)
{
Ts result(0);
- for(int i=(this->datas()).size()-1;i>=0;--i)
+ for(int i=(this->get_data_set()).size()-1;i>=0;--i)
{
- Ty model_y=eval_model(this->datas().get_data(i).get_x(),p);
- result+=model_y-this->datas().get_data(i).get_y()*log(model_y)+lnfrac(this->datas().get_data(i).get_y());
+ Ty model_y=eval_model(this->get_data_set().get_data(i).get_x(),p);
+ result+=model_y-this->get_data_set().get_data(i).get_y()*log(model_y)+lnfrac(this->get_data_set().get_data(i).get_y());
}
if(verb)
diff --git a/statistics/leastsq.hpp b/statistics/leastsq.hpp
index fa76fa2..48b753a 100644
--- a/statistics/leastsq.hpp
+++ b/statistics/leastsq.hpp
@@ -37,9 +37,9 @@ namespace opt_utilities
Ts do_eval(const Tp& p)
{
Ts result(0);
- for(int i=(this->datas()).size()-1;i>=0;--i)
+ for(int i=(this->get_data_set()).size()-1;i>=0;--i)
{
- Ty chi=(this->datas().get_data(i).get_y()-eval_model(this->datas().get_data(i).get_x(),p));
+ Ty chi=(this->get_data_set().get_data(i).get_y()-eval_model(this->get_data_set().get_data(i).get_x(),p));
result+=chi*chi;
}