From ffd178e0bd72562a3c2cff9747b6e656edc881dc Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Fri, 27 May 2016 22:47:24 +0800 Subject: Add mass_profile tools * These tools are mainly use to calculate the total gravitational mass profile, as well as the intermediate products (e.g., surface brightness profile fitting, gas density profile, NFW fitting, etc.) * There are additional tools for calculating the luminosity and flux. * These tools mainly developed by Junhua GU, and contributed by Weitian (Aaron) LI, and Zhenghao ZHU. --- mass_profile/constrained_dbeta.hpp | 80 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 mass_profile/constrained_dbeta.hpp (limited to 'mass_profile/constrained_dbeta.hpp') diff --git a/mass_profile/constrained_dbeta.hpp b/mass_profile/constrained_dbeta.hpp new file mode 100644 index 0000000..24a1ebb --- /dev/null +++ b/mass_profile/constrained_dbeta.hpp @@ -0,0 +1,80 @@ +#ifndef CONSTRAINED_DBETA +#define CONSTRAINED_DBETA +#include "projector.hpp" + + +namespace opt_utilities +{ + template + class constrained_dbeta + :public model,std::vector,std::vector > + { + public: + constrained_dbeta() + { + this->push_param_info(param_info,std::string>("n01",1)); + this->push_param_info(param_info,std::string>("beta1",.66)); + this->push_param_info(param_info,std::string>("rc1",100)); + + this->push_param_info(param_info,std::string>("n02",1)); + this->push_param_info(param_info,std::string>("beta2",.67)); + this->push_param_info(param_info,std::string>("rc2",110)); + + } + + public: + constrained_dbeta* do_clone()const + { + return new constrained_dbeta(*this); + } + + std::vector do_eval(const std::vector & x, + const std::vector& p) + { + T n01=std::abs(p[0]); + T beta1=p[1]; + T rc1=p[2]; + + T n02=std::abs(p[3]); + T beta2=p[4]; + T rc2=p[5]; + + + + std::vector result(x.size()-1); + for(int i=1;i& p)const + { + if(p.size()!=6) + { + cerr<get_num_params()<rc1) + { + return true; + } + else + { + cerr<