Changeset 11047 for trunk/ippTools/src/dettool.c
- Timestamp:
- Jan 11, 2007, 3:38:56 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/dettool.c (modified) (46 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/dettool.c
r10741 r11047 77 77 //static psArray *validDetInputClassIds(pxConfig *config, const char *det_id); 78 78 //static psArray *searchInputImfiles(pxConfig *config, const char *det_id); 79 static detInputExpRow *rawDetrenTodetInputExpRow(raw DetrendExpRow *rawExp, psS32 det_id, psS32 iteration);79 static detInputExpRow *rawDetrenTodetInputExpRow(rawExpRow *rawExp, psS32 det_id, psS32 iteration); 80 80 static psArray *searchRawImfiles(pxConfig *config, psMetadata *where); 81 81 static psS32 incrementIteration(pxConfig *config, const char *det_id); … … 161 161 psString query = psStringCopy( 162 162 "SELECT" 163 " raw DetrendExp.*"164 " FROM raw DetrendExp"163 " rawExp.*" 164 " FROM rawExp" 165 165 " LEFT JOIN detInputExp" 166 " ON raw DetrendExp.exp_tag = detInputExp.exp_tag"166 " ON rawExp.exp_tag = detInputExp.exp_tag" 167 167 " WHERE" 168 168 " detInputExp.exp_tag IS NULL" … … 170 170 171 171 if (config->where) { 172 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "raw DetrendExp");172 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "rawExp"); 173 173 psStringAppend(&query, " AND %s", whereClause); 174 174 psFree(whereClause); … … 189 189 if (!psArrayLength(output)) { 190 190 // XXX check psError here 191 psError(PS_ERR_UNKNOWN, false, "no pending raw DetrendExp rows found");191 psError(PS_ERR_UNKNOWN, false, "no pending rawExp rows found"); 192 192 psFree(output); 193 193 return true; … … 205 205 206 206 // negative simple so the default is true 207 if (!ippdbPrintMetadatas(stdout, output, "raw DetrendExp", !simple)) {207 if (!ippdbPrintMetadatas(stdout, output, "rawExp", !simple)) { 208 208 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 209 209 psFree(output); … … 390 390 391 391 // check that the specified exp_tags actually exist 392 psArray *detrendExps = raw DetrendExpSelectRowObjects(config->dbh, where, 0);392 psArray *detrendExps = rawExpSelectRowObjects(config->dbh, where, 0); 393 393 psFree(where); 394 394 if (!detrendExps) { 395 psError(PS_ERR_UNKNOWN, false, "no raw DetrendExp rows found");396 return false; 397 } 398 399 // we should have one raw DetrendExp row per exp_tag specified395 psError(PS_ERR_UNKNOWN, false, "no rawExp rows found"); 396 return false; 397 } 398 399 // we should have one rawExp row per exp_tag specified 400 400 if (psListLength(item->data.list) != psArrayLength(detrendExps)) { 401 401 psAbort(config->argv[0], 402 "an -exp_tag matched more then one raw DetrendExp (this should not happen");402 "an -exp_tag matched more then one rawExp (this should not happen"); 403 403 404 404 } … … 433 433 long det_id = psDBLastInsertID(config->dbh); 434 434 435 // create new detInputExp row(s) from the raw DetrendExp row(s)435 // create new detInputExp row(s) from the rawExp row(s) 436 436 psArray *inputExps = psArrayAllocEmpty(psArrayLength(detrendExps)); 437 437 for (long i = 0; i < psArrayLength(detrendExps); i++) { … … 803 803 } 804 804 805 // search for raw DetrendExps with the specified options806 psArray *detrendExps = raw DetrendExpSelectRowObjects(config->dbh, where, 0);805 // search for rawExps with the specified options 806 psArray *detrendExps = rawExpSelectRowObjects(config->dbh, where, 0); 807 807 psFree(where); 808 // make sure that we found at least one raw DetrendExp808 // make sure that we found at least one rawExp 809 809 if (!detrendExps) { 810 810 psError(PS_ERR_UNKNOWN, false, "database error"); … … 815 815 } 816 816 if (!psArrayLength(detrendExps)) { 817 psError(PS_ERR_UNKNOWN, true, "no raw DetrendExp rows found");817 psError(PS_ERR_UNKNOWN, true, "no rawExp rows found"); 818 818 psFree(detrendExps); 819 819 psFree(registered); … … 825 825 if (pretend) { 826 826 // negative simple so the default is true 827 if (!raw DetrendExpPrintObjects(stdout, detrendExps, !simple)) {827 if (!rawExpPrintObjects(stdout, detrendExps, !simple)) { 828 828 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 829 829 psFree(detrendExps); … … 874 874 long det_id = psDBLastInsertID(config->dbh); 875 875 876 // create new detInputExp row(s) from the raw DetrendExp row(s)876 // create new detInputExp row(s) from the rawExp row(s) 877 877 psArray *inputExps = psArrayAllocEmpty(psArrayLength(detrendExps)); 878 878 for (long i = 0; i < psArrayLength(detrendExps); i++) { … … 1208 1208 " detResidExp.accept" 1209 1209 " FROM detResidExp" 1210 " JOIN raw DetrendExp"1210 " JOIN rawExp" 1211 1211 " USING(exp_tag)" 1212 1212 " WHERE det_id = %d" … … 1214 1214 1215 1215 if (time_filter->list->n) { 1216 psString whereClause = psDBGenerateWhereConditionSQL(time_filter, "raw DetrendExp");1216 psString whereClause = psDBGenerateWhereConditionSQL(time_filter, "rawExp"); 1217 1217 psStringAppend(&query, " AND %s", whereClause); 1218 1218 psFree(whereClause); … … 1325 1325 } 1326 1326 1327 static detInputExpRow *rawDetrenTodetInputExpRow(raw DetrendExpRow *rawExp, psS32 det_id, psS32 iteration)1327 static detInputExpRow *rawDetrenTodetInputExpRow(rawExpRow *rawExp, psS32 det_id, psS32 iteration) 1328 1328 { 1329 1329 PS_ASSERT_PTR_NON_NULL(rawExp, NULL); … … 1342 1342 1343 1343 // select detInputExp.* 1344 // select raw DetrendExp.*1344 // select rawExp.* 1345 1345 // by: 1346 1346 // exp_tag … … 1349 1349 "SELECT DISTINCT *" 1350 1350 " FROM detInputExp" 1351 " JOIN raw DetrendExp"1351 " JOIN rawExp" 1352 1352 " USING(exp_tag)" 1353 1353 ); … … 1373 1373 if (!psArrayLength(output)) { 1374 1374 // XXX check psError here 1375 psError(PS_ERR_UNKNOWN, false, "no pending raw DetrendExp rows found");1375 psError(PS_ERR_UNKNOWN, false, "no pending rawExp rows found"); 1376 1376 psFree(output); 1377 1377 return true; … … 1409 1409 " detRun.det_type," 1410 1410 " rawImfile.*," 1411 " raw DetrendExp.camera"1411 " rawExp.camera" 1412 1412 " FROM rawImfile" 1413 1413 " JOIN detInputExp" 1414 1414 " USING(exp_tag) " 1415 " JOIN raw DetrendExp"1415 " JOIN rawExp" 1416 1416 " USING(exp_tag) " 1417 1417 " JOIN detRun" … … 1494 1494 " detRun.det_type," 1495 1495 " rawImfile.*," 1496 " raw DetrendExp.camera"1496 " rawExp.camera" 1497 1497 " FROM detRun" 1498 1498 " JOIN detInputExp" 1499 1499 " USING(det_id, iteration)" 1500 " JOIN raw DetrendExp"1501 " ON detInputExp.exp_tag = raw DetrendExp.exp_tag"1500 " JOIN rawExp" 1501 " ON detInputExp.exp_tag = rawExp.exp_tag" 1502 1502 " JOIN rawImfile" 1503 1503 " ON detInputExp.exp_tag = rawImfile.exp_tag" … … 1582 1582 detInputExpSelectRowObjects(config->dbh, where, 0); 1583 1583 if (!detInputExp) { 1584 psError(PS_ERR_UNKNOWN, false, "no raw DetrendExp rows found");1584 psError(PS_ERR_UNKNOWN, false, "no rawExp rows found"); 1585 1585 return NULL; 1586 1586 } … … 1789 1789 " detRun.det_type," 1790 1790 " detProcessedImfile.exp_tag," 1791 " raw DetrendExp.camera,"1791 " rawExp.camera," 1792 1792 " detProcessedImfile.class_id," 1793 " raw DetrendExp.imfiles"1793 " rawExp.imfiles" 1794 1794 " FROM detRun" 1795 1795 " JOIN detInputExp" 1796 1796 " USING(det_id, iteration)" 1797 " JOIN raw DetrendExp"1798 " ON detInputExp.exp_tag = raw DetrendExp.exp_tag"1797 " JOIN rawExp" 1798 " ON detInputExp.exp_tag = rawExp.exp_tag" 1799 1799 " JOIN rawImfile" 1800 " ON raw DetrendExp.exp_tag = rawImfile.exp_tag"1800 " ON rawExp.exp_tag = rawImfile.exp_tag" 1801 1801 " LEFT JOIN detProcessedImfile" 1802 1802 " ON detRun.det_id = detProcessedImfile.det_id" … … 1813 1813 " AND detInputExp.include = 1" 1814 1814 " GROUP BY" 1815 " raw DetrendExp.exp_tag,"1815 " rawExp.exp_tag," 1816 1816 " detRun.det_id" 1817 1817 " HAVING" 1818 " COUNT(detProcessedImfile.class_id) = raw DetrendExp.imfiles"1818 " COUNT(detProcessedImfile.class_id) = rawExp.imfiles" 1819 1819 " ) AS detProcessedExp" 1820 1820 ); … … 1850 1850 if (!psArrayLength(output)) { 1851 1851 // XXX check psError here 1852 psError(PS_ERR_UNKNOWN, false, "no pending raw DetrendExp rows found");1852 psError(PS_ERR_UNKNOWN, false, "no pending rawExp rows found"); 1853 1853 psFree(output); 1854 1854 return true; … … 1960 1960 " ON detRun.det_id = detInputExp.det_id" 1961 1961 " AND detRun.iteration = detInputExp.iteration" 1962 " JOIN raw DetrendExp"1963 " ON detInputExp.exp_tag = raw DetrendExp.exp_tag"1962 " JOIN rawExp" 1963 " ON detInputExp.exp_tag = rawExp.exp_tag" 1964 1964 " JOIN detProcessedImfile" 1965 1965 " ON detInputExp.det_id = detProcessedImfile.det_id" … … 2001 2001 if (!psArrayLength(output)) { 2002 2002 // XXX check psError here 2003 psError(PS_ERR_UNKNOWN, false, "no pending raw DetrendExp rows found");2003 psError(PS_ERR_UNKNOWN, false, "no pending rawExp rows found"); 2004 2004 return true; 2005 2005 } … … 2114 2114 " detRun.det_type," 2115 2115 " detProcessedImfile.class_id," 2116 " raw DetrendExp.camera"2116 " rawExp.camera" 2117 2117 " FROM detRun" 2118 2118 " JOIN detInputExp" 2119 2119 " ON detRun.det_id = detInputExp.det_id" 2120 2120 " AND detRun.iteration = detInputExp.iteration" 2121 " JOIN raw DetrendExp"2122 " ON detInputExp.exp_tag = raw DetrendExp.exp_tag"2121 " JOIN rawExp" 2122 " ON detInputExp.exp_tag = rawExp.exp_tag" 2123 2123 " JOIN rawImfile" 2124 2124 " ON detInputExp.exp_tag = rawImfile.exp_tag" … … 2271 2271 2272 2272 // negative simple so the default is true 2273 if (!ippdbPrintMetadatas(stdout, output, "raw DetrendImfile", !simple)) {2273 if (!ippdbPrintMetadatas(stdout, output, "rawImfile", !simple)) { 2274 2274 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 2275 2275 psFree(output); … … 2471 2471 2472 2472 // negative simple so the default is true 2473 if (!ippdbPrintMetadatas(stdout, output, "raw DetrendImfile", !simple)) {2473 if (!ippdbPrintMetadatas(stdout, output, "rawImfile", !simple)) { 2474 2474 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 2475 2475 psFree(output); … … 2517 2517 " detRun.det_type," 2518 2518 " detRun.iteration," 2519 " raw DetrendExp.camera,"2520 " raw DetrendExp.imfiles,"2519 " rawExp.camera," 2520 " rawExp.imfiles," 2521 2521 " detStackedImfile.class_id" 2522 2522 " FROM detRun" … … 2524 2524 " ON detRun.det_id = detInputExp.det_id" 2525 2525 " AND detRun.iteration = detInputExp.iteration" 2526 " JOIN raw DetrendExp"2527 " ON detInputExp.exp_tag = raw DetrendExp.exp_tag"2526 " JOIN rawExp" 2527 " ON detInputExp.exp_tag = rawExp.exp_tag" 2528 2528 " JOIN detStackedImfile" 2529 2529 " ON detInputExp.det_id = detStackedImfile.det_id" … … 2540 2540 " AND detNormalizedStatImfile.class_id IS NULL" 2541 2541 " GROUP BY" 2542 " raw DetrendExp.exp_tag,"2542 " rawExp.exp_tag," 2543 2543 " detRun.iteration," 2544 2544 " detRun.det_id" 2545 " HAVING MAX(raw DetrendExp.imfiles) = COUNT(detStackedImfile.class_id)"2545 " HAVING MAX(rawExp.imfiles) = COUNT(detStackedImfile.class_id)" 2546 2546 ") as tonormalizedstat" 2547 2547 ); … … 2734 2734 "SELECT DISTINCT" 2735 2735 " detRun.det_type," 2736 " raw DetrendExp.camera,"2736 " rawExp.camera," 2737 2737 " detStackedImfile.uri," 2738 2738 " detNormalizedStatImfile.*" … … 2742 2742 " JOIN detInputExp" 2743 2743 " USING(det_id, iteration)" 2744 " JOIN raw DetrendExp"2745 " ON detInputExp.exp_tag = raw DetrendExp.exp_tag"2744 " JOIN rawExp" 2745 " ON detInputExp.exp_tag = rawExp.exp_tag" 2746 2746 " JOIN detNormalizedStatImfile" 2747 2747 " ON detStackedImfile.det_id = detNormalizedStatImfile.det_id" … … 2805 2805 2806 2806 // negative simple so the default is true 2807 if (!ippdbPrintMetadatas(stdout, output, "raw DetrendImfile", !simple)) {2807 if (!ippdbPrintMetadatas(stdout, output, "rawImfile", !simple)) { 2808 2808 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 2809 2809 psFree(output); … … 3064 3064 " detRun.iteration," 3065 3065 " detRun.det_type," 3066 " raw DetrendExp.camera,"3067 " raw DetrendExp.telescope,"3068 " raw DetrendExp.exp_type,"3069 " raw DetrendExp.imfiles"3066 " rawExp.camera," 3067 " rawExp.telescope," 3068 " rawExp.exp_type," 3069 " rawExp.imfiles" 3070 3070 " FROM detRun" 3071 3071 " JOIN detInputExp" 3072 3072 " ON detRun.det_id = detInputExp.det_id" 3073 3073 " AND detRun.iteration = detInputExp.iteration" 3074 " JOIN raw DetrendExp"3075 " ON detInputExp.exp_tag = raw DetrendExp.exp_tag"3074 " JOIN rawExp" 3075 " ON detInputExp.exp_tag = rawExp.exp_tag" 3076 3076 " JOIN detNormalizedImfile" 3077 3077 " ON detInputExp.det_id = detNormalizedImfile.det_id" … … 3227 3227 " detRun.iteration," 3228 3228 " detRun.det_type," 3229 " raw DetrendExp.camera,"3230 " raw DetrendExp.telescope,"3231 " raw DetrendExp.exp_type,"3232 " raw DetrendExp.imfiles"3229 " rawExp.camera," 3230 " rawExp.telescope," 3231 " rawExp.exp_type," 3232 " rawExp.imfiles" 3233 3233 " FROM detRun" 3234 3234 " JOIN detInputExp" 3235 3235 " ON detRun.det_id = detInputExp.det_id" 3236 3236 " AND detRun.iteration = detInputExp.iteration" 3237 " JOIN raw DetrendExp"3238 " ON detInputExp.exp_tag = raw DetrendExp.exp_tag"3237 " JOIN rawExp" 3238 " ON detInputExp.exp_tag = rawExp.exp_tag" 3239 3239 " JOIN detNormalizedImfile" 3240 3240 " ON detInputExp.det_id = detNormalizedImfile.det_id" … … 3462 3462 " detProcessedImfile.uri,\n" 3463 3463 " detNormalizedImfile.uri AS det_uri,\n" 3464 " raw DetrendExp.camera\n"3464 " rawExp.camera\n" 3465 3465 " FROM detRun\n" 3466 3466 " JOIN detInputExp\n" 3467 3467 " USING(det_id, iteration)\n" 3468 " JOIN raw DetrendExp\n"3469 " ON detInputExp.exp_tag = raw DetrendExp.exp_tag\n"3468 " JOIN rawExp\n" 3469 " ON detInputExp.exp_tag = rawExp.exp_tag\n" 3470 3470 " JOIN detProcessedImfile\n" 3471 3471 " ON detRun.det_id = detProcessedImfile.det_id\n" … … 3497 3497 " rawImfile.uri,\n" 3498 3498 " 'NULL' AS det_uri,\n" 3499 " raw DetrendExp.camera\n"3499 " rawExp.camera\n" 3500 3500 " FROM detRun\n" 3501 3501 " JOIN detInputExp\n" 3502 3502 " USING(det_id, iteration)\n" 3503 " JOIN raw DetrendExp\n"3504 " ON detInputExp.exp_tag = raw DetrendExp.exp_tag\n"3503 " JOIN rawExp\n" 3504 " ON detInputExp.exp_tag = rawExp.exp_tag\n" 3505 3505 " JOIN rawImfile\n" 3506 3506 " ON detInputExp.exp_tag = rawImfile.exp_tag\n" … … 3689 3689 " JOIN detInputExp\n" 3690 3690 " USING(det_id, iteration)\n" 3691 " JOIN raw DetrendExp\n"3692 " ON detInputExp.exp_tag = raw DetrendExp.exp_tag\n"3691 " JOIN rawExp\n" 3692 " ON detInputExp.exp_tag = rawExp.exp_tag\n" 3693 3693 " JOIN rawImfile\n" 3694 3694 " ON detInputExp.exp_tag = rawImfile.exp_tag\n" … … 4047 4047 " detInputExp.exp_tag,\n" 4048 4048 " detInputExp.include,\n" 4049 " raw DetrendExp.imfiles,\n"4050 " raw DetrendExp.camera,\n"4049 " rawExp.imfiles,\n" 4050 " rawExp.camera,\n" 4051 4051 " detResidImfile.class_id\n" 4052 4052 " FROM detRun\n" 4053 4053 " JOIN detInputExp\n" 4054 4054 " USING(det_id, iteration)\n" 4055 " JOIN raw DetrendExp\n"4056 " ON detInputExp.exp_tag = raw DetrendExp.exp_tag\n"4055 " JOIN rawExp\n" 4056 " ON detInputExp.exp_tag = rawExp.exp_tag\n" 4057 4057 " JOIN detResidImfile\n" 4058 4058 " ON detRun.det_id = detResidImfile.det_id\n" … … 4073 4073 " detRun.det_id\n" 4074 4074 " HAVING\n" 4075 " raw DetrendExp.imfiles = COUNT(detResidImfile.class_id)\n"4075 " rawExp.imfiles = COUNT(detResidImfile.class_id)\n" 4076 4076 " ) AS toresidexp\n" 4077 4077 ); … … 4171 4171 " detInputExp.exp_tag," 4172 4172 " detInputExp.include," 4173 " raw DetrendExp.imfiles"4173 " rawExp.imfiles" 4174 4174 " FROM detRun" 4175 4175 " JOIN detInputExp" 4176 4176 " USING(det_id, iteration)" 4177 " JOIN raw DetrendExp"4178 " ON detInputExp.exp_tag = raw DetrendExp.exp_tag"4177 " JOIN rawExp" 4178 " ON detInputExp.exp_tag = rawExp.exp_tag" 4179 4179 " JOIN detResidImfile" 4180 4180 " ON detRun.det_id = detResidImfile.det_id" … … 4195 4195 " detRun.det_id" 4196 4196 " HAVING" 4197 " raw DetrendExp.imfiles = COUNT(detResidImfile.class_id)"4197 " rawExp.imfiles = COUNT(detResidImfile.class_id)" 4198 4198 " ) AS toresidexp" 4199 4199 ); … … 4528 4528 " detRun.mode,\n" 4529 4529 " detInputExp.exp_tag,\n" 4530 " raw DetrendExp.camera\n"4530 " rawExp.camera\n" 4531 4531 " FROM detRun\n" 4532 4532 " JOIN detInputExp\n" 4533 4533 " USING(det_id, iteration)\n" 4534 " JOIN raw DetrendExp\n"4535 " ON detInputExp.exp_tag = raw DetrendExp.exp_tag\n"4534 " JOIN rawExp\n" 4535 " ON detInputExp.exp_tag = rawExp.exp_tag\n" 4536 4536 " LEFT JOIN detResidExp\n" 4537 4537 " ON detRun.det_id = detResidExp.det_id\n" … … 4802 4802 " ON detRun.det_id = detInputExp.det_id\n" 4803 4803 " AND detRun.iteration = detInputExp.iteration\n" 4804 " LEFT JOIN raw DetrendExp\n"4805 " ON detInputExp.exp_tag = raw DetrendExp.exp_tag\n"4804 " LEFT JOIN rawExp\n" 4805 " ON detInputExp.exp_tag = rawExp.exp_tag\n" 4806 4806 " LEFT JOIN detResidExp\n" 4807 4807 " ON detRun.det_id = detResidExp.det_id\n" … … 5305 5305 psFree(where); 5306 5306 if (!detrendExps) { 5307 psError(PS_ERR_UNKNOWN, false, "no raw DetrendExp rows found");5307 psError(PS_ERR_UNKNOWN, false, "no rawExp rows found"); 5308 5308 psFree(where); 5309 5309 return false;
Note:
See TracChangeset
for help on using the changeset viewer.
