From f77885e968e30b28669b4d24af75ec4e7bb0a41e Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Fri, 17 Feb 2017 23:33:55 +0800 Subject: Remove unused 'fit_{lt,mt}_{bpl,pl}.cpp' tools --- mass_profile/fit_lt_pl.cpp | 239 --------------------------------------------- 1 file changed, 239 deletions(-) delete mode 100644 mass_profile/fit_lt_pl.cpp (limited to 'mass_profile/fit_lt_pl.cpp') diff --git a/mass_profile/fit_lt_pl.cpp b/mass_profile/fit_lt_pl.cpp deleted file mode 100644 index fa37249..0000000 --- a/mass_profile/fit_lt_pl.cpp +++ /dev/null @@ -1,239 +0,0 @@ -/* - Perform a double-beta density model fitting to the surface brightness data - Author: Junhua Gu - Last modified: 2011.01.01 - This code is distributed with no warrant -*/ - -//#define HAVE_X_ERROR -#include -#include -#include -#include -#include -#include "statistics/chisq.hpp" -#include "statistics/leastsq.hpp" -#include -#include -#include - -using namespace std; -using namespace opt_utilities; -//double s=5.63136645E20; -const double kpc=3.086E21;//kpc in cm -const double Mpc=kpc*1000; -const double pi=4*atan(1); -double std_norm_rand() -{ - double x=0; - double u=0; - double v=0; - - do - { - u=rand()/(double)RAND_MAX; - rand(); - v=rand()/(double)RAND_MAX; - - x=std::sqrt(-log(u))*cos(2*pi*v); - }while(isnan(x)); - return x; -} - -double shuffle_data(double xc,double xl,double xu) -{ - double result=0; - assert(!isnan(xc)); - assert(!isnan(xl)); - assert(!isnan(xu)); - if(std_norm_rand()>0) - { - result=xc-std::abs(std_norm_rand()*xl); - } - else - { - result=xc+std::abs(std_norm_rand()*xu); - } - assert(!isnan(result)); - return result; -} - -int main(int argc,char* argv[]) -{ - if(argc!=3) - { - cerr<<"Usage:"< "< ds; - ofstream ofs_result("l-t_result.qdp"); - ofs_result<<"read terr 1"<>T>>Tl>>Tu>>L>>Lerr; - //std::cerr< data, skipped"< d(x,y,std::abs(yl),std::abs(yu), - std::abs(xl),std::abs(xu)); - ds.add_data(d); - } - - double M=sxx*s1-sx*sx; - double Ma=sxy*s1-sy*sx; - double Mb=sxx*sy-sx*sxy; - double k0=Ma/M; - double b0=Mb/M; - - ofs_result<<"no no no"<,double,std::string> fit; - fit.set_opt_method(powell_method >()); - fit.set_statistic(chisq,double,std::string>()); - //fit.set_statistic(leastsq,double,std::string>()); - fit.set_model(lin1d()); - fit.load_data(ds); - - cerr<<"k0="< p=fit.fit(); - for(double i=.5;i<12;i*=1.01) - { - ofs_result< ds1; - for(size_t i=0;i(new_x,new_y, - ds.get_data(i).get_y_lower_err(), - ds.get_data(i).get_y_upper_err(), - ds.get_data(i).get_y_lower_err(), - ds.get_data(i).get_y_upper_err())); - //cerr<