source: tags/release-1.1.9/src/duchamp.hh @ 1441

Last change on this file since 1441 was 670, checked in by MatthewWhiting, 14 years ago

Substantive changes aimed at addressing ticket #72. The moment-0 map is now able to be saved to a FITS file. As far as the user is concerned, the functionality is as
for the mask cube, with equivalent parameters. The documentation has also been updated.

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