diff options
author | Aaron LI <aaronly.me@gmail.com> | 2016-05-27 22:47:24 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@gmail.com> | 2016-05-27 22:47:24 +0800 |
commit | ffd178e0bd72562a3c2cff9747b6e656edc881dc (patch) | |
tree | 8800b7b5b2e8bc3df1a6760df5cd54eaaa686702 /mass_profile/plot_reporter.cpp | |
parent | 5c35fad9240fb42c1371c721e0b2af7379bd9ea0 (diff) | |
download | chandra-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/plot_reporter.cpp')
-rw-r--r-- | mass_profile/plot_reporter.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
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 <cpgplot.h> +#include <cassert> +#include <cstdlib> + +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<float>& x,std::vector<float>& y) +{ + cpgbbuf(); + cpgline(x.size(),x.data(),y.data()); + cpgebuf(); +} + +void plot_reporter::plot_err1_dot(std::vector<float>& x,std::vector<float>& y, + std::vector<float>& 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<float>& x,std::vector<float>& y, + std::vector<float>& e1,std::vector<float>& 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; |