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/plot_reporter.cpp | 70 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 mass_profile/plot_reporter.cpp (limited to 'mass_profile/plot_reporter.cpp') diff --git a/mass_profile/plot_reporter.cpp b/mass_profile/plot_reporter.cpp new file mode 100644 index 0000000..b5fc9ff --- /dev/null +++ b/mass_profile/plot_reporter.cpp @@ -0,0 +1,70 @@ +#include "plot_reporter.hpp" +#include +#include +#include + +plot_reporter::plot_reporter() +{ + const char* pgplot_device=getenv("PGPLOT_DEVICE"); + if(pgplot_device==NULL) + { + if (cpgopen("/null") < 1) + { + assert(0); + } + } + else + { + if (cpgopen(pgplot_device) < 1) + { + assert(0); + } + } + cpgask(0); +} + + +plot_reporter::~plot_reporter() +{ + cpgclos(); +} + + +void plot_reporter::init_xyrange(float x1, + float x2, + float y1, + float y2, + int axis_flag) +{ + cpgenv(x1, x2, y1, y2, 0, axis_flag); +} + + +void plot_reporter::plot_line(std::vector& x,std::vector& y) +{ + cpgbbuf(); + cpgline(x.size(),x.data(),y.data()); + cpgebuf(); +} + +void plot_reporter::plot_err1_dot(std::vector& x,std::vector& y, + std::vector& e) +{ + cpgbbuf(); + cpgpt(x.size(),x.data(),y.data(),1); + cpgerrb(6,x.size(),x.data(),y.data(),e.data(),0); + cpgebuf(); +} + + +void plot_reporter::plot_err2_dot(std::vector& x,std::vector& y, + std::vector& e1,std::vector& e2) +{ + cpgbbuf(); + cpgpt(x.size(),x.data(),y.data(),1); + cpgerrb(2,x.size(),x.data(),y.data(),e1.data(),0); + cpgerrb(4,x.size(),x.data(),y.data(),e2.data(),0); + cpgebuf(); +} + +plot_reporter pr; -- cgit v1.2.2