Changeset 15755
- Timestamp:
- Dec 6, 2007, 3:46:12 PM (18 years ago)
- Location:
- trunk/ippTools
- Files:
-
- 1 added
- 4 edited
-
share/Makefile.am (modified) (1 diff)
-
share/flatcorr_find_processedimfiles.sql (added)
-
src/flatcorr.c (modified) (3 diffs)
-
src/flatcorr.h (modified) (1 diff)
-
src/flatcorrConfig.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/share/Makefile.am
r15695 r15755 41 41 flatcorr_completely_processed_chiprun.sql \ 42 42 flatcorr_find_completed_floatcorruns.sql \ 43 flatcorr_find_processedimfiles.sql \ 43 44 magictool_toprocess_inputs.sql \ 44 45 magictool_toprocess_tree.sql \ -
trunk/ippTools/src/flatcorr.c
r15695 r15755 35 35 static bool newrunMode(pxConfig *config); 36 36 static bool pendingMode(pxConfig *config); 37 static bool flatcorrimfileMode(pxConfig *config); 37 38 static bool updateMode(pxConfig *config); 38 39 … … 59 60 MODECASE(FLATCORR_MODE_NEWRUN, newrunMode); 60 61 MODECASE(FLATCORR_MODE_PENDING, pendingMode); 62 MODECASE(FLATCORR_MODE_FLATCORRIMFILE, flatcorrimfileMode); 61 63 MODECASE(FLATCORR_MODE_UPDATE, updateMode); 62 64 default: … … 429 431 } 430 432 433 434 static bool flatcorrimfileMode(pxConfig *config) 435 { 436 PS_ASSERT_PTR_NON_NULL(config, false); 437 438 439 bool status = false; 440 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 441 if (!status) { 442 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 443 return false; 444 } 445 446 // find all rawImfiles matching the default query 447 psString query = pxDataGet("flatcorr_find_processedimfiles.sql"); 448 if (!query) { 449 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 450 return false; 451 } 452 453 if (config->where) { 454 psString whereClause = psDBGenerateWhereConditionSQL(config->where, NULL); 455 psStringAppend(&query, " AND %s", whereClause); 456 psFree(whereClause); 457 } 458 459 // treat limit == 0 as "no limit" 460 if (limit) { 461 psString limitString = psDBGenerateLimitSQL(limit); 462 psStringAppend(&query, " %s", limitString); 463 psFree(limitString); 464 } 465 466 if (!p_psDBRunQuery(config->dbh, query)) { 467 psError(PS_ERR_UNKNOWN, false, "database error"); 468 psFree(query); 469 return false; 470 } 471 psFree(query); 472 473 psArray *output = p_psDBFetchResult(config->dbh); 474 if (!output) { 475 psErrorCode err = psErrorCodeLast(); 476 switch (err) { 477 case PS_ERR_DB_CLIENT: 478 psError(PXTOOLS_ERR_SYS, false, "database error"); 479 case PS_ERR_DB_SERVER: 480 psError(PXTOOLS_ERR_PROG, false, "database error"); 481 default: 482 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 483 } 484 485 return false; 486 } 487 if (!psArrayLength(output)) { 488 psTrace("warptool", PS_LOG_INFO, "no rows found"); 489 psFree(output); 490 return true; 491 } 492 493 bool simple = false; 494 { 495 bool status = false; 496 simple = psMetadataLookupBool(&status, config->args, "-simple"); 497 if (!status) { psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); 498 return false; 499 } 500 } 501 502 if (psArrayLength(output)) { 503 if (!convertIdToStr(output)) { 504 psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings"); 505 psFree(output); 506 return false; 507 } 508 509 // negative simple so the default is true 510 if (!ippdbPrintMetadatas(stdout, output, "chipProcessedImfile", !simple)) { 511 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 512 psFree(output); 513 return false; 514 } 515 } 516 517 psFree(output); 518 519 return true; 520 } 521 522 431 523 static bool updateMode(pxConfig *config) 432 524 { -
trunk/ippTools/src/flatcorr.h
r15578 r15755 27 27 FLATCORR_MODE_NEWRUN, 28 28 FLATCORR_MODE_PENDING, 29 FLATCORR_MODE_FLATCORRIMFILE, 29 30 FLATCORR_MODE_UPDATE 30 31 } flatcorrMode; -
trunk/ippTools/src/flatcorrConfig.c
r15684 r15755 144 144 "use the simple output format", false); 145 145 146 // -flatcorrimfile 147 psMetadata *flatcorrimfileArgs = psMetadataAlloc(); 148 psMetadataAddStr(flatcorrimfileArgs, PS_LIST_TAIL, "-corr_id", 0, 149 "search by exp_id", NULL); 150 psMetadataAddU64(flatcorrimfileArgs, PS_LIST_TAIL, "-limit", 0, 151 "limit result set to N items", 0); 152 psMetadataAddBool(flatcorrimfileArgs, PS_LIST_TAIL, "-simple", 0, 153 "use the simple output format", false); 154 146 155 // -update 147 156 psMetadata *updateArgs = psMetadataAlloc(); … … 156 165 PXTOOL_ADD_MODE("-pending", "show flat correction runs needing to be processed", 157 166 FLATCORR_MODE_PENDING, pendingArgs); 167 PXTOOL_ADD_MODE("-flatcorrimfile", "list all the exposures in flat correction runs", 168 FLATCORR_MODE_FLATCORRIMFILE, flatcorrimfileArgs); 158 169 PXTOOL_ADD_MODE("-update", "change a flat calibration run's state", 159 170 FLATCORR_MODE_UPDATE, updateArgs); … … 187 198 config->where = psMetadataAlloc(); 188 199 189 addWhereStr(det_id); 190 { 191 // XXX this is broke because you can't specify -iteration 0 192 psMetadataItem *item = psMetadataLookup(config->args, "-iteration"); 193 if (item && psStrcasestr(item->comment, "found")) { 194 if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "iteration", 0, "==", item->data.S32)) { 195 psError(PS_ERR_UNKNOWN, false, "failed to add item iteration"); 196 psFree(config); 197 return NULL; 198 } 200 { 201 psString str = NULL; 202 bool status = false; 203 if ((str = psMetadataLookupStr(&status, config->args, "-corr_id"))) { 204 if (!psMetadataAddS64(config->where, PS_LIST_TAIL, "corr_id", 0, "==", (psS64)atoll(str))) { 205 psError(PS_ERR_UNKNOWN, false, "failed to add item corr_id"); 206 psFree(config); 207 return NULL; 199 208 } 200 209 } 201 202 addWhereStr(det_id); 203 204 // convert '-code' to 'fault' 205 { 206 psS16 fault = 0; 207 bool status = false; 208 if ((fault = psMetadataLookupS16(&status, config->args, "-code"))) { 209 if (!psMetadataAddS16(config->where, PS_LIST_TAIL, "fault", 0, "==", fault)) { 210 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 211 psFree(config); 212 return NULL; 213 } 214 } 215 } 210 } 216 211 217 212 if (config->where->list->n < 1) {
Note:
See TracChangeset
for help on using the changeset viewer.
