Changeset 21244 for trunk/ppMerge/src/ppMergeArguments.c
- Timestamp:
- Feb 1, 2009, 11:43:05 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/ppMerge/src/ppMergeArguments.c (modified) (21 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppMerge/src/ppMergeArguments.c
r21183 r21244 1 /** @file ppMergeArguments.c 2 * 3 * @brief 4 * 5 * @ingroup ppMerge 6 * 7 * @author IfA 8 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:43:05 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 #include "ppMerge.h" 2 14 3 // Print usage information and die 4 static void usage(const char *program, // Name of the program 5 psMetadata *arguments // Command-line arguments 15 /** 16 * Print usage information and die 17 */ 18 static void usage(const char *program, ///< Name of the program 19 psMetadata *arguments ///< Command-line arguments 6 20 ) 7 21 { … … 18 32 } 19 33 20 // Get a float-point value from the command-line or recipe, and add it to the arguments 34 /** 35 * Get a float-point value from the command-line or recipe, and add it to the arguments 36 */ 21 37 #define VALUE_ARG_RECIPE_FLOAT(ARGNAME, RECIPENAME, TYPE) { \ 22 38 ps##TYPE value = psMetadataLookup##TYPE(NULL, arguments, ARGNAME); \ … … 33 49 } 34 50 35 // Get an integer value from the command-line or recipe, and add it to the arguments 51 /** 52 * Get an integer value from the command-line or recipe, and add it to the arguments 53 */ 36 54 #define VALUE_ARG_RECIPE_INT(ARGNAME, RECIPENAME, TYPE, UNSET) { \ 37 55 ps##TYPE value = psMetadataLookup##TYPE(NULL, arguments, ARGNAME); \ … … 48 66 } 49 67 50 // Get a boolean from the command-line or recipe, and add it to the arguments if either is set 68 /** 69 * Get a boolean from the command-line or recipe, and add it to the arguments if either is set 70 */ 51 71 #define VALUE_ARG_RECIPE_BOOL(ARGNAME, RECIPENAME) { \ 52 72 bool value = (psMetadataLookupBool(NULL, arguments, ARGNAME) || \ … … 55 75 } 56 76 57 // Get a statistic name from the command-line or recipe, and add the enum to the arguments 77 /** 78 * Get a statistic name from the command-line or recipe, and add the enum to the arguments 79 */ 58 80 #define VALUE_ARG_RECIPE_STAT(ARGNAME, RECIPENAME) { \ 59 81 const char *stat = psMetadataLookupStr(NULL, arguments, ARGNAME); \ … … 69 91 } 70 92 71 // Get a string from the command-line or recipe, and add to the arguments 93 /** 94 * Get a string from the command-line or recipe, and add to the arguments 95 */ 72 96 #define VALUE_ARG_RECIPE_STR(ARGNAME, RECIPENAME) { \ 73 97 const char *str = psMetadataLookupStr(NULL, arguments, ARGNAME); \ … … 83 107 } 84 108 85 // Get a string from the command-line or recipe, and add the appropriate mask value to the arguments 109 /** 110 * Get a string from the command-line or recipe, and add the appropriate mask value to the arguments 111 */ 86 112 #define VALUE_ARG_RECIPE_MASK(ARGNAME, RECIPENAME) { \ 87 113 const char *str = psMetadataLookupStr(NULL, arguments, ARGNAME); \ … … 98 124 } 99 125 100 // Get a string value from the command-line and add it to the target 101 static bool valueArgStr(psMetadata *arguments, // Command-line arguments 102 const char *argName, // Argument name in the command-line arguments 103 const char *mdName, // Name for value in the metadata 104 psMetadata *target // Target metadata to which to add value 126 /** 127 * Get a string value from the command-line and add it to the target 128 */ 129 static bool valueArgStr(psMetadata *arguments, ///< Command-line arguments 130 const char *argName, ///< Argument name in the command-line arguments 131 const char *mdName, ///< Name for value in the metadata 132 psMetadata *target ///< Target metadata to which to add value 105 133 ) 106 134 { 107 psString value = psMetadataLookupStr(NULL, arguments, argName); // Value of interest135 psString value = psMetadataLookupStr(NULL, arguments, argName); ///< Value of interest 108 136 if (value && strlen(value) > 0) { 109 137 return psMetadataAddStr(target, PS_LIST_TAIL, mdName, 0, NULL, value); … … 116 144 assert(config); 117 145 118 psMetadata *arguments = psMetadataAlloc(); // Command-line arguments146 psMetadata *arguments = psMetadataAlloc(); ///< Command-line arguments 119 147 psMetadataAddStr(arguments, PS_LIST_TAIL, "-type", 0, "Type of calibration frame", NULL); 120 148 psMetadataAddStr(arguments, PS_LIST_TAIL, "-stats", 0, "MDC file to hold statistics ", NULL); … … 136 164 psMetadataAddStr(arguments, PS_LIST_TAIL, "-stdev", 0, "Statistic to use to measure the stdev", NULL); 137 165 138 / / Fringe construction parameters166 /** Fringe construction parameters */ 139 167 psMetadataAddS32(arguments, PS_LIST_TAIL, "-fringe-num", 0, "Number of fringe regions", 0); 140 168 psMetadataAddS32(arguments, PS_LIST_TAIL, "-fringe-size", 0, "Half-size of fringe regions", 0); … … 142 170 psMetadataAddS32(arguments, PS_LIST_TAIL, "-fringe-ysmooth", 0, "Number of smoothing regions in y", 0); 143 171 144 / / Shutter construction parameters172 /** Shutter construction parameters */ 145 173 psMetadataAddS32(arguments, PS_LIST_TAIL, "-shutter-size", 0, "Size for shutter measurement regions", 0); 146 174 psMetadataAddS32(arguments, PS_LIST_TAIL, "-shutter-iter", 0, "Number of iterations for shutter", 0); 147 175 psMetadataAddF32(arguments, PS_LIST_TAIL, "-shutter-rej", 0, "Rejection limit for shutter", NAN); 148 176 149 / / Mask construction parameters177 /** Mask construction parameters */ 150 178 psMetadataAddF32(arguments, PS_LIST_TAIL, "-mask-suspect", 0, "Threshold for suspect pixels (sigma)", NAN); 151 179 psMetadataAddF32(arguments, PS_LIST_TAIL, "-mask-bad", 0, "Threshold for bad pixels (sigma)", NAN); … … 189 217 } 190 218 191 unsigned int numBad = 0; // Number of bad lines192 psMetadata *inputs = psMetadataConfigRead(NULL, &numBad, argv[1], false); // Information about inputs219 unsigned int numBad = 0; ///< Number of bad lines 220 psMetadata *inputs = psMetadataConfigRead(NULL, &numBad, argv[1], false); ///< Information about inputs 193 221 if (!inputs || numBad > 0) { 194 222 psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to cleanly read MDC file with inputs."); … … 205 233 206 234 // Set the type of calibration frame 207 const char *typeStr = psMetadataLookupStr(NULL, arguments, "-type"); // Type of calibration235 const char *typeStr = psMetadataLookupStr(NULL, arguments, "-type"); ///< Type of calibration 208 236 if (!typeStr || strlen(typeStr) <= 0) { 209 237 psError(PS_ERR_UNKNOWN, false, "No -type specified."); 210 238 goto ERROR; 211 239 } 212 ppMergeType type = PPMERGE_TYPE_UNKNOWN; // Enumerated type for frame type240 ppMergeType type = PPMERGE_TYPE_UNKNOWN; ///< Enumerated type for frame type 213 241 if (strcasecmp(typeStr, "BIAS") == 0) { 214 242 type = PPMERGE_TYPE_BIAS; … … 258 286 } 259 287 260 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPMERGE_RECIPE); // Recipe for ppSim288 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPMERGE_RECIPE); ///< Recipe for ppSim 261 289 if (!recipe) { 262 290 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find recipe %s", PPMERGE_RECIPE); … … 264 292 } 265 293 266 / / Standard combination parameters294 /** Standard combination parameters */ 267 295 VALUE_ARG_RECIPE_INT("-rows", "ROWS", S32, 0); 268 296 VALUE_ARG_RECIPE_INT("-sample", "SAMPLE", S32, 0); … … 281 309 VALUE_ARG_RECIPE_STAT("-stdev", "STDEV"); 282 310 283 / / Fringe construction parameters311 /** Fringe construction parameters */ 284 312 VALUE_ARG_RECIPE_INT("-fringe-num", "FRINGE.NUM", S32, 0); 285 313 VALUE_ARG_RECIPE_INT("-fringe-size", "FRINGE.SIZE", S32, 0); … … 287 315 VALUE_ARG_RECIPE_INT("-fringe-ysmooth", "FRINGE.YSMOOTH", S32, 0); 288 316 289 / / Shutter construction parameters317 /** Shutter construction parameters */ 290 318 VALUE_ARG_RECIPE_INT("-shutter-size", "SHUTTER.SIZE", S32, 0); 291 319 292 / / Mask construction parameters320 /** Mask construction parameters */ 293 321 VALUE_ARG_RECIPE_FLOAT("-mask-suspect", "MASK.SUSPECT", F32); 294 322 VALUE_ARG_RECIPE_FLOAT("-mask-bad", "MASK.BAD", F32); … … 300 328 VALUE_ARG_RECIPE_FLOAT("-mask-smooth-scale", "MASK.SMOOTH.SCALE", F32); 301 329 302 const char *maskModeStr = psMetadataLookupStr(NULL, arguments, "-mask-mode"); // Mode to identify bad pix330 const char *maskModeStr = psMetadataLookupStr(NULL, arguments, "-mask-mode"); ///< Mode to identify bad pix 303 331 if (!maskModeStr) { 304 332 maskModeStr = psMetadataLookupStr(NULL, recipe, "MASK.MODE"); … … 318 346 319 347 if (type == PPMERGE_TYPE_DARK) { 320 psMetadata *ordinates = psMetadataLookupMetadata(NULL, recipe, "DARK.ORDINATES"); // Ordinates info321 psArray *translated = psArrayAllocEmpty(psListLength(ordinates->list)); // Translated version322 323 psMetadataIterator *iter = psMetadataIteratorAlloc(ordinates, PS_LIST_HEAD, NULL); // Iterator324 psMetadataItem *item; // Item from iteration348 psMetadata *ordinates = psMetadataLookupMetadata(NULL, recipe, "DARK.ORDINATES"); ///< Ordinates info 349 psArray *translated = psArrayAllocEmpty(psListLength(ordinates->list)); ///< Translated version 350 351 psMetadataIterator *iter = psMetadataIteratorAlloc(ordinates, PS_LIST_HEAD, NULL); ///< Iterator 352 psMetadataItem *item; ///< Item from iteration 325 353 while ((item = psMetadataGetAndIncrement(iter))) { 326 int order = 0; // Polynomial order327 bool scale = false; // Scale values?328 float min = NAN, max = NAN; // Minimum and maximum values for scaling354 int order = 0; ///< Polynomial order 355 bool scale = false; ///< Scale values? 356 float min = NAN, max = NAN; ///< Minimum and maximum values for scaling 329 357 switch (item->type) { 330 358 case PS_TYPE_S32: … … 333 361 case PS_DATA_METADATA: 334 362 order = psMetadataLookupS32(NULL, item->data.md, "ORDER"); 335 bool mdok; // Status of MD lookup363 bool mdok; ///< Status of MD lookup 336 364 scale = psMetadataLookupBool(&mdok, item->data.md, "SCALE"); 337 365 min = psMetadataLookupF32(&mdok, item->data.md, "MIN"); … … 361 389 psMetadataAddArray(config->arguments, PS_LIST_TAIL, "DARK.ORDINATES", 0, 362 390 "Ordinates to fit for dark", translated); 363 psFree(translated); // Drop reference364 365 psString darkNorm = psMetadataLookupStr(NULL, recipe, "DARK.NORM"); // Normalisation concept391 psFree(translated); ///< Drop reference 392 393 psString darkNorm = psMetadataLookupStr(NULL, recipe, "DARK.NORM"); ///<Normalisation concept 366 394 if (darkNorm && strcmp(darkNorm, "NONE") != 0) { 367 395 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "DARK.NORM", 0,
Note:
See TracChangeset
for help on using the changeset viewer.
