aboutsummaryrefslogtreecommitdiffstats
path: root/mass_profile/dump_fit_qdp.cpp
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/dump_fit_qdp.cpp
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/dump_fit_qdp.cpp')
-rw-r--r--mass_profile/dump_fit_qdp.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/mass_profile/dump_fit_qdp.cpp b/mass_profile/dump_fit_qdp.cpp
new file mode 100644
index 0000000..556edea
--- /dev/null
+++ b/mass_profile/dump_fit_qdp.cpp
@@ -0,0 +1,55 @@
+#include "dump_fit_qdp.hpp"
+
+namespace opt_utilities
+{
+ const static double kpc=3.086E21;
+ void dump_sbp_beta(std::ostream& os,fitter<double,double,std::vector<double>,double,std::string>& f,double cm_per_pixel,const std::vector<double>& r,const std::vector<double>& y,const std::vector<double>& ye)
+ {
+ os<<"read serr 1 2"<<std::endl;
+ os<<"skip single"<<std::endl;
+ os<<"la x \"radius (kpc)\""<<std::endl;
+ os<<"la y \"surface brightness (cts s\\u-1\\d pixel\\u-2\\d)\""<<std::endl;
+ os<<"li on 2"<<std::endl;
+ for(int i=1;i<r.size();++i)
+ {
+ os<<(r[i]+r[i-1])/2*cm_per_pixel/kpc<<"\t"<<(r[i]-r[i-1])/2*cm_per_pixel/kpc<<"\t"<<y[i-1]<<"\t"<<ye[i-1]<<std::endl;
+ }
+ os<<"no no no"<<std::endl;
+ std::vector<double> p=f.get_all_params();
+ for(int i=1;i<r.size();++i)
+ {
+ double x=(r[i]+r[i-1])/2;
+ os<<x*cm_per_pixel/kpc<<"\t"<<0<<"\t"<<f.eval_model_raw(x,p)<<"\t"<<0<<std::endl;
+ }
+ }
+
+ void dump_rho_beta(std::ostream& os,fitter<std::vector<double>,std::vector<double>,std::vector<double>,double,std::string>& f,double cm_per_pixel,const std::vector<double>& r,const std::vector<double>& sbps,const std::vector<double>& sbpe)
+ {
+ os<<"read serr 1 2"<<std::endl;
+ os<<"skip single"<<std::endl;
+ os<<"la x \"radius (kpc)\""<<std::endl;
+ os<<"la y \"density (cm\\u-3\\d)\""<<std::endl;
+ os<<"li on 2"<<std::endl;
+
+ for(int i=1;i<r.size();++i)
+ {
+ double x=(r[i]+r[i-1])/2;
+ double y=sbps[i-1];
+ double ye=sbpe[i-1];
+ os<<x*cm_per_pixel/kpc<<"\t0\t"<<y<<"\t"<<ye<<std::endl;
+ }
+
+ os<<"no no no"<<std::endl;
+ std::vector<double> p=f.get_all_params();
+ std::vector<double> mv=f.eval_model_raw(r,p);
+ for(int i=1;i<r.size();++i)
+ {
+ double x=(r[i]+r[i-1])/2;
+ double y=mv[i-1];
+ double ye=0;
+ os<<x*cm_per_pixel/kpc<<"\t0\t"<<y<<"\t"<<ye<<std::endl;
+ }
+
+ }
+
+};