Changeset 35154 for trunk/ippTools
- Timestamp:
- Feb 12, 2013, 4:24:02 PM (13 years ago)
- Location:
- trunk/ippTools
- Files:
-
- 8 edited
-
share/bgtool_chipinputs.sql (modified) (1 diff)
-
share/bgtool_definechip.sql (modified) (1 diff)
-
share/bgtool_definewarp.sql (modified) (1 diff)
-
share/bgtool_tochip.sql (modified) (1 diff)
-
share/bgtool_warp.sql (modified) (1 diff)
-
share/bgtool_warpinputs.sql (modified) (1 diff)
-
src/bgtool.c (modified) (19 diffs)
-
src/bgtoolConfig.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/share/bgtool_chipinputs.sql
r28486 r35154 1 1 SELECT 2 chipProcessedImfile.* 2 chipProcessedImfile.*, 3 camProcessedExp.path_base AS cam_path_base 3 4 FROM chipBackgroundRun 4 5 JOIN chipRun USING(chip_id) 5 6 JOIN chipProcessedImfile USING(chip_id) 7 LEFT JOIN camProcessedExp ON chipBackgroundRun.cam_id = camProcessedExp.cam_id 6 8 WHERE chipRun.state = 'full' 7 9 AND chipProcessedImfile.fault = 0 -
trunk/ippTools/share/bgtool_definechip.sql
r35119 r35154 1 1 SELECT 2 chipRun.* 2 chipRun.*, 3 camRun.cam_id, 4 chip_bg_id, 5 CURRENT_TIMESTAMP AS registered 3 6 FROM chipRun 4 7 JOIN rawExp USING(exp_id) 5 LEFT JOIN chipBackgroundRun USING(chip_id) 6 WHERE chipRun.state = 'full' 8 JOIN chipRun as altChipRun USING(exp_id) 9 JOIN camRun ON altChipRun.chip_id = camRun.chip_id 10 JOIN camProcessedExp USING(cam_id) 11 LEFT JOIN chipBackgroundRun ON chipBackgroundRun.chip_id = chipRun.chip_id -- labelHook %s 12 WHERE chipRun.state = 'full' AND camRun.state ='full' AND camProcessedExp.quality = 0 -
trunk/ippTools/share/bgtool_definewarp.sql
r28551 r35154 1 1 SELECT 2 warpRun.*, 3 chipBackgroundRun.chip_bg_id 2 warpRun.warp_id, 3 chipBackgroundRun.* 4 -- the following items are selected for aid in debugging 5 , 6 warpsChipRun.chip_id as warpschip_id, 7 chipRun.chip_id AS thischip_id, 8 warpBackgroundRun.warp_bg_id 4 9 FROM warpRun 5 10 JOIN fakeRun USING(fake_id) 6 11 JOIN camRun USING(cam_id) 7 JOIN chipRun USING(chip_id) 8 JOIN chipBackgroundRun USING(chip_id) 12 JOIN chipRun as warpsChipRun ON camRun.chip_id = warpsChipRun.chip_id 9 13 JOIN rawExp USING(exp_id) 10 LEFT JOIN warpBackgroundRun USING(chip_bg_id) 14 JOIN chipRun USING(exp_id) 15 JOIN chipBackgroundRun ON chipRun.chip_id = chipBackgroundRun.chip_id 16 AND (chipBackgroundRun.cam_id = camRun.cam_id OR chipBackgroundRun.cam_id = 0) 17 LEFT JOIN warpBackgroundRun ON chipBackgroundRun.chip_bg_id = warpBackgroundRun.warp_bg_id -- label hook %s 11 18 WHERE chipBackgroundRun.state = 'full' 12 AND warpRun.state IN ('full', 'cleaned', 'goto_cleaned') -- only need it to have been completed19 AND warpRun.state IN ('full', 'cleaned', 'goto_cleaned') -- need warp to have completed so warpSkyCellMap is populated -
trunk/ippTools/share/bgtool_tochip.sql
r28486 r35154 16 16 AND (Label.active OR Label.active IS NULL) 17 17 -- WHERE hook %s 18 ORDER BY priority DESC, chip_bg_id 18 ORDER BY priority DESC, chip_bg_id, class_id -
trunk/ippTools/share/bgtool_warp.sql
r35134 r35154 4 4 warpBackgroundRun.workdir, 5 5 warpBackgroundRun.label, 6 warpBackgroundRun.alt_cam_label,7 6 rawExp.exp_id, 8 7 rawExp.exp_name, -
trunk/ippTools/share/bgtool_warpinputs.sql
r28747 r35154 11 11 JOIN chipBackgroundImfile USING(chip_bg_id, class_id) 12 12 JOIN fakeRun USING(fake_id) 13 JOIN camProcessedExp USING(cam_id)13 JOIN camProcessedExp ON camProcessedExp.cam_id = fakeRun.cam_id 14 14 WHERE warpRun.state IN ('full', 'cleaned', 'goto_cleaned') -- only need it to have been completed 15 15 AND warpSkyfile.fault = 0 -
trunk/ippTools/src/bgtool.c
r35134 r35154 285 285 psMetadata *where = psMetadataAlloc(); 286 286 PXOPT_COPY_S64(config->args, where, "-chip_id", "chipRun.chip_id", "=="); 287 PXOPT_COPY_S64(config->args, where, "-cam_id", "camRun.cam_id", "=="); 287 288 PXOPT_COPY_S64(config->args, where, "-exp_id", "rawExp.exp_id", "=="); 288 289 PXOPT_COPY_STR(config->args, where, "-exp_name", "rawExp.exp_name", "=="); … … 324 325 PXOPT_COPY_F32(config->args, where, "-sun_angle_min", "rawExp.sun_angle", ">="); 325 326 PXOPT_COPY_F32(config->args, where, "-sun_angle_max", "rawExp.sun_angle", "<"); 326 pxAddLabelSearchArgs(config, where, "-label", "chipRun.label", "=="); 327 PXOPT_COPY_STR(config->args, where, "-label", "chipRun.label", "=="); 328 PXOPT_COPY_STR(config->args, where, "-cam_label", "camRun.label", "=="); 327 329 328 330 if (!psListLength(where->list)) { … … 343 345 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 344 346 PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false); 347 PXOPT_LOOKUP_STR(cam_label, config->args, "-cam_label", false, false); 348 PXOPT_LOOKUP_S64(cam_id, config->args, "-cam_id", false, false); 349 if (!cam_id && !cam_label) { 350 psError(PXTOOLS_ERR_CONFIG, true, "either cam_id or cam_label is required"); 351 return false; 352 } 345 353 346 354 // Get chip runs to promote to chipBackgroundRun … … 364 372 } 365 373 374 psString labelHook = psStringCopy(""); 366 375 if (!rerun) { 367 psStringAppend(&query, "\nAND chipBackgroundRun.chip_bg_id IS NULL");368 376 if (label) { 369 psStringAppend(&query, 370 "\nAND (chipBackgroundRun.label = '%s'" 371 " OR chipBackgroundRun.label IS NULL)", 372 label); 373 } 374 if (data_group) { 375 psStringAppend(&query, 376 "\nAND (chipBackgroundRun.data_group = '%s'" 377 " OR chipBackgroundRun.data_group IS NULL)", 378 data_group); 379 } 380 if (dist_group) { 381 psStringAppend(&query, 382 "\nAND (chipBackgroundRun.dist_group = '%s'" 383 " OR chipBackgroundRun.dist_group IS NULL)", 384 dist_group); 385 } 377 // check for run with the newly specified label 378 psStringAppend(&labelHook, "\nAND (chipBackgroundRun.label = '%s')", label); 379 } 380 psStringAppend(&query, "\nAND chip_bg_id IS NULL"); 386 381 } 387 382 … … 391 386 } 392 387 393 if (!p_psDBRunQuery (config->dbh, query)) {388 if (!p_psDBRunQueryF(config->dbh, query, labelHook)) { 394 389 psError(psErrorCodeLast(), false, "database error"); 395 390 psFree(query); 391 psFree(labelHook); 396 392 if (!psDBRollback(config->dbh)) { 397 393 psError(psErrorCodeLast(), false, "database error"); … … 400 396 } 401 397 psFree(query); 398 psFree(labelHook); 402 399 403 400 psArray *output = p_psDBFetchResult(config->dbh); // Matching rows … … 420 417 if (pretend) { 421 418 // negative simple so the default is true 422 if (!ippdbPrintMetadatas(stdout, output, "chip Run", !simple)) {419 if (!ippdbPrintMetadatas(stdout, output, "chipBackgroundRun", !simple)) { 423 420 psError(psErrorCodeLast(), false, "failed to print array"); 424 421 psFree(output); … … 435 432 psMetadata *md = output->data[i]; 436 433 437 chip RunRow *row = chipRunObjectFromMetadata(md);434 chipBackgroundRunRow *row = chipBackgroundRunObjectFromMetadata(md); 438 435 if (!row) { 439 436 psError(psErrorCodeLast(), false, "failed to convert metadata into fakeRun"); … … 445 442 } 446 443 447 if (!chipBackgroundRunInsert(config->dbh, 0, row->chip_id, "new",444 if (!chipBackgroundRunInsert(config->dbh, 0, row->chip_id, row->cam_id, "new", 448 445 workdir ? workdir : row->workdir, 449 446 label ? label : row->label, … … 560 557 561 558 if (psArrayLength(output)) { 562 if (!ippdbPrintMetadatas(stdout, output, " chipBackgroundRun", !simple)) {559 if (!ippdbPrintMetadatas(stdout, output, "pendingchipBackgroundRun", !simple)) { 563 560 psError(psErrorCodeLast(), false, "failed to print array"); 564 561 psFree(output); … … 621 618 return true; 622 619 } 623 if (!ippdbPrintMetadatas(stdout, output, " chipBackgroundImfile", !simple)) {620 if (!ippdbPrintMetadatas(stdout, output, "pendingchipBackgroundImfile", !simple)) { 624 621 psError(psErrorCodeLast(), false, "failed to print array"); 625 622 psFree(output); … … 1295 1292 PXOPT_COPY_F32(config->args, where, "-sun_angle_max", "rawExp.sun_angle", "<"); 1296 1293 pxAddLabelSearchArgs(config, where, "-warp_label", "warpRun.label", "=="); 1297 pxAddLabelSearchArgs(config, where, "-chip_label", "chipBackgroundRun.label", "=="); 1294 pxAddLabelSearchArgs(config, where, "-chip_bg_label", "chipBackgroundRun.label", "=="); 1295 pxAddLabelSearchArgs(config, where, "-chip_label", "chipRun.label", "=="); 1298 1296 1299 1297 if (!psListLength(where->list) && !psMetadataLookupBool(NULL, config->args, "-all")) { … … 1310 1308 PXOPT_LOOKUP_STR(dist_group, config->args, "-set_dist_group", false, false); 1311 1309 PXOPT_LOOKUP_STR(reduction, config->args, "-set_reduction", false, false); 1312 PXOPT_LOOKUP_STR(alt_cam_label, config->args, "-set_alt_cam_label", false, false);1313 1310 PXOPT_LOOKUP_STR(note, config->args, "-set_note", false, false); 1314 1311 PXOPT_LOOKUP_TIME(registered, config->args, "-registered", false, false); … … 1336 1333 } 1337 1334 1335 psString labelHook = psStringCopy(""); 1338 1336 if (!rerun) { 1339 psStringAppend(&query, "\nAND warpBackgroundRun.warp_bg_id IS NULL");1340 1337 if (label) { 1341 psStringAppend(&query, 1342 "\nAND (warpBackgroundRun.label = '%s'" 1343 " OR warpBackgroundRun.label IS NULL)", 1344 label); 1345 } 1346 if (data_group) { 1347 psStringAppend(&query, 1348 "\nAND (warpBackgroundRun.data_group = '%s'" 1349 " OR warpBackgroundRun.data_group IS NULL)", 1350 data_group); 1351 } 1352 if (dist_group) { 1353 psStringAppend(&query, 1354 "\nAND (warpBackgroundRun.dist_group = '%s'" 1355 " OR warpBackgroundRun.dist_group IS NULL)", 1356 dist_group); 1357 } 1338 // check for run with the newly specified label 1339 psStringAppend(&labelHook, "\nAND (warpBackgroundRun.label = '%s')", label); 1340 } 1341 psStringAppend(&query, "\nAND warp_bg_id IS NULL"); 1358 1342 } 1359 1343 … … 1363 1347 } 1364 1348 1365 if (!p_psDBRunQuery(config->dbh, query)) { 1366 psError(psErrorCodeLast(), false, "database error"); 1349 if (!p_psDBRunQueryF(config->dbh, query, labelHook)) { 1350 psError(psErrorCodeLast(), false, "database error"); 1351 psFree(labelHook); 1367 1352 psFree(query); 1368 1353 if (!psDBRollback(config->dbh)) { … … 1371 1356 return false; 1372 1357 } 1358 psFree(labelHook); 1373 1359 psFree(query); 1374 1360 … … 1392 1378 if (pretend) { 1393 1379 // negative simple so the default is true 1394 if (!ippdbPrintMetadatas(stdout, output, "warp Run", !simple)) {1380 if (!ippdbPrintMetadatas(stdout, output, "warpBackgroundRun", !simple)) { 1395 1381 psError(psErrorCodeLast(), false, "failed to print array"); 1396 1382 psFree(output); … … 1409 1395 psS64 chip_bg_id = psMetadataLookupS64(NULL, md, "chip_bg_id"); 1410 1396 1411 warpRunRow *row = warpRunObjectFromMetadata(md); 1397 1398 warpBackgroundRunRow *row = warpBackgroundRunObjectFromMetadata(md); 1412 1399 if (!row) { 1413 psError(psErrorCodeLast(), false, "failed to convert metadata into fakeRun");1400 psError(psErrorCodeLast(), false, "failed to convert metadata into warpRun"); 1414 1401 psFree(output); 1415 1402 if (!psDBRollback(config->dbh)) { … … 1425 1412 dist_group ? dist_group : row->dist_group, 1426 1413 reduction ? reduction : row->reduction, 1427 alt_cam_label,1428 1414 note ? note : row->note, 1429 1415 NULL, 0)) { -
trunk/ippTools/src/bgtoolConfig.c
r35134 r35154 50 50 psMetadata *definechipArgs = psMetadataAlloc(); 51 51 psMetadataAddS64(definechipArgs, PS_LIST_TAIL, "-chip_id", 0, "search by chip_id", 0); 52 psMetadataAddS64(definechipArgs, PS_LIST_TAIL, "-cam_id", 0, "choose cam_id", 0); 52 53 psMetadataAddS64(definechipArgs, PS_LIST_TAIL, "-exp_id", 0, "search by exp_id", 0); 53 54 psMetadataAddStr(definechipArgs, PS_LIST_TAIL, "-exp_name", 0, "search by exp_name", NULL); … … 89 90 psMetadataAddF32(definechipArgs, PS_LIST_TAIL, "-sun_angle_min", 0, "search by min solar angle", NAN); 90 91 psMetadataAddF32(definechipArgs, PS_LIST_TAIL, "-sun_angle_max", 0, "search by max solar angle", NAN); 91 psMetadataAddStr(definechipArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search on chipRun label", NULL); 92 psMetadataAddStr(definechipArgs, PS_LIST_TAIL, "-label", 0, "search on chipRun label", NULL); 93 psMetadataAddStr(definechipArgs, PS_LIST_TAIL, "-cam_label", 0, "search on camRun label", NULL); 92 94 psMetadataAddBool(definechipArgs, PS_LIST_TAIL, "-destreaked", 0, "search for runs that have been destreaked", false); 93 95 psMetadataAddBool(definechipArgs, PS_LIST_TAIL, "-rerun", 0, "re-run data?", false); … … 279 281 psMetadataAddF32(definewarpArgs, PS_LIST_TAIL, "-sun_angle_max", 0, "search by max solar angle", NAN); 280 282 psMetadataAddStr(definewarpArgs, PS_LIST_TAIL, "-warp_label", PS_META_DUPLICATE_OK, "search on warpRun label", NULL); 281 psMetadataAddStr(definewarpArgs, PS_LIST_TAIL, "-chip_label", PS_META_DUPLICATE_OK, "search on chipBackgroundRun label", NULL); 283 psMetadataAddStr(definewarpArgs, PS_LIST_TAIL, "-chip_label", PS_META_DUPLICATE_OK, "search on chipRun label", NULL); 284 psMetadataAddStr(definewarpArgs, PS_LIST_TAIL, "-chip_bg_label", PS_META_DUPLICATE_OK, "search on chipBackgroundRun label", NULL); 282 285 psMetadataAddBool(definewarpArgs, PS_LIST_TAIL, "-destreaked", 0, "search for runs that have been destreaked", false); 283 286 psMetadataAddBool(definewarpArgs, PS_LIST_TAIL, "-rerun", 0, "rerun data?", false); … … 285 288 psMetadataAddStr(definewarpArgs, PS_LIST_TAIL, "-set_label", 0, "define label", NULL); 286 289 psMetadataAddStr(definewarpArgs, PS_LIST_TAIL, "-set_reduction", 0, "define reduction class", NULL); 287 psMetadataAddStr(definewarpArgs, PS_LIST_TAIL, "-set_alt_cam_label", 0, "define alternate astrometry sources", NULL);288 290 psMetadataAddStr(definewarpArgs, PS_LIST_TAIL, "-set_data_group", 0, "define data group", NULL); 289 291 psMetadataAddStr(definewarpArgs, PS_LIST_TAIL, "-set_dist_group", 0, "define dist group", NULL);
Note:
See TracChangeset
for help on using the changeset viewer.
