Changeset 18920 for trunk/ppSub/src/ppSubArguments.c
- Timestamp:
- Aug 5, 2008, 11:52:02 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ppSub/src/ppSubArguments.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSub/src/ppSubArguments.c
r18770 r18920 41 41 } \ 42 42 } \ 43 psMetadataAdd##TYPE( config->arguments, PS_LIST_TAIL, RECIPENAME, 0, NULL, value); \43 psMetadataAdd##TYPE(recipe, PS_LIST_TAIL, RECIPENAME, PS_META_REPLACE, NULL, value); \ 44 44 } 45 45 … … 56 56 } \ 57 57 } \ 58 psMetadataAdd##TYPE( config->arguments, PS_LIST_TAIL, RECIPENAME, 0, NULL, value); \58 psMetadataAdd##TYPE(recipe, PS_LIST_TAIL, RECIPENAME, PS_META_REPLACE, NULL, value); \ 59 59 } 60 60 … … 68 68 psString value = psMetadataLookupStr(NULL, arguments, argName); // Value of interest 69 69 if (value && strlen(value) > 0) { 70 return psMetadataAddStr(target, PS_LIST_TAIL, mdName, 0, NULL, value);70 return psMetadataAddStr(target, PS_LIST_TAIL, mdName, PS_META_REPLACE, NULL, value); 71 71 } 72 72 return false; … … 91 91 } 92 92 } 93 return psMetadataAddStr(target, PS_LIST_TAIL, mdName, 0, NULL, value);93 return psMetadataAddStr(target, PS_LIST_TAIL, mdName, PS_META_REPLACE, NULL, value); 94 94 } 95 95 … … 149 149 } 150 150 151 psMetadataAddVector(target, PS_LIST_TAIL, recipeName, 0, NULL, vector);151 psMetadataAddVector(target, PS_LIST_TAIL, recipeName, PS_META_REPLACE, NULL, vector); 152 152 psFree(vector); // Drop reference 153 153 … … 184 184 psMetadataAddS32(arguments, PS_LIST_TAIL, "-size", 0, "Kernel half-size (pixels)", 0); 185 185 psMetadataAddS32(arguments, PS_LIST_TAIL, "-order", 0, "Spatial polynomial order", -1); 186 psMetadataAddStr(arguments, PS_LIST_TAIL, "-type", 0, "Kernel type (ISIS|POIS|SPAM|FRIES|GUNK|RINGS)", NULL); 186 psMetadataAddStr(arguments, PS_LIST_TAIL, "-type", 0, 187 "Kernel type (ISIS|POIS|SPAM|FRIES|GUNK|RINGS)", NULL); 187 188 psMetadataAddF32(arguments, PS_LIST_TAIL, "-penalty", 0, "Penalty for wideness", NAN); 188 psMetadataAddStr(arguments, PS_LIST_TAIL, "-isis-widths", 0, "ISIS Gaussian FWHMs (comma-separated)", NULL); 189 psMetadataAddStr(arguments, PS_LIST_TAIL, "-isis-orders", 0, "ISIS polynomial orders (comma-separated)", NULL); 189 psMetadataAddStr(arguments, PS_LIST_TAIL, "-isis-widths", 0, 190 "ISIS Gaussian FWHMs (comma-separated)", NULL); 191 psMetadataAddStr(arguments, PS_LIST_TAIL, "-isis-orders", 0, 192 "ISIS polynomial orders (comma-separated)", NULL); 190 193 psMetadataAddS32(arguments, PS_LIST_TAIL, "-rings-order", 0, "RINGS polynomial order", -1); 191 194 psMetadataAddS32(arguments, PS_LIST_TAIL, "-inner", 0, "SPAM and FRIES inner radius", -1); … … 201 204 psMetadataAddBool(arguments, PS_LIST_TAIL, "-reverse", 0, "Reverse sense of subtraction?", false); 202 205 psMetadataAddBool(arguments, PS_LIST_TAIL, "-generate-mask", 0, "Generate mask if not supplied?", false); 203 psMetadataAddStr(arguments, PS_LIST_TAIL, "-stamps", 0, "Stamps filename; file has x,y on each line", NULL); 204 psMetadataAddBool(arguments, PS_LIST_TAIL, "-opt", 0, "Derive optimum parameters for ISIS kernels?", false); 206 psMetadataAddStr(arguments, PS_LIST_TAIL, "-stamps", 0, 207 "Stamps filename; file has x,y on each line", NULL); 208 psMetadataAddBool(arguments, PS_LIST_TAIL, "-opt", 0, 209 "Derive optimum parameters for ISIS kernels?", false); 205 210 psMetadataAddF32(arguments, PS_LIST_TAIL, "-opt-min", 0, "Minimum value for optimum kernel search", NAN); 206 211 psMetadataAddF32(arguments, PS_LIST_TAIL, "-opt-max", 0, "Minimum value for optimum kernel search", NAN); … … 221 226 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "Name of the output image", argv[3]); 222 227 223 const char *inMask = psMetadataLookupStr(NULL, config->arguments, "-inmask"); // Name of input mask228 const char *inMask = psMetadataLookupStr(NULL, arguments, "-inmask"); // Name of input mask 224 229 if (inMask && strlen(inMask) > 0) { 225 230 fileList("INPUT.MASK", inMask, "Name of the input mask image", config); 226 231 } 227 const char *inWeight = psMetadataLookupStr(NULL, config->arguments, "-inweight"); // Name of input weight232 const char *inWeight = psMetadataLookupStr(NULL, arguments, "-inweight"); // Name of input weight 228 233 if (inWeight && strlen(inWeight) > 0) { 229 234 fileList("INPUT.WEIGHT", inWeight, "Name of the input weight image", config); 230 235 } 231 236 232 const char *refMask = psMetadataLookupStr(NULL, config->arguments, "-refmask"); // Name of reference mask237 const char *refMask = psMetadataLookupStr(NULL, arguments, "-refmask"); // Name of reference mask 233 238 if (refMask && strlen(refMask) > 0) { 234 239 fileList("REF.MASK", refMask, "Name of the reference mask image", config); 235 240 } 236 const char *refWeight = psMetadataLookupStr(NULL, config->arguments, "-refweight"); // Name of ref weight241 const char *refWeight = psMetadataLookupStr(NULL, arguments, "-refweight"); // Name of ref weight 237 242 if (refWeight && strlen(refWeight) > 0) { 238 243 fileList("REF.WEIGHT", refWeight, "Name of the reference weight image", config); 239 244 } 240 245 241 if (psMetadataLookupBool(NULL, config->arguments, "-photometry")) { 242 psMetadataAddBool(config->arguments, PS_LIST_TAIL, "PHOTOMETRY", 0, "Perform photometry?", true); 246 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim 247 if (!recipe) { 248 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find recipe %s", PPSUB_RECIPE); 249 return false; 250 } 251 252 if (psMetadataLookupBool(NULL, arguments, "-photometry")) { 253 psMetadataAddBool(recipe, PS_LIST_TAIL, "PHOTOMETRY", PS_META_REPLACE, "Perform photometry?", true); 243 254 } 244 255 … … 250 261 assert(config); 251 262 252 valueArgStr(config->arguments, "-stats", "STATS", config->arguments); 253 valueArgStr(config->arguments, "-stamps", "STAMPS", config->arguments); 263 psMetadata *arguments = config->arguments; // Command-line arguments 264 265 valueArgStr(arguments, "-stats", "STATS", arguments); 266 valueArgStr(arguments, "-stamps", "STAMPS", arguments); 254 267 255 268 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim … … 273 286 VALUE_ARG_RECIPE_FLOAT("-penalty", "PENALTY", F32); 274 287 275 valueArgRecipeStr( config->arguments, recipe, "-mask-bad", "MASK.BAD", config->arguments);276 valueArgRecipeStr( config->arguments, recipe, "-mask-blank", "MASK.BLANK", config->arguments);277 278 vectorArgRecipe( config->arguments, "-isis-widths", recipe, "ISIS.WIDTHS", config->arguments, PS_TYPE_F32);279 vectorArgRecipe( config->arguments, "-isis-orders", recipe, "ISIS.ORDERS", config->arguments, PS_TYPE_S32);280 281 psVector *widths = psMetadataLookupPtr(NULL, config->arguments, "ISIS.WIDTHS"); // ISIS Gaussian widths282 psVector *orders = psMetadataLookupPtr(NULL, config->arguments, "ISIS.ORDERS"); // ISIS Polynomial orders288 valueArgRecipeStr(arguments, recipe, "-mask-bad", "MASK.BAD", recipe); 289 valueArgRecipeStr(arguments, recipe, "-mask-blank", "MASK.BLANK", recipe); 290 291 vectorArgRecipe(arguments, "-isis-widths", recipe, "ISIS.WIDTHS", recipe, PS_TYPE_F32); 292 vectorArgRecipe(arguments, "-isis-orders", recipe, "ISIS.ORDERS", recipe, PS_TYPE_S32); 293 294 psVector *widths = psMetadataLookupPtr(NULL, recipe, "ISIS.WIDTHS"); // ISIS Gaussian widths 295 psVector *orders = psMetadataLookupPtr(NULL, recipe, "ISIS.ORDERS"); // ISIS Polynomial orders 283 296 if (widths->n != orders->n) { 284 297 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Size of vectors for ISIS widths and orders do not match."); … … 286 299 } 287 300 288 if (psMetadataLookupBool(NULL, config->arguments, "-opt") || 289 psMetadataLookupBool(NULL, recipe, "OPTIMUM")) { 290 psMetadataAddBool(config->arguments, PS_LIST_TAIL, "OPTIMUM", 0, 301 if (psMetadataLookupBool(NULL, arguments, "-opt") || psMetadataLookupBool(NULL, recipe, "OPTIMUM")) { 302 psMetadataAddBool(recipe, PS_LIST_TAIL, "OPTIMUM", PS_META_REPLACE, 291 303 "Derive optimum parameters for ISIS kernels?", true); 292 304 VALUE_ARG_RECIPE_FLOAT("-opt-min", "OPTIMUM.MIN", F32); … … 297 309 } 298 310 299 psMetadataAddBool( config->arguments, PS_LIST_TAIL, "REVERSE", 0, "Reverse sense of subtraction",300 psMetadataLookupBool(NULL, config->arguments, "-reverse"));301 psMetadataAddBool( config->arguments, PS_LIST_TAIL, "MASK.GENERATE", 0, "Generate mask if not supplied",302 psMetadataLookupBool(NULL, config->arguments, "-generate-mask"));303 psMetadataAddBool( config->arguments, PS_LIST_TAIL, "DUAL", 0, "Dual convolution?",304 psMetadataLookupBool(NULL, config->arguments, "-dual"));305 306 if (psMetadataLookupBool(NULL, config->arguments, "-renorm") ||311 psMetadataAddBool(arguments, PS_LIST_TAIL, "REVERSE", 0, "Reverse sense of subtraction", 312 psMetadataLookupBool(NULL, arguments, "-reverse")); 313 psMetadataAddBool(recipe, PS_LIST_TAIL, "MASK.GENERATE", PS_META_REPLACE, "Generate mask if not supplied", 314 psMetadataLookupBool(NULL, arguments, "-generate-mask")); 315 psMetadataAddBool(recipe, PS_LIST_TAIL, "DUAL", PS_META_REPLACE, "Dual convolution?", 316 psMetadataLookupBool(NULL, arguments, "-dual")); 317 318 if (psMetadataLookupBool(NULL, arguments, "-renorm") || 307 319 psMetadataLookupBool(NULL, recipe, "RENORM")) { 308 psMetadataAddBool( config->arguments, PS_LIST_TAIL, "RENORM", 0, "Renormalise weights?", true);320 psMetadataAddBool(recipe, PS_LIST_TAIL, "RENORM", PS_META_REPLACE, "Renormalise weights?", true); 309 321 VALUE_ARG_RECIPE_INT("-renorm-width", "RENORM.WIDTH", S32, 0); 310 322 } 311 323 312 if (psMetadataLookupBool(NULL, config->arguments, "-photometry") || 313 psMetadataLookupBool(NULL, recipe, "PHOTOMETRY")) { 314 psMetadataAddBool(config->arguments, PS_LIST_TAIL, "PHOTOMETRY", PS_META_REPLACE, 315 "Perform photometry?", true); 324 // Need to update this because it could have been overwritten by the camera's own recipe 325 if (psMetadataLookupBool(NULL, arguments, "-photometry")) { 326 psMetadataAddBool(recipe, PS_LIST_TAIL, "PHOTOMETRY", PS_META_REPLACE, "Perform photometry?", true); 316 327 } 317 328 318 329 // Translate the kernel type 319 psString type = psMetadataLookupStr(NULL, config->arguments, "-type"); // Name of kernel type330 psString type = psMetadataLookupStr(NULL, arguments, "-type"); // Name of kernel type 320 331 if (!type || strlen(type) == 0) { 321 332 type = psMetadataLookupStr(NULL, recipe, "KERNEL.TYPE"); … … 325 336 } 326 337 } 327 pmSubtractionKernelsType kernelType = pmSubtractionKernelsTypeFromString(type); // Type of kernel 328 if (kernelType == PM_SUBTRACTION_KERNEL_NONE) { 329 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Unrecognised kernel type: %s", type); 330 goto ERROR; 331 } 332 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "KERNEL.TYPE", 0, "Type of kernel", kernelType); 338 psMetadataAddStr(recipe, PS_LIST_TAIL, "KERNEL.TYPE", PS_META_REPLACE, "Type of kernel", type); 333 339 334 340 psTrace("ppSub", 1, "Done reading command-line arguments\n"); 341 342 // Dump configuration, now that's it's settled 343 { 344 pmConfigCamerasCull(config); 345 pmConfigRecipesCull(config, "PPSUB,PPSTATS,PSPHOT,MASKS"); 346 347 const char *outroot = psMetadataLookupStr(NULL, arguments, "OUTPUT"); // Output root name 348 psAssert(outroot, "Should be there, we put it there!"); 349 350 pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PPSUB.INPUT"); // Input file 351 pmConfigDump(config, input->fpa, outroot); 352 } 353 335 354 return true; 336 355
Note:
See TracChangeset
for help on using the changeset viewer.
