diff options
author | astrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675> | 2010-04-08 10:49:05 +0000 |
---|---|---|
committer | astrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675> | 2010-04-08 10:49:05 +0000 |
commit | cd2802a05d0765e25aafd2e54b7271c6dd466d0a (patch) | |
tree | 9eb131e644d5baef3c78f0cf454cb65550156504 /dynamical_fit | |
parent | f017bfbcbd6a6af80e7d2ce7303572e80a42196f (diff) | |
download | opt-utilities-cd2802a05d0765e25aafd2e54b7271c6dd466d0a.tar.bz2 |
git-svn-id: file:///home/svn/opt_utilities@113 ed2142bd-67ad-457f-ba7c-d818d4011675
Diffstat (limited to 'dynamical_fit')
-rw-r--r-- | dynamical_fit/dynamical_fit.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/dynamical_fit/dynamical_fit.cpp b/dynamical_fit/dynamical_fit.cpp index 2ab33ce..196df0d 100644 --- a/dynamical_fit/dynamical_fit.cpp +++ b/dynamical_fit/dynamical_fit.cpp @@ -15,9 +15,9 @@ using namespace opt_utilities; int main(int argc,char* argv[]) { - if(argc!=2) + if(argc!=3) { - cerr<<"Usage: "<<argv[0]<<" <config file>"<<endl; + cerr<<"Usage: "<<argv[0]<<" <config file> <model dump file>"<<endl; exit(-1); } ifstream cfg_file(argv[1]); @@ -57,7 +57,30 @@ int main(int argc,char* argv[]) fit.load_data(dl.get_data_set()); + fit.set_precision(1e-5); + fit.fit(); + fit.fit(); + vector<double> p=fit.fit(); - cout<<p[0]<<"\t"<<p[1]<<endl; + for(int i=0;i<fit.get_num_params();++i) + { + cerr<<fit.get_param_info(i).get_name()<<"\t"<<fit.get_param_info(i).get_value()<<endl; + } + ofstream ofs(argv[2]); + ofs<<"no no no\n"; + double xmin,xmax; + xmin=fit.get_data_set().get_data(0).get_x(); + xmax=fit.get_data_set().get_data(0).get_x(); + for(int i=0;i<fit.get_data_set().size();++i) + { + xmin=std::min(xmin,fit.get_data_set().get_data(i).get_x()); + xmax=std::max(xmax,fit.get_data_set().get_data(i).get_x()); + } + + for(double x=xmin;x<xmax;x+=(xmax-xmin)/1000.) + { + ofs<<x<<"\t0\t0\t"<<fit.eval_model_raw(x,fit.get_all_params())<<"\t0\t0"<<endl; + } + } |