Changeset 7602
- Timestamp:
- Jun 20, 2006, 5:13:14 PM (20 years ago)
- Location:
- trunk/ippTools/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/dettool.c
r7600 r7602 11 11 static bool defineMode(pxConfig *config); 12 12 static bool runsMode(pxConfig *config); 13 static bool selectrunsMode(pxConfig *config); 13 14 static bool inputMode(pxConfig *config); 14 15 static bool rawMode(pxConfig *config); … … 50 51 MODECASE(DETTOOL_MODE_DEFINE, defineMode); 51 52 MODECASE(DETTOOL_MODE_RUNS, runsMode); 53 MODECASE(DETTOOL_MODE_SELECTRUNS, selectrunsMode); 52 54 MODECASE(DETTOOL_MODE_INPUT, inputMode); 53 55 MODECASE(DETTOOL_MODE_RAW, rawMode); … … 269 271 270 272 psFree(runs); 273 274 return true; 275 } 276 277 static bool selectrunsMode(pxConfig *config) 278 { 279 PS_ASSERT_PTR_NON_NULL(config, 0); 280 281 // -inst & -dete_type are required 282 bool status = false; 283 psString camera = psMetadataLookupStr(&status, config->args, "-inst"); 284 if (!status) { 285 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst"); 286 return false; 287 } 288 if (!camera) { 289 psError(PS_ERR_UNKNOWN, true, "-inst is required"); 290 return false; 291 } 292 psString det_type = psMetadataLookupStr(&status, config->args, "-det_type"); 293 if (!status) { 294 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -det_type"); 295 return false; 296 } 297 if (!det_type) { 298 psError(PS_ERR_UNKNOWN, true, "-det_type is required"); 299 return false; 300 } 301 302 char *query = "SELECT detRun.position, det_type, camera FROM detRun JOIN detInputExp where camera = '%s' and det_type = '%s' LIMIT 1"; 303 304 if (!p_psDBRunQuery(config->dbh, query, camera, det_type)) { 305 psError(PS_ERR_UNKNOWN, false, "database error"); 306 return false; 307 } 308 309 psArray *result = p_psDBFetchResult(config->dbh); 310 if (!result) { 311 } 312 313 // sanity check the result 314 if (psArrayLength(result) != 1) { 315 } 316 317 // just a view... doesn't need to be free'd 318 psMetadata *run = result->data[0]; 319 320 psS32 det_id = psMetadataLookupS32(&status, run, "position"); 321 if (!status) { 322 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for position"); 323 psFree(result); 324 return false; 325 } 326 327 psFree(result); 328 329 fprintf(stdout, "FLAT CHIP %d DONE\n", det_id); 271 330 272 331 return true; … … 1987 2046 return newIteration; 1988 2047 } 2048 -
trunk/ippTools/src/dettool.h
r7423 r7602 8 8 DETTOOL_MODE_DEFINE, 9 9 DETTOOL_MODE_RUNS, 10 DETTOOL_MODE_SELECTRUNS, 10 11 DETTOOL_MODE_INPUT, 11 12 DETTOOL_MODE_RAW, -
trunk/ippTools/src/dettoolConfig.c
r7514 r7602 31 31 psMetadata *runsArgs = psMetadataAlloc(); 32 32 psMetadataAddStr(runsArgs, PS_LIST_TAIL, "-det_type", 0, 33 "search for type of detrend run", NULL); 34 35 // -selectruns 36 psMetadata *selectrunsArgs = psMetadataAlloc(); 37 psMetadataAddStr(selectrunsArgs, PS_LIST_TAIL, "-inst", 0, 38 "search for detrend run for this camera", NULL); 39 psMetadataAddStr(selectrunsArgs, PS_LIST_TAIL, "-det_type", 0, 33 40 "search for type of detrend run", NULL); 34 41 … … 276 283 PXTOOL_MODE("-raw", DETTOOL_MODE_RAW, rawArgs); 277 284 PXTOOL_MODE("-runs", DETTOOL_MODE_RUNS, runsArgs); 285 PXTOOL_MODE("-selectruns", DETTOOL_MODE_SELECTRUNS, selectrunsArgs); 278 286 PXTOOL_MODE("-input", DETTOOL_MODE_INPUT, inputArgs); 279 287 PXTOOL_MODE("-addprocessed", DETTOOL_MODE_ADDPROCESSED, addprocArgs); … … 306 314 printf("\nPan-STARRS Detrend Tool\n"); 307 315 printf("Usage: %s <mode> [<options>]\n\n", argv[0]); 308 printf(" <mode> : [-define|-r aw|-addprocessed|-processed|-addstacked|-stacked|-stackedframe|-addnormalized|-normalized|-normalizedframe|-addresid|-resid|-addresidexp|-residexp|-declaremasterframe|-masterframe|-master|-rerun]\n\n");316 printf(" <mode> : [-define|-runs|-selectruns|-raw|-addprocessed|-processed|-addstacked|-stacked|-stackedframe|-addnormalized|-normalized|-normalizedframe|-addresid|-resid|-addresidexp|-residexp|-declaremasterframe|-masterframe|-master|-rerun]\n\n"); 309 317 fprintf (stdout, "-define "); 310 318 psArgumentHelp(defineArgs); … … 313 321 psArgumentHelp(runsArgs); 314 322 psFree(runsArgs); 323 fprintf (stdout, "-selectruns "); 324 psArgumentHelp(selectrunsArgs); 325 psFree(selectrunsArgs); 315 326 fprintf (stdout, "-input "); 316 327 psArgumentHelp(inputArgs); … … 373 384 psFree(defineArgs); 374 385 psFree(runsArgs); 386 psFree(selectrunsArgs); 375 387 psFree(inputArgs); 376 388 psFree(rawArgs);
Note:
See TracChangeset
for help on using the changeset viewer.
