source: trunk/src/duchamp.hh @ 203

Last change on this file since 203 was 201, checked in by Matthew Whiting, 18 years ago
  • New functionality added: ability to smooth a cube (in each individual spectrum) using a hanning filter before searching.
  • This comes with associated input parameters: flagSmooth and hanningWidth.
  • Hanning smoothing implemented via a new class that does the smoothing
  • Other minor changes:
    • changed the way getIAUName is called.
    • new colour names in mycpgplot
    • a << operator for the StatsContainer? class
    • more robust ProgressBar? functions
    • updated the Makefile.in
File size: 4.4 KB
Line 
1/* src/duchamp.hh.  Generated by configure.  */
2#ifndef DUCHAMP_HH
3#define DUCHAMP_HH
4
5#include <iostream>
6#include <string>
7
8#undef PACKAGE_BUGREPORT
9#undef PACKAGE_NAME
10#undef PACKAGE_STRING
11#undef PACKAGE_TARNAME
12#undef PACKAGE_VERSION
13#include "config.h"
14
15// how to convey whether a function has worked
16enum OUTCOME {SUCCESS=0, FAILURE};
17
18const std::string ERR_USAGE_MSG =
19"Usage:: Duchamp -p [parameter file]\n\
20  Other options:\n\
21    -f <file>  Use default parameters with imageFile=<file>\n\
22    -v         Version number\n\
23    -h         This help information\n";
24
25const std::string ERR_USAGE_MSG_SHORT="Usage:: Duchamp -p [parameter file]\n";
26
27const std::string PROGNAME = PACKAGE_NAME;
28
29const std::string VERSION = PACKAGE_VERSION;
30
31// Specialised functions to report warnings and errors.
32// These are defined in duchamp.cc
33void duchampWarning(std::string subroutine, std::string warning);
34void duchampError(std::string subroutine, std::string error);
35
36// A simple functions to print a given number of backspaces or spaces
37//  to std::cout
38inline void printBackSpace(int num){for(int i=0;i<num;i++) std::cout << '\b';};
39inline void printSpace(int num){ for(int i=0;i<num;i++) std::cout << ' '; };
40inline void printHash(int num){ for(int i=0;i<num;i++) std::cout << '#'; };
41class ProgressBar
42{
43  /**
44   *  ProgressBar Class
45   *   A class that prints out a progress bar in the form |####    |
46   *    that shows how far through a function or loop you are.
47   *   The length of it defaults to 20, but can be set when declaring the
48   *    object.
49   *   There are three functions:
50   *        init(size) --> prints an empty bar, and defines the increment
51   *        update(num) --> prints the correct number of #s, but only when
52   *                        num is a multiple of the increment.
53   *        rewind(num) --> prints backspaces to cover the entire bar.
54   */
55public:
56  ProgressBar(){length=20; loc=BEG;};
57  ProgressBar(int newlength){length=newlength; loc=BEG;};
58  enum POS {BEG=0,END};
59
60  void init(int size){ 
61    std::cout << "|"; printSpace(length);
62    std::cout << "|" << std::flush;
63    fraction = size/length;
64    loc = END;
65  };
66  void update(int num){
67    if(num%fraction==0){
68      printBackSpace(length+2); std::cout << "|";
69      printHash(num/fraction); printSpace(length-num/fraction);
70      std::cout << "|" << std::flush;
71    }
72    loc=END;
73  };
74  void rewind(){if(loc==END) printBackSpace(length+2); loc=BEG;};
75  void remove(){rewind();printSpace(length+2);loc=END; rewind();};
76  void fillSpace(std::string someString){
77    rewind();
78    std::cout << someString;
79    printSpace(length+2-someString.size());
80    loc=END;
81  }
82private:
83  POS loc;
84  int fraction;
85  int length;
86};
87
88// The spectral type that we want the wcsprm structs to be in
89const char duchampVelocityType[9] = "VELO-F2V";
90const char duchampFrequencyType[9] = "FREQ";
91
92enum TYPEDESC {FREQUENCY=0,VELOCITY,WAVELENGTH};
93const std::string duchampSpectralDescription[3]=
94  {"Frequency", "Velocity", "Wavelength"};
95
96// The following are the FITS Header Keywords corresponding to the
97//  parameters related to the atrous reconstruction.
98const std::string keyword_scaleMin   = "DU_MINSC";
99const std::string keyword_snrRecon   = "DU_ATCUT";
100const std::string keyword_reconDim   = "DU_ATDIM";
101const std::string keyword_filterCode = "DU_FILTR";
102const std::string keyword_ReconResid = "DU_RECON";//reconstruction or residual?
103const std::string keyword_subsection = "DU_IMSUB";
104
105// And these are the comments corresponding to the relevant keywords
106const std::string comment_scaleMin   = "Duchamp parameter scaleMin";
107const std::string comment_snrRecon   = "Duchamp parameter snrRecon";
108const std::string comment_reconDim   = "Duchamp parameter reconDim";
109const std::string comment_filterCode = "Duchamp parameter filterCode";
110const std::string comment_ReconResid = "Is this the reconstruction or residual?";
111const std::string comment_subsection = "Subsection of the original image";
112// Descriptive Headers:
113const std::string header_history1 = "Reconstructed with a trous wavelet technique";
114const std::string header_history2 = "Reconstruction by Duchamp v." + VERSION;
115const std::string header_history_input = "Original (input) image used by Duchamp follows";
116const std::string header_subsection_comment  = "A subsection of the original was reconstructed by Duchamp";
117const std::string header_atrous_comment  = "The following are the Duchamp parameters used in reconstruction";
118
119#endif
120
Note: See TracBrowser for help on using the repository browser.