From de2b4bb23bf8e10e2a8e98e6455a0f305d61ba60 Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Sat, 25 Apr 2009 15:35:07 +0000 Subject: git-svn-id: file:///home/svn/opt_utilities@29 ed2142bd-67ad-457f-ba7c-d818d4011675 --- core/fitter.hpp | 6 +++--- statistics/chisq.hpp | 28 ++++++++++++++-------------- statistics/cstat.hpp | 6 +++--- statistics/leastsq.hpp | 4 ++-- 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& datas()const + const data_set& get_data_set()const { if(p_data_set==0) { @@ -935,13 +935,13 @@ namespace opt_utilities } - const data_set& datas()const + const data_set& 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<datas()[i].x,p)<datas()[i].y_upper_err<datas()[i].x<<"\t"<datas()[i].y<<"\t"<datas()[i].x,p)<get_data_set()[i].x,p)<get_data_set()[i].y_upper_err<get_data_set()[i].x<<"\t"<get_data_set()[i].y<<"\t"<get_data_set()[i].x,p)<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; } -- cgit v1.2.2