aboutsummaryrefslogtreecommitdiffstats
path: root/mass_profile/nfw.hpp
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@gmail.com>2016-05-27 22:47:24 +0800
committerAaron LI <aaronly.me@gmail.com>2016-05-27 22:47:24 +0800
commitffd178e0bd72562a3c2cff9747b6e656edc881dc (patch)
tree8800b7b5b2e8bc3df1a6760df5cd54eaaa686702 /mass_profile/nfw.hpp
parent5c35fad9240fb42c1371c721e0b2af7379bd9ea0 (diff)
downloadchandra-acis-analysis-ffd178e0bd72562a3c2cff9747b6e656edc881dc.tar.bz2
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.
Diffstat (limited to 'mass_profile/nfw.hpp')
-rw-r--r--mass_profile/nfw.hpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/mass_profile/nfw.hpp b/mass_profile/nfw.hpp
new file mode 100644
index 0000000..8e3e59e
--- /dev/null
+++ b/mass_profile/nfw.hpp
@@ -0,0 +1,56 @@
+/**
+ \file nfw.hpp
+ \brief Jingying Wang's model
+ \author Jingying Wang
+ */
+
+
+#ifndef NFW
+#define NFW
+#define OPT_HEADER
+#include <core/fitter.hpp>
+#include <cmath>
+
+namespace opt_utilities
+{
+ template <typename T>
+ class nfw
+ :public model<T,T,std::vector<T>,std::string>
+ {
+ private:
+ model<T,T,std::vector<T> >* do_clone()const
+ {
+ return new nfw<T>(*this);
+ }
+
+ const char* do_get_type_name()const
+ {
+ return "1d power law";
+ }
+ public:
+ nfw()
+ {
+ this->push_param_info(param_info<std::vector<T> >("rho0",1,0,1e99));
+ this->push_param_info(param_info<std::vector<T> >("rs",100,0,1e99));
+ }
+
+ T do_eval(const T& r,const std::vector<T>& param)
+ {
+ T rho0=std::abs(param[0]);
+ T rs=std::abs(param[1]);
+ static const T pi=4*std::atan(1);
+ return 4*pi*rho0*rs*rs*rs*(std::log((r+rs)/rs)-r/(r+rs));
+ }
+
+ private:
+ std::string do_get_information()const
+ {
+ return "";
+ }
+ };
+}
+
+
+
+#endif
+//EOF