1 | // ----------------------------------------------------------------------- |
---|
2 | // SpectralPlot.hh: Definition of the class producing a page of spectral plots |
---|
3 | // ----------------------------------------------------------------------- |
---|
4 | // Copyright (C) 2006, Matthew Whiting, ATNF |
---|
5 | // |
---|
6 | // This program is free software; you can redistribute it and/or modify it |
---|
7 | // under the terms of the GNU General Public License as published by the |
---|
8 | // Free Software Foundation; either version 2 of the License, or (at your |
---|
9 | // option) any later version. |
---|
10 | // |
---|
11 | // Duchamp is distributed in the hope that it will be useful, but WITHOUT |
---|
12 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
13 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
---|
14 | // for more details. |
---|
15 | // |
---|
16 | // You should have received a copy of the GNU General Public License |
---|
17 | // along with Duchamp; if not, write to the Free Software Foundation, |
---|
18 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA |
---|
19 | // |
---|
20 | // Correspondence concerning Duchamp may be directed to: |
---|
21 | // Internet email: Matthew.Whiting [at] atnf.csiro.au |
---|
22 | // Postal address: Dr. Matthew Whiting |
---|
23 | // Australia Telescope National Facility, CSIRO |
---|
24 | // PO Box 76 |
---|
25 | // Epping NSW 1710 |
---|
26 | // AUSTRALIA |
---|
27 | // ----------------------------------------------------------------------- |
---|
28 | #ifndef SPECTRALPLOT_H |
---|
29 | #define SPECTRALPLOT_H |
---|
30 | |
---|
31 | #include <string> |
---|
32 | #include <duchamp/Plotting/MultipleDuchampPlot.hh> |
---|
33 | #include <duchamp/duchamp.hh> |
---|
34 | #include <duchamp/param.hh> |
---|
35 | #include <duchamp/Utils/Statistics.hh> |
---|
36 | |
---|
37 | namespace duchamp |
---|
38 | { |
---|
39 | |
---|
40 | namespace Plot |
---|
41 | { |
---|
42 | |
---|
43 | // These are the constants used for spacing out elements in SpectralPlot. |
---|
44 | const float spMainX1 = 2.0; ///< min X-value of main box [cm] |
---|
45 | const float spMainX2 = 13.7; ///< max X-value of main box [cm] |
---|
46 | const float spZoomX1 = 15.0; ///< min X-value of zoom box [cm] |
---|
47 | const float spZoomX2 = 16.8; ///< max X-value of zoom box [cm] |
---|
48 | const float spMapX1 = 17.0; ///< min X-value of map box [cm] |
---|
49 | const float spMainY1 = 1.5; ///< min Y-value of box wrt base of current spectrum [cm] |
---|
50 | const float spMainY2 = 3.4; ///< max Y-value of box wrt base of current spectrum [cm] |
---|
51 | const float spXlabelOffset = 3.0; ///< Offset for X-axis label. |
---|
52 | const float spYlabelOffset = 4.0; ///< Offset for Y-axis label. |
---|
53 | const float spTitleOffset1 = 5.1; ///< Offset for first title line. |
---|
54 | const float spTitleOffset2 = 3.6; ///< Offset for second title line. |
---|
55 | const float spTitleOffset3 = 2.1; ///< Offset for third title line. |
---|
56 | const float spTitleOffset4 = 0.6; ///< Offset for fourth title line. |
---|
57 | |
---|
58 | class SpectralPlot: public MultipleDuchampPlot |
---|
59 | { |
---|
60 | public: |
---|
61 | SpectralPlot(); ///< Constructor |
---|
62 | virtual ~SpectralPlot(){}; ///< Destructor |
---|
63 | SpectralPlot(const SpectralPlot& other); |
---|
64 | SpectralPlot& operator=(const SpectralPlot& other); |
---|
65 | |
---|
66 | /// @brief Calculate boundaries for boxes. |
---|
67 | void calcCoords(); |
---|
68 | |
---|
69 | using MultipleDuchampPlot::gotoHeader; |
---|
70 | /// @brief Set up the header and write the X label |
---|
71 | void gotoHeader(std::string xlabel); |
---|
72 | |
---|
73 | /// @brief Write first line of header information (position/velocity info) in correct place. |
---|
74 | void firstHeaderLine(std::string line); |
---|
75 | |
---|
76 | /// @brief Write second line of header information (fluxes) in correct place. |
---|
77 | void secondHeaderLine(std::string line); |
---|
78 | |
---|
79 | /// @brief Write third line of header information (WCS widths) in correct place. |
---|
80 | void thirdHeaderLine(std::string line); |
---|
81 | |
---|
82 | /// @brief Write fourth line of header information (pixel coordinates) in correct place. |
---|
83 | void fourthHeaderLine(std::string line); |
---|
84 | |
---|
85 | /// @brief Set up main spectral plotting region. |
---|
86 | void gotoMainSpectrum(float x1, float x2, float y1, float y2, std::string ylabel); |
---|
87 | |
---|
88 | /// @brief Set up zoomed-in spectral plotting region. |
---|
89 | void gotoZoomSpectrum(float x1, float x2, float y1, float y2); |
---|
90 | |
---|
91 | /// @brief Defines the region for the moment map. |
---|
92 | void gotoMap(); |
---|
93 | |
---|
94 | /// @brief Draw lines indicating velocity range. |
---|
95 | void drawVelRange(float v1, float v2); |
---|
96 | |
---|
97 | /// @brief Draw box showing excluded range due flagged channels. |
---|
98 | void drawFlaggedChannelRange(float v1, float v2); |
---|
99 | |
---|
100 | /// @brief Draw thresholds |
---|
101 | void drawThresholds(Param &par, Statistics::StatsContainer<float> &stats); |
---|
102 | |
---|
103 | /// @brief Draw thesholds when baselines have been subtracted. |
---|
104 | void drawThresholds(Param &par, Statistics::StatsContainer<float> &stats, float *vel, float *baseline, size_t size); |
---|
105 | |
---|
106 | private: |
---|
107 | float zoomCoords[4]; ///< Boundaries for the zoomed-in spectrum [inches] |
---|
108 | |
---|
109 | }; |
---|
110 | |
---|
111 | } |
---|
112 | |
---|
113 | } |
---|
114 | |
---|
115 | #endif |
---|