1 | // ----------------------------------------------------------------------- |
---|
2 | // duchamp.hh: Definitions for use with Duchamp |
---|
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 DUCHAMP_HH |
---|
29 | #define DUCHAMP_HH |
---|
30 | |
---|
31 | #include <iostream> |
---|
32 | #include <string> |
---|
33 | |
---|
34 | #undef PACKAGE_BUGREPORT |
---|
35 | #undef PACKAGE_NAME |
---|
36 | #undef PACKAGE_STRING |
---|
37 | #undef PACKAGE_TARNAME |
---|
38 | #undef PACKAGE_VERSION |
---|
39 | #undef HAVE_PGPLOT |
---|
40 | #include <duchamp/config.h> |
---|
41 | |
---|
42 | #ifdef HAVE_PGPLOT |
---|
43 | #include <duchamp/Utils/mycpgplot.hh> |
---|
44 | #endif |
---|
45 | |
---|
46 | namespace duchamp |
---|
47 | { |
---|
48 | |
---|
49 | /** how to convey whether a function has worked */ |
---|
50 | enum OUTCOME {SUCCESS=0, FAILURE}; |
---|
51 | |
---|
52 | /** Usage message for command line help. */ |
---|
53 | const std::string ERR_USAGE_MSG = |
---|
54 | "Usage: Duchamp [OPTION] [FILE]\n\ |
---|
55 | Duchamp is an object finder for spectral-line FITS cubes.\n\ |
---|
56 | \n\ |
---|
57 | -p FILE Read in parameters from FILE, including FITS image location.\n\ |
---|
58 | -f FILE Use default parameters with imageFile=FILE\n\ |
---|
59 | -x Do not use X-windows PGPLOT output\n\ |
---|
60 | (equivalent to setting flagXOutput=false -- overrides the parameter file)\n\n\ |
---|
61 | -v Return version number and exit\n\ |
---|
62 | -h Display this help information and exit\n"; |
---|
63 | |
---|
64 | /** Usage message for command line help for Selavy. */ |
---|
65 | const std::string SELAVY_ERR_USAGE_MSG = |
---|
66 | "Usage: Selavy [OPTION] [FILE]\n\ |
---|
67 | Selavy re-analyses and re-plots objects found by Duchamp.\n\ |
---|
68 | \n\ |
---|
69 | -p FILE Read in parameters from FILE, including FITS image location.\n\ |
---|
70 | -f FILE Use default parameters with imageFile=FILE\n\ |
---|
71 | -x Do not use X-windows PGPLOT output\n\ |
---|
72 | (equivalent to setting flagXOutput=false -- overrides the parameter file)\n\n\ |
---|
73 | -v Return version number and exit\n\ |
---|
74 | -h Display this help information and exit\n"; |
---|
75 | |
---|
76 | /** Shorter Usage message for command line help. */ |
---|
77 | const std::string ERR_USAGE_MSG_SHORT="Usage: Duchamp -p [parameter file]\n"; |
---|
78 | |
---|
79 | /** The program name. (Duchamp) */ |
---|
80 | const std::string PROGNAME = PACKAGE_NAME; |
---|
81 | |
---|
82 | /** The program version */ |
---|
83 | const std::string VERSION = PACKAGE_VERSION; |
---|
84 | |
---|
85 | // Specialised functions to report warnings and errors -- in duchamp.cc |
---|
86 | /** Print a warning message to the stderr */ |
---|
87 | void duchampWarning(std::string subroutine, std::string warning); |
---|
88 | /** Print an error message to the stderr and sound the bell */ |
---|
89 | void duchampError(std::string subroutine, std::string error); |
---|
90 | |
---|
91 | |
---|
92 | /** The spectral type that we want the wcsprm structs to be in. */ |
---|
93 | const char duchampVelocityType[9] = "VOPT-F2W"; |
---|
94 | /** The spectral type that we want the wcsprm structs to be in when no |
---|
95 | velocity info is present. */ |
---|
96 | const char duchampFrequencyType[9] = "FREQ "; |
---|
97 | |
---|
98 | /** Descriptions of the various spectral axis types */ |
---|
99 | enum TYPEDESC {FREQUENCY=0,VELOCITY,WAVELENGTH}; |
---|
100 | /** Human-readable descriptions of the various spectral axis types */ |
---|
101 | const std::string duchampSpectralDescription[3]= |
---|
102 | {"Frequency", "Velocity", "Wavelength"}; |
---|
103 | |
---|
104 | // The following are the FITS Header Keywords corresponding to the |
---|
105 | // parameters related to the atrous reconstruction. |
---|
106 | /** FITS header keyword for min atrous scale*/ |
---|
107 | const std::string keyword_scaleMin = "DU_MINSC"; |
---|
108 | /** FITS header keyword for S/N used in atrous reconstruction*/ |
---|
109 | const std::string keyword_snrRecon = "DU_ATCUT"; |
---|
110 | /** FITS header keyword for number of dimensions used in atrous |
---|
111 | reconstruction*/ |
---|
112 | const std::string keyword_reconDim = "DU_ATDIM"; |
---|
113 | /** FITS header keyword for the code number of the filter used in |
---|
114 | atrous reconstruction*/ |
---|
115 | const std::string keyword_filterCode = "DU_FILTR"; |
---|
116 | /** FITS header keyword: does this file hold the reconstructed array |
---|
117 | or the residual?*/ |
---|
118 | const std::string keyword_ReconResid = "DU_RECON"; |
---|
119 | /** FITS header keyword: type of smoothing done. */ |
---|
120 | const std::string keyword_smoothtype = "DU_SMTYP"; |
---|
121 | /** FITS header keyword for the gaussian kernel major axis FWHM*/ |
---|
122 | const std::string keyword_kernmaj = "DU_KMAJ"; |
---|
123 | /** FITS header keyword for the gaussian kernel minor axis FWHM*/ |
---|
124 | const std::string keyword_kernmin = "DU_KMIN"; |
---|
125 | /** FITS header keyword for the gaussian kernel position angle*/ |
---|
126 | const std::string keyword_kernpa = "DU_KPA"; |
---|
127 | /** FITS header keyword for the Hanning filter width*/ |
---|
128 | const std::string keyword_hanningwidth = "DU_WHANN"; |
---|
129 | /** FITS header keyword for the image subsection used*/ |
---|
130 | const std::string keyword_subsection = "DU_IMSUB"; |
---|
131 | |
---|
132 | // And these are the comments corresponding to the relevant keywords |
---|
133 | /** FITS header comment for DU_MINSC keyword*/ |
---|
134 | const std::string comment_scaleMin = "Duchamp parameter scaleMin"; |
---|
135 | /** FITS header comment for DU_ATCUT keyword*/ |
---|
136 | const std::string comment_snrRecon = "Duchamp parameter snrRecon"; |
---|
137 | /** FITS header comment for DU_ATDIM keyword*/ |
---|
138 | const std::string comment_reconDim = "Duchamp parameter reconDim"; |
---|
139 | /** FITS header comment for DU_FILTR keyword*/ |
---|
140 | const std::string comment_filterCode = "Duchamp parameter filterCode"; |
---|
141 | /** FITS header comment for DU_RECON keyword*/ |
---|
142 | const std::string comment_ReconResid = "Is this the reconstruction or residual?"; |
---|
143 | /** FITS header comment for DU_SMTYP keyword*/ |
---|
144 | const std::string comment_smoothtype = "Type of smoothing done"; |
---|
145 | /** FITS header comment for DU_KMAJ keyword*/ |
---|
146 | const std::string comment_kernmaj = "Duchamp parameter kernMaj"; |
---|
147 | /** FITS header comment for DU_KMIN keyword*/ |
---|
148 | const std::string comment_kernmin = "Duchamp parameter kernMin"; |
---|
149 | /** FITS header comment for DU_KPA keyword*/ |
---|
150 | const std::string comment_kernpa = "Duchamp parameter kernPA"; |
---|
151 | /** FITS header comment for DU_WHANN keyword*/ |
---|
152 | const std::string comment_hanningwidth = "Duchamp parameter hanningWidth"; |
---|
153 | /** FITS header comment for DU_IMSUB keyword*/ |
---|
154 | const std::string comment_subsection = "Subsection of the original image"; |
---|
155 | |
---|
156 | // Descriptive Headers: for the reconstruction case |
---|
157 | const std::string header_reconHistory1 = |
---|
158 | "Reconstructed with a trous wavelet technique"; |
---|
159 | const std::string header_reconHistory2 = |
---|
160 | "Reconstruction by Duchamp v." + VERSION; |
---|
161 | const std::string header_reconHistory_input = |
---|
162 | "Original (input) image used by Duchamp follows"; |
---|
163 | const std::string header_reconSubsection_comment = |
---|
164 | "A subsection of the original was reconstructed by Duchamp"; |
---|
165 | const std::string header_atrous_comment = |
---|
166 | "The following are the Duchamp parameters used in reconstruction"; |
---|
167 | |
---|
168 | // Descriptive Headers: for the Smoothing case |
---|
169 | const std::string header_smoothHistory = |
---|
170 | "Smoothed by Duchamp v." + VERSION; |
---|
171 | const std::string header_smoothHistory_input = |
---|
172 | "Original (input) image used by Duchamp follows"; |
---|
173 | const std::string header_smoothSubsection_comment = |
---|
174 | "A subsection of the original was smoothed by Duchamp"; |
---|
175 | const std::string header_smoothSpatial = "Spatial, gaussian kernel"; |
---|
176 | const std::string header_smoothSpectral= "Spectral, hanning filter"; |
---|
177 | |
---|
178 | // Descriptive Headers: for the output Mask image |
---|
179 | const std::string header_maskHistory = |
---|
180 | "Results of searching by Duchamp v." + VERSION; |
---|
181 | const std::string header_maskHistory_input = |
---|
182 | "Input image used by Duchamp follows"; |
---|
183 | const std::string header_maskSubsection_comment = |
---|
184 | "A subsection of the original was searched by Duchamp"; |
---|
185 | |
---|
186 | } |
---|
187 | |
---|
188 | #ifdef HAVE_PGPLOT |
---|
189 | namespace duchamp |
---|
190 | { |
---|
191 | |
---|
192 | // Colours used in graphical output |
---|
193 | /** The colour for the Blank edges */ |
---|
194 | const int DUCHAMP_BLANK_EDGE_COLOUR = mycpgplot::MAGENTA; |
---|
195 | /** The colour for the edge of the cube */ |
---|
196 | const int DUCHAMP_CUBE_EDGE_COLOUR = mycpgplot::YELLOW; |
---|
197 | /** The colour for the reconstructed spectra */ |
---|
198 | const int DUCHAMP_RECON_SPECTRA_COLOUR = mycpgplot::RED; |
---|
199 | /** The colour for the baseline spectra */ |
---|
200 | const int DUCHAMP_BASELINE_SPECTRA_COLOUR = mycpgplot::YELLOW; |
---|
201 | /** The colour for the object outline */ |
---|
202 | const int DUCHAMP_OBJECT_OUTLINE_COLOUR = mycpgplot::BLUE; |
---|
203 | /** The colour for the Milky-way region spectral boundaries */ |
---|
204 | const int DUCHAMP_MILKY_WAY_COLOUR = mycpgplot::DARKGREEN; |
---|
205 | /** The colour for the tick marks in the image cutouts */ |
---|
206 | const int DUCHAMP_TICKMARK_COLOUR = mycpgplot::RED; |
---|
207 | /** The colour for the text identifying objects on the maps */ |
---|
208 | const int DUCHAMP_ID_TEXT_COLOUR = mycpgplot::RED; |
---|
209 | /** The colour for the WCS axes on the maps */ |
---|
210 | const int DUCHAMP_WCS_AXIS_COLOUR = mycpgplot::WCSGREEN; |
---|
211 | |
---|
212 | } |
---|
213 | |
---|
214 | #else |
---|
215 | namespace duchamp |
---|
216 | { |
---|
217 | /** The colour for the text identifying objects on the maps */ |
---|
218 | const int DUCHAMP_ID_TEXT_COLOUR = 2; |
---|
219 | /** The colour for the WCS axes on the maps */ |
---|
220 | const int DUCHAMP_WCS_AXIS_COLOUR = 3; |
---|
221 | |
---|
222 | } |
---|
223 | |
---|
224 | #endif |
---|
225 | |
---|
226 | |
---|
227 | #endif |
---|