LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
Params.h
Go to the documentation of this file.
1 #ifndef MeasAlgoShapeletParams_H
2 #define MeasAlgoShapeletParams_H
3 
4 #include <stdexcept>
5 #include <vector>
6 #include <ostream>
7 
8 namespace lsst {
9 namespace meas {
10 namespace algorithms {
11 namespace shapelet {
12 
13  // Default value for various measured quantities
14 #define DEFVALPOS 9999
15 #define DEFVALNEG -9999
16 
17  //
18  // Flags
19  //
20  static const long INPUT_FLAG = 0x1;
21  static const long TRANSFORM_EXCEPTION = 0x2;
22  static const long FITTEDPSF_EXCEPTION = 0x4;
23  static const long TMV_EXCEPTION = 0x8;
24  static const long STD_EXCEPTION = 0x10;
25  static const long UNKNOWN_EXCEPTION = 0x20;
26  static const long EDGE = 0x40;
27  static const long LT10PIX = 0x80;
28  static const long MEASURE_PSF_FAILED = 0x100;
29  static const long NATIVE_FAILED = 0x200;
30  static const long TOO_SMALL = 0x400;
31  static const long DECONV_FAILED = 0x800;
32  static const long SHEAR_FAILED = 0x1000;
33  static const long SHAPELET_FAILED = 0x2000;
34  static const long SHEAR_REDUCED_ORDER = 0x4000;
35  static const long SHAPE_REDUCED_ORDER = 0x8000;
36  static const long SHEAR_LOCAL_MIN = 0x10000;
37  static const long SHEAR_POOR_FIT = 0x20000;
38  static const long SHAPE_LOCAL_MIN = 0x40000;
39  static const long SHAPE_POOR_FIT = 0x80000;
40  static const long SHEAR_BAD_COVAR = 0x100000;
41  static const long NO_SINGLE_EPOCH_IMAGES = 0x200000;
42  static const long BKG_NOPIX = 0x400000;
43  static const long PSF_INTERP_OUTLIER = 0x800000;
44  static const long SHEAR_BAD_FLUX = 0x1000000;
45  static const long PSF_BAD_FLUX = 0x2000000;
46  static const long SHAPE_BAD_FLUX = 0x4000000;
47  static const long CENTROID_FAILED = 0x8000000;
48  static const long SHAPELET_NOT_DECONV = 0x10000000;
49  static const long SHEAR_DIDNT_CONVERGE = 0x20000000;
50 
51  static const long NFLAGS = 30;
52 
53  static const char*const flagName[NFLAGS] = {
54  "INPUT_FLAG",
55  "TRANSFORM_EXCEPTION",
56  "FITTEDPSF_EXCEPTION",
57  "TMV_EXCEPTION",
58  "STD_EXCEPTION",
59  "UNKNOWN_EXCEPTION",
60  "EDGE",
61  "LT10PIX",
62  "MEASURE_PSF_FAILED",
63  "NATIVE_FAILED",
64  "TOO_SMALL",
65  "DECONV_FAILED",
66  "SHEAR_FAILED",
67  "SHAPELET_FAILED",
68  "SHEAR_REDUCED_ORDER",
69  "SHAPE_REDUCED_ORDER",
70  "SHEAR_LOCAL_MIN",
71  "SHEAR_POOR_FIT",
72  "SHAPE_LOCAL_MIN",
73  "SHAPE_POOR_FIT",
74  "SHEAR_BAD_COVAR",
75  "NO_SINGLE_EPOCH_IMAGES",
76  "BKG_NOPIX",
77  "PSF_INTERP_OUTLIER",
78  "SHEAR_BAD_FLUX",
79  "PSF_BAD_FLUX",
80  "SHAPE_BAD_FLUX",
81  "CENTROID_FAILED",
82  "SHAPELET_NOT_DECONV",
83  "SHEAR_DIDNT_CONVERGE"
84  };
85 
86  void PrintFlags(const std::vector<long>& flags, std::ostream& os);
87 
88  // Errors specific to the weak lensing code
89 
90  struct FileNotFoundError : public std::runtime_error
91  {
92  FileNotFoundError(const std::string& filename) throw() :
93  std::runtime_error("Error: file "+filename+" not found")
94  {}
95  };
96 
97  struct ParameterException : public std::runtime_error
98  {
99  ParameterException(const std::string& msg) throw() :
100  std::runtime_error(msg)
101  {}
102  };
103 
104  struct ReadException : public std::runtime_error
105  {
106  ReadException(const std::string& msg) throw() :
107  std::runtime_error(msg)
108  {}
109  };
110 
111  struct WriteException : public std::runtime_error
112  {
113  WriteException(const std::string& msg) throw() :
114  std::runtime_error(msg)
115  {}
116  };
117 
118  struct ProcessingException : public std::runtime_error
119  {
120  ProcessingException(const std::string& msg) throw() :
121  std::runtime_error(msg)
122  {}
123  };
124 
125  // Errors that may be thrown by the weak lensing code, but
126  // defined in other files
127 
128  // StarFinderException -- Treat as ProcessingException
129  // AssertFailure -- Treat as ProcessingException
130  // tmv::Error -- Treat as ProcessingException
131  // std::exception -- Treat as ProcessingException
132 
133 
134 
135  //
136  // Exit codes
137  //
138 
139  enum ExitCode {
140  SUCCESS = 0,
147  };
148 
149  const char* Text(const ExitCode& code);
150 
151  class ConfigFile;
152  int Status(ExitCode code, const ConfigFile& params);
153 
154 
155  // tolerance for testing output files
156 #define TEST_TOL 1.e-6
157 
158 }}}}
159 
160 #endif
const char * Text(const ExitCode &code)
Definition: Params.cc:58
FileNotFoundError(const std::string &filename)
Definition: Params.h:92
int Status(ExitCode code, const ConfigFile &params)
Definition: Params.cc:80
void PrintFlags(const std::vector< long > &flags, std::ostream &os)
Definition: Params.cc:33