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