Changeset 26981 for trunk/ippTools/src/flatcorr.c
- Timestamp:
- Feb 17, 2010, 4:40:03 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/flatcorr.c (modified) (27 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/flatcorr.c
r26567 r26981 115 115 if (!psListLength(where->list)) { 116 116 psFree(where); 117 psError(PXTOOLS_ERR_ DATA, false, "search parameters are required");118 return false; 119 } 120 121 // require the camera to be defined: this analysis does not make sense 117 psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required"); 118 return false; 119 } 120 121 // require the camera to be defined: this analysis does not make sense 122 122 // across multiple cameras 123 123 PXOPT_LOOKUP_STR(camera, config->args, "-inst", true, false); … … 142 142 psString query = pxDataGet("chiptool_find_rawexp.sql"); 143 143 if (!query) { 144 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");144 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 145 145 psFree(where); 146 146 return false; … … 173 173 174 174 if (pretend) { 175 for (long i = 0; i < psArrayLength(output); i++) {176 // negative simple so the default is true177 if (!ippdbPrintMetadataRaw(stdout, output->data[i], !simple)) {178 psError(PS_ERR_UNKNOWN, false, "failed to print array");179 psFree(output);180 return false;181 }182 }175 for (long i = 0; i < psArrayLength(output); i++) { 176 // negative simple so the default is true 177 if (!ippdbPrintMetadataRaw(stdout, output->data[i], !simple)) { 178 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 179 psFree(output); 180 return false; 181 } 182 } 183 183 psFree(output); 184 184 return true; … … 195 195 // create a new flatcorrRun 196 196 if (!flatcorrRunInsert( 197 config->dbh,197 config->dbh, 198 198 0, // corr_id 199 det_type,199 det_type, 200 200 dvodb, 201 camera,202 telescope,203 NULL,201 camera, 202 telescope, 203 NULL, 204 204 filter, 205 205 "reg", // state 206 make_correction,206 make_correction, 207 207 workdir, 208 208 label, 209 209 reduction, 210 region,211 NULL,212 0210 region, 211 NULL, 212 0 213 213 )) { 214 214 if (!psDBRollback(config->dbh)) { … … 310 310 // create a new flatcorrRun 311 311 flatcorrRunRow *row = flatcorrRunRowAlloc( 312 0, // corr_id313 det_type,314 dvodb,315 camera,316 telescope,317 NULL,318 filter,319 "reg", // state320 make_correction,321 workdir,322 label,323 reduction,324 region,325 NULL, // hostname326 0 // fault312 0, // corr_id 313 det_type, 314 dvodb, 315 camera, 316 telescope, 317 NULL, 318 filter, 319 "reg", // state 320 make_correction, 321 workdir, 322 label, 323 reduction, 324 region, 325 NULL, // hostname 326 0 // fault 327 327 ); 328 328 … … 335 335 return false; 336 336 } 337 337 338 338 // figure out the ID of the flatcorrRun we just created 339 339 psS64 corr_id = psDBLastInsertID(config->dbh); … … 377 377 psString query = pxDataGet("flatcorr_dropchip.sql"); 378 378 if (!query) { 379 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");380 return false;379 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 380 return false; 381 381 } 382 382 … … 420 420 psString query = pxDataGet("flatcorr_dropcamera.sql"); 421 421 if (!query) { 422 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");423 return false;422 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 423 return false; 424 424 } 425 425 … … 448 448 psString query = pxDataGet("flatcorr_chiprundone.sql"); 449 449 if (!query) { 450 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");451 return false;450 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 451 return false; 452 452 } 453 453 … … 461 461 // treat limit == 0 as "no limit" 462 462 if (limit) { 463 psString limitString = psDBGenerateLimitSQL(limit);464 psStringAppend(&query, " %s", limitString);465 psFree(limitString);463 psString limitString = psDBGenerateLimitSQL(limit); 464 psStringAppend(&query, " %s", limitString); 465 psFree(limitString); 466 466 } 467 467 … … 524 524 // queue the exp 525 525 if (!pxcamQueueByChipID( 526 config,527 row->chip_id,528 row->workdir,529 row->label,530 row->data_group,531 row->dist_group,532 row->reduction,533 row->expgroup,534 row->dvodb,535 row->tess_id,536 "camera",526 config, 527 row->chip_id, 528 row->workdir, 529 row->label, 530 row->data_group, 531 row->dist_group, 532 row->reduction, 533 row->expgroup, 534 row->dvodb, 535 row->tess_id, 536 "camera", 537 537 row->magicked, 538 538 NULL // note does not propragate … … 548 548 } 549 549 550 // figure out the ID of the flatcorrRun we just created551 psS64 cam_id = psDBLastInsertID(config->dbh);552 553 // add the camRun entry to the flatcorrCamLink table (include is TRUE)550 // figure out the ID of the flatcorrRun we just created 551 psS64 cam_id = psDBLastInsertID(config->dbh); 552 553 // add the camRun entry to the flatcorrCamLink table (include is TRUE) 554 554 if (!flatcorrCamLinkInsert(config->dbh, corr_id, row->chip_id, cam_id, 1)) { 555 555 if (!psDBRollback(config->dbh)) { … … 559 559 return false; 560 560 } 561 561 562 562 psFree(row); 563 563 } … … 587 587 psString query = pxDataGet("flatcorr_camerarundone.sql"); 588 588 if (!query) { 589 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");590 return false;589 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 590 return false; 591 591 } 592 592 … … 600 600 // treat limit == 0 as "no limit" 601 601 if (limit) { 602 psString limitString = psDBGenerateLimitSQL(limit);603 psStringAppend(&query, " %s", limitString);604 psFree(limitString);602 psString limitString = psDBGenerateLimitSQL(limit); 603 psStringAppend(&query, " %s", limitString); 604 psFree(limitString); 605 605 } 606 606 … … 663 663 // queue the exp : force image_only to be false (flatcorr is meaningless with just image info) 664 664 if (!pxaddQueueByCamID( 665 config,666 row->cam_id,667 row->workdir,668 row->reduction,669 row->label,665 config, 666 row->cam_id, 667 row->workdir, 668 row->reduction, 669 row->label, 670 670 row->data_group, 671 row->dvodb,671 row->dvodb, 672 672 NULL, // note is not propagated 673 0)) {673 0)) { 674 674 if (!psDBRollback(config->dbh)) { 675 675 psError(PS_ERR_UNKNOWN, false, "database error"); … … 682 682 } 683 683 684 // figure out the ID of the flatcorrRun we just created685 psS64 add_id = psDBLastInsertID(config->dbh);686 687 // add the addRun entry to the flatcorrAddstarLink table (include is TRUE)684 // figure out the ID of the flatcorrRun we just created 685 psS64 add_id = psDBLastInsertID(config->dbh); 686 687 // add the addRun entry to the flatcorrAddstarLink table (include is TRUE) 688 688 if (!flatcorrAddstarLinkInsert(config->dbh, corr_id, row->cam_id, add_id, 1)) { 689 689 if (!psDBRollback(config->dbh)) { … … 719 719 psString query = pxDataGet("flatcorr_pendingprocess.sql"); 720 720 if (!query) { 721 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");722 return false;721 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 722 return false; 723 723 } 724 724 … … 732 732 // treat limit == 0 as "no limit" 733 733 if (limit) { 734 psString limitString = psDBGenerateLimitSQL(limit);735 psStringAppend(&query, " %s", limitString);736 psFree(limitString);734 psString limitString = psDBGenerateLimitSQL(limit); 735 psStringAppend(&query, " %s", limitString); 736 psFree(limitString); 737 737 } 738 738 … … 755 755 756 756 if (!ippdbPrintMetadatas(stdout, output, "flatcorrPending", !simple)) { 757 psError(PS_ERR_UNKNOWN, false, "failed to print array");758 psFree(output);759 return false;757 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 758 psFree(output); 759 return false; 760 760 } 761 761 … … 814 814 // treat limit == 0 as "no limit" 815 815 if (limit) { 816 psString limitString = psDBGenerateLimitSQL(limit);817 psStringAppend(&query, " %s", limitString);818 psFree(limitString);816 psString limitString = psDBGenerateLimitSQL(limit); 817 psStringAppend(&query, " %s", limitString); 818 psFree(limitString); 819 819 } 820 820 … … 837 837 838 838 if (!ippdbPrintMetadatas(stdout, output, "flatcorrPending", !simple)) { 839 psError(PS_ERR_UNKNOWN, false, "failed to print array");840 psFree(output);841 return false;839 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 840 psFree(output); 841 return false; 842 842 } 843 843 … … 854 854 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 855 855 PXOPT_LOOKUP_BOOL(limit, config->args, "-limit", false); 856 856 857 857 psMetadata *where = psMetadataAlloc(); 858 858 PXOPT_COPY_S64(config->args, where, "-chip_id", "chipProcessedImfile.chip_id", "=="); … … 860 860 psString query = pxDataGet("flatcorr_inputimfile.sql"); 861 861 if (!query) { 862 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");862 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 863 863 return false; 864 864 } … … 873 873 // treat limit == 0 as "no limit" 874 874 if (limit) { 875 psString limitString = psDBGenerateLimitSQL(limit);876 psStringAppend(&query, " %s", limitString);877 psFree(limitString);875 psString limitString = psDBGenerateLimitSQL(limit); 876 psStringAppend(&query, " %s", limitString); 877 psFree(limitString); 878 878 } 879 879 … … 896 896 897 897 if (!ippdbPrintMetadatas(stdout, output, "flatcorrPending", !simple)) { 898 psError(PS_ERR_UNKNOWN, false, "failed to print array");899 psFree(output);900 return false;898 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 899 psFree(output); 900 return false; 901 901 } 902 902 … … 910 910 911 911 // check that state is a valid string value 912 if (!strcmp(state, "reg") && 913 !strcmp(state, "new") && 914 !strcmp(state, "full"))912 if (!strcmp(state, "reg") && 913 !strcmp(state, "new") && 914 !strcmp(state, "full")) 915 915 { 916 916 psError(PS_ERR_UNKNOWN, false, "invalid state: %s", state);
Note:
See TracChangeset
for help on using the changeset viewer.
