Changeset 27838 for branches/tap_branches/ippTools/src/flatcorr.c
- Timestamp:
- May 3, 2010, 8:41:49 AM (16 years ago)
- Location:
- branches/tap_branches
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ippTools/src (modified) (1 prop)
-
ippTools/src/flatcorr.c (modified) (29 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/tap_branches
- Property svn:mergeinfo changed
-
branches/tap_branches/ippTools/src
- Property svn:ignore
-
old new 16 16 difftool 17 17 disttool 18 dqstatstool 18 19 faketool 19 20 flatcorr
-
- Property svn:ignore
-
branches/tap_branches/ippTools/src/flatcorr.c
r25835 r27838 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); … … 133 133 PXOPT_LOOKUP_STR(tess_id, config->args, "-set_tess_id", false, false); 134 134 PXOPT_LOOKUP_STR(region, config->args, "-set_region", false, false); 135 PXOPT_LOOKUP_BOOL(make_correction, config->args, "-make_correction", false); 135 136 PXOPT_LOOKUP_STR(note, config->args, "-set_note", false, false); 136 137 … … 141 142 psString query = pxDataGet("chiptool_find_rawexp.sql"); 142 143 if (!query) { 143 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");144 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 144 145 psFree(where); 145 146 return false; … … 172 173 173 174 if (pretend) { 174 for (long i = 0; i < psArrayLength(output); i++) {175 // negative simple so the default is true176 if (!ippdbPrintMetadataRaw(stdout, output->data[i], !simple)) {177 psError(PS_ERR_UNKNOWN, false, "failed to print array");178 psFree(output);179 return false;180 }181 }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 } 182 183 psFree(output); 183 184 return true; … … 194 195 // create a new flatcorrRun 195 196 if (!flatcorrRunInsert( 196 config->dbh,197 config->dbh, 197 198 0, // corr_id 198 det_type,199 det_type, 199 200 dvodb, 200 camera,201 telescope,202 NULL,201 camera, 202 telescope, 203 NULL, 203 204 filter, 204 205 "reg", // state 206 make_correction, 205 207 workdir, 206 208 label, 207 209 reduction, 208 region,209 NULL,210 0210 region, 211 NULL, 212 0 211 213 )) { 212 214 if (!psDBRollback(config->dbh)) { … … 294 296 PXOPT_LOOKUP_STR(tess_id, config->args, "-set_tess_id", false, false); 295 297 PXOPT_LOOKUP_STR(region, config->args, "-set_region", false, false); 298 PXOPT_LOOKUP_BOOL(make_correction, config->args, "-make_correction", false); 296 299 // XXX probably should make the region in -set_region match ra_min, ra_max, etc 297 300 … … 307 310 // create a new flatcorrRun 308 311 flatcorrRunRow *row = flatcorrRunRowAlloc( 309 0, // corr_id 310 det_type, 311 dvodb, 312 camera, 313 telescope, 314 NULL, 315 filter, 316 "reg", // state 317 workdir, 318 label, 319 reduction, 320 region, 321 NULL, // hostname 322 0 // fault 312 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 323 327 ); 324 328 … … 331 335 return false; 332 336 } 333 337 334 338 // figure out the ID of the flatcorrRun we just created 335 339 psS64 corr_id = psDBLastInsertID(config->dbh); … … 373 377 psString query = pxDataGet("flatcorr_dropchip.sql"); 374 378 if (!query) { 375 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");376 return false;379 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 380 return false; 377 381 } 378 382 … … 416 420 psString query = pxDataGet("flatcorr_dropcamera.sql"); 417 421 if (!query) { 418 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");419 return false;422 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 423 return false; 420 424 } 421 425 … … 444 448 psString query = pxDataGet("flatcorr_chiprundone.sql"); 445 449 if (!query) { 446 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");447 return false;450 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 451 return false; 448 452 } 449 453 … … 457 461 // treat limit == 0 as "no limit" 458 462 if (limit) { 459 psString limitString = psDBGenerateLimitSQL(limit);460 psStringAppend(&query, " %s", limitString);461 psFree(limitString);463 psString limitString = psDBGenerateLimitSQL(limit); 464 psStringAppend(&query, " %s", limitString); 465 psFree(limitString); 462 466 } 463 467 … … 520 524 // queue the exp 521 525 if (!pxcamQueueByChipID( 522 config, 523 row->chip_id, 524 row->workdir, 525 row->label, 526 row->data_group, 527 row->dist_group, 528 row->reduction, 529 row->expgroup, 530 row->dvodb, 531 row->tess_id, 532 "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 row->magicked, 533 538 NULL // note does not propragate 534 539 )) { … … 543 548 } 544 549 545 // figure out the ID of the flatcorrRun we just created546 psS64 cam_id = psDBLastInsertID(config->dbh);547 548 // 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) 549 554 if (!flatcorrCamLinkInsert(config->dbh, corr_id, row->chip_id, cam_id, 1)) { 550 555 if (!psDBRollback(config->dbh)) { … … 554 559 return false; 555 560 } 556 561 557 562 psFree(row); 558 563 } … … 582 587 psString query = pxDataGet("flatcorr_camerarundone.sql"); 583 588 if (!query) { 584 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");585 return false;589 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 590 return false; 586 591 } 587 592 … … 595 600 // treat limit == 0 as "no limit" 596 601 if (limit) { 597 psString limitString = psDBGenerateLimitSQL(limit);598 psStringAppend(&query, " %s", limitString);599 psFree(limitString);602 psString limitString = psDBGenerateLimitSQL(limit); 603 psStringAppend(&query, " %s", limitString); 604 psFree(limitString); 600 605 } 601 606 … … 658 663 // queue the exp : force image_only to be false (flatcorr is meaningless with just image info) 659 664 if (!pxaddQueueByCamID( 660 config,661 row->cam_id,662 row->workdir,663 row->reduction,664 row->label,665 config, 666 row->cam_id, 667 row->workdir, 668 row->reduction, 669 row->label, 665 670 row->data_group, 666 row->dvodb,671 row->dvodb, 667 672 NULL, // note is not propagated 668 0)) {673 0)) { 669 674 if (!psDBRollback(config->dbh)) { 670 675 psError(PS_ERR_UNKNOWN, false, "database error"); … … 677 682 } 678 683 679 // figure out the ID of the flatcorrRun we just created680 psS64 add_id = psDBLastInsertID(config->dbh);681 682 // 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) 683 688 if (!flatcorrAddstarLinkInsert(config->dbh, corr_id, row->cam_id, add_id, 1)) { 684 689 if (!psDBRollback(config->dbh)) { … … 714 719 psString query = pxDataGet("flatcorr_pendingprocess.sql"); 715 720 if (!query) { 716 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");717 return false;721 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 722 return false; 718 723 } 719 724 … … 727 732 // treat limit == 0 as "no limit" 728 733 if (limit) { 729 psString limitString = psDBGenerateLimitSQL(limit);730 psStringAppend(&query, " %s", limitString);731 psFree(limitString);734 psString limitString = psDBGenerateLimitSQL(limit); 735 psStringAppend(&query, " %s", limitString); 736 psFree(limitString); 732 737 } 733 738 … … 750 755 751 756 if (!ippdbPrintMetadatas(stdout, output, "flatcorrPending", !simple)) { 752 psError(PS_ERR_UNKNOWN, false, "failed to print array");753 psFree(output);754 return false;757 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 758 psFree(output); 759 return false; 755 760 } 756 761 … … 809 814 // treat limit == 0 as "no limit" 810 815 if (limit) { 811 psString limitString = psDBGenerateLimitSQL(limit);812 psStringAppend(&query, " %s", limitString);813 psFree(limitString);816 psString limitString = psDBGenerateLimitSQL(limit); 817 psStringAppend(&query, " %s", limitString); 818 psFree(limitString); 814 819 } 815 820 … … 832 837 833 838 if (!ippdbPrintMetadatas(stdout, output, "flatcorrPending", !simple)) { 834 psError(PS_ERR_UNKNOWN, false, "failed to print array");835 psFree(output);836 return false;839 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 840 psFree(output); 841 return false; 837 842 } 838 843 … … 849 854 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 850 855 PXOPT_LOOKUP_BOOL(limit, config->args, "-limit", false); 851 856 852 857 psMetadata *where = psMetadataAlloc(); 853 858 PXOPT_COPY_S64(config->args, where, "-chip_id", "chipProcessedImfile.chip_id", "=="); … … 855 860 psString query = pxDataGet("flatcorr_inputimfile.sql"); 856 861 if (!query) { 857 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");862 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 858 863 return false; 859 864 } … … 868 873 // treat limit == 0 as "no limit" 869 874 if (limit) { 870 psString limitString = psDBGenerateLimitSQL(limit);871 psStringAppend(&query, " %s", limitString);872 psFree(limitString);875 psString limitString = psDBGenerateLimitSQL(limit); 876 psStringAppend(&query, " %s", limitString); 877 psFree(limitString); 873 878 } 874 879 … … 891 896 892 897 if (!ippdbPrintMetadatas(stdout, output, "flatcorrPending", !simple)) { 893 psError(PS_ERR_UNKNOWN, false, "failed to print array");894 psFree(output);895 return false;898 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 899 psFree(output); 900 return false; 896 901 } 897 902 … … 905 910 906 911 // check that state is a valid string value 907 if (!strcmp(state, "reg") && 908 !strcmp(state, "new") && 909 !strcmp(state, "full"))912 if (!strcmp(state, "reg") && 913 !strcmp(state, "new") && 914 !strcmp(state, "full")) 910 915 { 911 916 psError(PS_ERR_UNKNOWN, false, "invalid state: %s", state);
Note:
See TracChangeset
for help on using the changeset viewer.
