Changeset 31428
- Timestamp:
- May 3, 2011, 2:25:17 PM (15 years ago)
- Location:
- branches/czw_branch/20110406
- Files:
-
- 9 edited
-
ippScripts/scripts/lap_science.pl (modified) (25 diffs)
-
ippTools/share/laptool_definerun.sql (modified) (1 diff)
-
ippTools/share/laptool_exposures.sql (modified) (4 diffs)
-
ippTools/share/laptool_pendingexp.sql (modified) (1 diff)
-
ippTools/share/laptool_stacks.sql (modified) (2 diffs)
-
ippTools/share/stacktool_sassskyfile.sql (modified) (1 diff)
-
ippTools/src/difftool.c (modified) (1 diff)
-
ippTools/src/difftoolConfig.c (modified) (1 diff)
-
ippTools/src/laptool.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20110406/ippScripts/scripts/lap_science.pl
r31417 r31428 96 96 sub chip_mode { 97 97 my $lap_id = shift; 98 return(queue_chips($lap_id)); 99 } 100 101 # This creates the chiptool command to use for the specified parameters. 102 sub construct_chiptool_command { 103 my $lap_id = shift; 104 my $label = shift; 105 my $tess_id = shift; 106 my $projection_cell = shift; 107 my $data_group = shift; 108 my $workdir = shift; 109 my $exp_id = shift; 110 111 my $cmd = "$chiptool -pretend"; 112 $cmd .= " -pretend " if defined $debug; 113 $cmd .= " -dbname $dbname " if defined $dbname; 114 115 $cmd .= " -definebyquery -exp_id $exp_id -set_end_stage warp -set_tess_id $tess_id "; 116 $cmd .= " -set_label $label -set_workdir $workdir -set_dist_group $label -set_data_group $data_group "; 117 118 return($cmd); 98 my $status = queue_chips($lap_id); 99 100 if ($status) { 101 my $command = "$laptool -updaterun -lap_id $lap_id"; 102 $command .= " -dbname $dbname " if defined $dbname; 103 $command .= " -set_state run "; 104 my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 105 run(command => $command, verbose => $verbose); 106 unless ($success) { 107 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 108 &my_die("Unable to perform laptool: $error_code", $lap_id); 109 } 110 } 111 return($status); 119 112 } 120 113 … … 181 174 my $data_group = "${label}.${date}"; 182 175 183 my $chip_cmd = construct_chiptool_command($exposure->{lap_id},$exposure->{label}, 184 $exposure->{tess_id},$exposure->{proj_cell}, 185 $workdir, $data_group, 186 $exposure->{exp_id}); 176 177 my $chip_cmd = "$chiptool"; 178 $chip_cmd .= " -pretend " if defined $debug; 179 $chip_cmd .= " -dbname $dbname " if defined $dbname; 180 $chip_cmd .= " -definebyquery -exp_id $exposure->{exp_id} -set_end_stage warp -set_tess_id $exposure->{tess_id} "; 181 $chip_cmd .= " -set_label $exposure->{label} -set_data_group $data_group "; 182 $chip_cmd .= " -set_workdir $workdir -set_dist_group $exposure->{dist_group} "; 183 187 184 my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 188 185 run(command => $chip_cmd, verbose => $verbose); … … 242 239 &my_die("Exposure $exp_id for $lap_id is declared pairwise without a defined pair", $lap_id); 243 240 } 241 $matching{$object}{$comment} = $exp_id; 242 $indexing{$exp_id} = $counter; 244 243 $counter++; 245 244 next; … … 276 275 277 276 $exp_A->{pairwise} = 1; 277 $exp_A->{private} = 0; 278 278 $exp_A->{pair_id} = $exp_B->{chip_id}; 279 279 280 280 $exp_B->{pairwise} = 1; 281 $exp_B->{private} = 0; 281 282 $exp_B->{pair_id} = $exp_A->{chip_id}; 283 284 if ($verbose) { 285 print "LAP_DIFFS: $object: $exp_A->{exp_id} and $exp_B->{exp_id} are a pair\n"; 286 } 282 287 } 283 288 } … … 294 299 $exposure = update_this_exposure($exposure); 295 300 } 301 return(1); 296 302 } 297 303 … … 300 306 # Decide Things 301 307 ################################################################################ 308 sub monitor_mode { 309 my $lap_id = shift; 310 return(check_status($lap_id)); 311 } 312 302 313 303 314 sub check_stack_status { # look at lapRun associated stacks, and confirm their states. … … 330 341 my $complete_fstacks = 0; 331 342 foreach my $stack (@$stacks) { 332 if ($stack->{quick_stack_id}) { 343 if (($stack->{quick_stack_id})&& 344 (S64_IS_NOT_NULL($stack->{quick_stack_id}))) { 333 345 $defined_qstack = 1; 334 346 $total_qstacks++; 335 347 } 336 if ($stack->{final_stack_id}) { 348 if (($stack->{final_stack_id})&& 349 (S64_IS_NOT_NULL($stack->{final_stack_id}))) { 337 350 $defined_fstack = 1; 338 351 $total_fstacks++; 339 352 } 340 353 341 if ($stack->{quick_state} eq 'full') { 354 if (($stack->{quick_state})&& 355 ($stack->{quick_state} eq 'full')) { 342 356 $complete_qstacks++; 343 357 } 344 if ($stack->{final_state} eq 'full') { 358 if (($stack->{final_state})&& 359 ($stack->{final_state} eq 'full')) { 345 360 $complete_fstacks++; 346 361 } 347 362 } 348 if ($complete_qstacks == $total_qstacks) { 363 if (($complete_qstacks > 0)&& 364 ($complete_qstacks == $total_qstacks)) { 349 365 $have_qstack = 1; 350 366 } 351 if ($complete_fstacks == $total_fstacks) { 367 if (($complete_fstacks > 0)&& 368 ($complete_fstacks == $total_fstacks)) { 352 369 $have_fstack = 1; 353 370 } 371 354 372 355 373 return($defined_qstack,$have_qstack,$defined_fstack,$have_fstack); 356 374 } 357 375 sub check_status { 358 my $proj_cell = shift; 359 my $lap_id = get_lap_id($proj_cell); 376 my $lap_id = shift; 360 377 361 378 my ($defined_qstack,$have_qstack,$defined_fstack,$have_fstack) = check_stack_status($lap_id); … … 368 385 unless ($success) { 369 386 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 370 &my_die("Unable to perform laptool: $error_code", $lap_id , $proj_cell);387 &my_die("Unable to perform laptool: $error_code", $lap_id); 371 388 } 372 389 … … 377 394 378 395 my $exposures = $mdcParser->parse_list(join "", @$stdout_buf) or 379 &my_die("Unable to parse metadata from laptool", $lap_id , $proj_cell);396 &my_die("Unable to parse metadata from laptool", $lap_id); 380 397 381 398 # Need to prescan to see who matches whom. … … 394 411 my $needs_something_private = 0; 395 412 my $can_qstack = 0; 413 my $have_diff = 0; 396 414 my $can_diff = 0; 397 415 my $can_fstack = 0; … … 423 441 } 424 442 } 425 if (($exposure->{warpRun_state} eq 'full')|| # This exposure's warp is either done or impossible. 426 ($exposure->{data_state} eq 'drop')) { 443 if (($exposure->{warpRun_state})&& # This exposure has a warp 444 (($exposure->{warpRun_state} eq 'full')|| # This exposure's warp is either done or impossible. 445 ($exposure->{data_state} eq 'drop'))) { 427 446 $can_qstack ++; 428 447 $can_diff ++; 429 448 } 430 if (($exposure->{magicked})|| # This exposure has been magicked, so it is through with diff. 449 if (($exposure->{magicked}&& 450 &S64_IS_NOT_NULL($exposure->{magicked}))|| # This exposure has been magicked, so it is through with diff. 431 451 ($exposure->{data_state} eq 'drop')) { 432 452 $can_fstack ++; 433 453 } 434 } 435 454 if (($exposure->{diff_id})&&(&S64_IS_NOT_NULL($exposure->{diff_id}))) { 455 $have_diff ++; 456 } 457 } 458 459 460 print "STATUS: DEFINED_QSTACK: $defined_qstack\n"; 461 print "STATUS: HAVE_QSTACK: $have_qstack\n"; 462 print "STATUS: DEFINED_FSTACK: $defined_fstack\n"; 463 print "STATUS: HAVE_FSTACK: $have_fstack\n"; 464 465 print "STATUS: NEEDS_QSTACK: $needs_qstack\n"; 466 print "STATUS: NEEDS_REMADE: $needs_something_remade\n"; 467 print "STATUS: NEEDS PRIVATIZE: $needs_something_private\n"; 468 print "STATUS: CAN_QSTACK: $can_qstack\n"; 469 print "STATUS: CAN_DIFF: $can_diff\n"; 470 print "STATUS: HAVE_DIFF: $have_diff\n"; 471 print "STATUS: CAN_FSTACK: $can_fstack\n"; 472 473 print "STATUS: TOTAL_EXPOSURES: $total_exposures\n"; 474 436 475 if (($needs_qstack == 1)&& # Do we need the quick stack? 437 476 ($defined_qstack == 0)&& # Have we not made it already? … … 439 478 ($needs_something_remade == 0) # Do we need to wait for a stolen exposure? 440 479 ) { 480 print "STATUS: Will now queue quickstacks\n"; 441 481 &queue_quickstack($exposures); 442 482 } … … 444 484 if (($can_diff == $total_exposures)&& # Are all warps done? 445 485 ($needs_something_remade == 0)&& # Do we need to wait for a stolen exposure? 486 ($have_diff < $can_diff)&& # We haven't already done them all. 446 487 (($needs_qstack == 0)|| # Are we just doing pairwise diffs? 447 488 ($needs_qstack == 1)&&($have_qstack == 1)) ) { # If we need a quickstack, do we have it? 489 print "STATUS: Will now queue diffs\n"; 448 490 &queue_diffs($exposures); 449 491 } … … 452 494 ($needs_something_remade == 0)&& # Do we need to wait for a stolen exposure? 453 495 ($defined_fstack == 0)) { # Have we not made it already? 496 print "STATUS: Will now queue final stacks\n"; 454 497 &queue_finalstack($exposures); 455 498 } 456 499 457 500 if (($have_fstack == 1)) { # Are we all done making the final product? 501 print "STATUS: Will now deactivate exposures for this complete lapRun.\n"; 458 502 &deactivate_exposures($exposures); 459 503 $command = "$laptool -updaterun -lap_id $lap_id"; … … 464 508 unless ($success) { 465 509 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 466 &my_die("Unable to perform laptool: $error_code", $lap_id, $proj_cell); 467 } 468 } 510 &my_die("Unable to perform laptool: $error_code", $lap_id); 511 } 512 } 513 469 514 } 470 515 471 516 sub queue_quickstack { 472 my $lap_id = shift; 473 my $label = shift; 474 my $filter = shift; 475 my $proj_cell = shift; 517 my $exposures = shift; # reference to exposure array; 518 my $exposure = ${ $exposures }[0]; # reference to the first exposure to get run level information 519 520 my $lap_id = $exposure->{lap_id}; 521 my $label = $exposure->{label}; 522 my $filter = $exposure->{filter}; 523 my $proj_cell = $exposure->{projection_cell}; 524 525 unless (defined($label) && defined($filter) && defined($proj_cell)) { 526 &my_die("Unable to perform stacktool. Insufficient information.", $lap_id); 527 } 476 528 477 529 my @utctime = gmtime(); … … 483 535 my $data_group = "${label}.${date}"; 484 536 485 my $command = "$stacktool ";537 my $command = "$stacktool -pretend"; 486 538 $command .= " -dbname $dbname " if defined $dbname; 487 539 $command .= " -definebyquery -select_label $label -select_skycell_id ${proj_cell}.% -select_filter $filter "; 488 $command .= " -set_label ${label}.quick -set_workdir $workdir -set_data_group ${proj_cell}.quick.${date} "; 540 $command .= " -set_label ${label}.quick -set_data_group ${proj_cell}.quick.${date} "; 541 $command .= " -set_workdir $workdir -set_dist_group NODIST "; 489 542 $command .= " -min_num 2 -set_reduction QUICKSTACK "; 490 543 491 544 my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 545 run(command => $command, verbose => $verbose); 546 unless ($success) { 547 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 548 &my_die("Unable to perform chiptool: $error_code", $lap_id); 549 } 550 551 $command = "$stacktool "; 552 $command .= " -dbname $dbname " if defined $dbname; 553 $command .= " -sassskyfile -data_group ${proj_cell}.quick.${date} "; 554 $command .= " -filter $filter -projection_cell ${proj_cell} "; 555 556 ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 492 557 run(command => $command, verbose => $verbose); 493 558 unless ($success) { … … 501 566 my $stack = ${ $stacks }[0]; 502 567 my $sass_id = $stack->{sass_id}; 503 568 unless (defined($sass_id)) { 569 &my_die("Unable to parse metadata from laptool", $lap_id, ""); 570 } 504 571 $command = "$laptool -updaterun -lap_id $lap_id -set_quick_sass_id $sass_id"; 505 572 $command .= " -dbname $dbname " if defined $dbname; … … 515 582 } 516 583 sub queue_finalstack { 517 my $lap_id = shift; 518 my $label = shift; 519 my $filter = shift; 520 my $proj_cell = shift; 584 my $exposures = shift; # reference to exposure array; 585 my $exposure = ${ $exposures }[0]; # reference to the first exposure to get run level information 586 587 my $lap_id = $exposure->{lap_id}; 588 my $label = $exposure->{label}; 589 my $filter = $exposure->{filter}; 590 my $proj_cell = $exposure->{projection_cell}; 591 592 unless (defined($label) && defined($filter) && defined($proj_cell)) { 593 &my_die("Unable to perform stacktool. Insufficient information.", $lap_id); 594 } 521 595 522 596 my @utctime = gmtime(); … … 529 603 530 604 my $command = "$stacktool "; 605 $command .= " -pretend " if defined $debug; 531 606 $command .= " -dbname $dbname " if defined $dbname; 532 607 $command .= " -definebyquery -select_label $label -select_skycell_id ${proj_cell}.% -select_filter $filter "; … … 541 616 } 542 617 618 619 $command = "$stacktool "; 620 $command .= " -dbname $dbname " if defined $dbname; 621 $command .= " -sassskyfile -data_group ${proj_cell}.final.${date} "; 622 $command .= " -filter $filter -projection_cell ${proj_cell} "; 623 624 ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 625 run(command => $command, verbose => $verbose); 626 unless ($success) { 627 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 628 &my_die("Unable to perform chiptool: $error_code", $lap_id); 629 } 630 543 631 my $stacks = $mdcParser->parse_list(join "", @$stdout_buf) or 544 632 &my_die("Unable to parse metadata from laptool", $lap_id, ""); 545 633 546 634 my $stack = ${ $stacks }[0]; 547 635 my $sass_id = $stack->{sass_id}; 548 636 unless (defined($sass_id)) { 637 &my_die("Unable to parse metadata from laptool", $lap_id, ""); 638 } 639 print "FINAL_SASS_ID: $sass_id\n"; 549 640 $command = "$laptool -updaterun -lap_id $lap_id -set_final_sass_id $sass_id"; 550 641 $command .= " -dbname $dbname " if defined $dbname; … … 576 667 next; 577 668 } 578 if ($exposure->{diff_id}) { # Not sure how this would happen, but still. 669 if ($exposure->{diff_id}&&S64_IS_NOT_NULL($exposure->{diff_id})) { # Not sure how this would happen, but still. 670 next; 671 } 672 if ($already_queued{$exposure->{warp_id}}) { 673 print "STATUS: Have already queued a diff containing $exposure->{exp_id} $exposure->{chip_id} $exposure->{warp_id}\n"; 579 674 next; 580 675 } … … 591 686 my $data_group = "${label}.${date}"; 592 687 688 593 689 my $command = "$difftool "; 690 $command .= " -pretend " if defined $debug; 594 691 $command .= " -dbname $dbname " if defined $dbname; 595 692 $command .= " -set_label $label -set_workdir $workdir -set_data_group $data_group "; 596 $command .= " -set_dist_group $dist_group "; 693 if ($exposure->{dist_group}) { 694 $command .= " -set_dist_group $exposure->{dist_group} "; 695 } 597 696 598 697 if ($exposure->{pairwise}) { # warpwarp … … 601 700 $command .= "-input_label $label -template_label $label -backwards "; 602 701 $command .= "-warp_id $exposure->{warp_id} -template_warp_id $companion->{warp_id} "; 603 702 $already_queued{$exposure->{warp_id}} = 1; 703 $already_queued{$companion->{warp_id}} = 1; 704 604 705 } 605 706 else { # warp-qstack 606 707 $command .= " -definewarpstack -set_reduction WARPQSTACK -available -good_frac 0.2 "; 607 708 $command .= " -warp_id $exposure->{warp_id} -stack_label ${label}.quick "; 709 $already_queued{$exposure->{warp_id}} = 1; 608 710 } 609 711 … … 612 714 unless ($success) { 613 715 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 614 &my_die("unable to perform chiptool: $error_code", $exposure->{lap_id}, $exposure->{proj_cell}); 615 } 716 &my_die("unable to perform difftool: $error_code", $exposure->{lap_id}, $exposure->{proj_cell}); 717 } 718 719 616 720 } 617 721 } … … 726 830 727 831 my $command = "$laptool -updateexp -lap_id $lap_id -exp_id $exp_id "; 728 if ( $exposure->{chip_id}) {832 if (($exposure->{chip_id})&&(S64_IS_NOT_NULL($exposure->{chip_id}))) { 729 833 $command .= " -set_chip_id $exposure->{chip_id} "; 730 834 } 731 if ( $exposure->{pair_id}) {835 if (($exposure->{pair_id})&&(S64_IS_NOT_NULL($exposure->{pair_id}))) { 732 836 $command .= " -set_pair_id $exposure->{pair_id} "; 733 837 } -
branches/czw_branch/20110406/ippTools/share/laptool_definerun.sql
r31407 r31428 1 SELECT exp_id, chip_id, false as private, true as active, false as pairwise 2 FROM rawExp 3 LEFT JOIN 4 (SELECT exp_id, chip_id 5 FROM lapExp 6 where private IS FALSE 7 AND data_state = 'full') AS old USING(exp_id) 1 SELECT want.exp_id, have.chip_id, false as private, true as active, false as pairwise 2 FROM 3 (SELECT exp_id FROM rawExp 8 4 WHERE rawExp.exp_type= 'OBJECT' AND 9 5 rawExp.dateobs >= '2009-04-01T00:00:00.000000' AND 10 6 -- Position restriction goes here. 7 @WHERE@ 8 ) AS want 9 LEFT JOIN 10 (SELECT * 11 FROM lapExp 12 where private IS FALSE 13 AND chip_id IS NOT NULL 14 AND active = TRUE ) AS have USING(exp_id) 15 16 -
branches/czw_branch/20110406/ippTools/share/laptool_exposures.sql
r31409 r31428 1 1 SELECT DISTINCT 2 2 D.*,diffRun.state, 3 CONVERT(sum(others.private),SIGNED) AS needs_remade3 coalesce(CONVERT(sum(others.private),SIGNED),0) AS needs_remade 4 4 -- 0 AS needs_remade 5 5 FROM ( … … 7 7 W.*,CONVERT(IFNULL(diff1.diff_id,diff2.diff_id),SIGNED) AS diff_id FROM ( 8 8 SELECT DISTINCT 9 lap_id,lapRun.tess_id,projection_cell,filter,lapRun.state as lapRun_state, lapRun.registered, lapRun.fault, lapRun.label, 9 lap_id,lapRun.tess_id,projection_cell,filter,lapRun.state as lapRun_state, lapRun.registered, lapRun.fault, lapRun.label, lapRun.dist_group, 10 10 lapExp.exp_id,lapExp.chip_id,lapExp.pair_id,private,pairwise,active,lapExp.data_state, 11 11 chipRun.state as chipRun_state, 12 CONVERT(sum(chipProcessedImfile.fault),SIGNED) as chip_faults,13 CONVERT(sum(chipProcessedImfile.quality),SIGNED) as chip_quality,12 coalesce(CONVERT(sum(chipProcessedImfile.fault),SIGNED),0) as chip_faults, 13 coalesce(CONVERT(sum(chipProcessedImfile.quality),SIGNED),0) as chip_quality, 14 14 camRun.cam_id, camRun.state as camRun_state, 15 CONVERT(sum(camProcessedExp.fault),SIGNED) AS cam_faults,16 CONVERT(sum(camProcessedExp.quality),SIGNED) AS cam_quality,15 coalesce(CONVERT(sum(camProcessedExp.fault),SIGNED),0) AS cam_faults, 16 coalesce(CONVERT(sum(camProcessedExp.quality),SIGNED),0) AS cam_quality, 17 17 fakeRun.fake_id, fakeRun.state as fakeRun_state, 18 CONVERT(sum(fakeProcessedImfile.fault),SIGNED) as fake_faults,18 coalesce(CONVERT(sum(fakeProcessedImfile.fault),SIGNED),0) as fake_faults, 19 19 warpRun.warp_id, warpRun.state as warpRun_state, 20 CONVERT(sum(warpSkyfile.fault),SIGNED) as warp_faults,21 CONVERT(sum(warpSkyfile.quality),SIGNED) as warp_quality,20 coalesce(CONVERT(sum(warpSkyfile.fault),SIGNED),0) as warp_faults, 21 coalesce(CONVERT(sum(warpSkyfile.quality),SIGNED),0) as warp_quality, 22 22 warpRun.magicked 23 23 FROM lapRun JOIN lapExp USING(lap_id) … … 28 28 LEFT JOIN warpRun USING(fake_id) LEFT JOIN warpSkyfile USING(warp_id) 29 29 WHERE @WHERE@ 30 AND warpSkyfile.quality != 8007 -- known cases where quality != 0, but everything's fine. 31 AND warpSkyfile.quality != 3006 -- known cases where quality != 0, but everything's fine. 30 AND (warpSkyfile.quality IS NULL OR 31 (warpSkyfile.quality != 8007 -- known cases where quality != 0, but everything's fine. 32 AND warpSkyfile.quality != 3006 -- known cases where quality != 0, but everything's fine. 33 )) 32 34 GROUP BY lap_id,exp_id 33 35 ) AS W … … 37 39 ) AS D 38 40 LEFT JOIN diffRun USING(diff_id) 39 JOIN lapExp AS others ON (D.chip_id = others.chip_id AND D.lap_id != others.lap_id) 41 LEFT JOIN lapExp AS others ON (D.chip_id = others.chip_id AND D.lap_id != others.lap_id) 42 GROUP BY lap_id,exp_id 40 43 -
branches/czw_branch/20110406/ippTools/share/laptool_pendingexp.sql
r31407 r31428 1 select lapRun.lap_id, lapRun.seq_id, lapRun.tess_id, lapRun.projection_cell, lapRun.filter, lapRun.state, lapRun.label, 1 select lapRun.lap_id, lapRun.seq_id, lapRun.tess_id, lapRun.projection_cell, lapRun.filter, 2 lapRun.state, lapRun.label, 2 3 lapRun.dist_group, lapRun.registered, lapRun.fault, lapRun.quick_sass_id, lapRun.final_sass_id, 3 4 exp_id, chip_id, pair_id, private, pairwise, active, lapExp.data_state, -
branches/czw_branch/20110406/ippTools/share/laptool_stacks.sql
r31407 r31428 3 3 lapRun.state,lapRun.label,lapRun.dist_group,lapRun.registered,lapRun.fault, 4 4 skycell_id, 5 quick_sass_id,quick_data_group,quick_stack_id,quick_state,quick_fault,quick_quality,6 final_sass_id,final_data_group,final_stack_id,final_state,final_fault,final_quality5 lapRun.quick_sass_id,quick_data_group,quick_stack_id,quick_state,quick_fault,quick_quality, 6 lapRun.final_sass_id,final_data_group,final_stack_id,final_state,final_fault,final_quality 7 7 FROM 8 8 lapRun LEFT JOIN … … 95 95 AND sass_id = lapRun.final_sass_id 96 96 ) AS final USING(lap_id,projection_cell,tess_id,filter,skycell_id) 97 ) stacks USING(lap_id,projection_cell,tess_id,filter,quick_sass_id,final_sass_id) 97 ) stacks ON (stacks.lap_id = lapRun.lap_id AND 98 stacks.projection_cell = lapRun.projection_cell AND 99 stacks.tess_id = lapRun.tess_id AND 100 stacks.filter = lapRun.filter AND 101 (lapRun.quick_sass_id IS NULL OR lapRun.quick_sass_id = stacks.quick_sass_id) AND 102 (lapRun.final_sass_id IS NULL OR lapRun.final_sass_id = stacks.final_sass_id)) 98 103 WHERE 1 @WHERE@ -
branches/czw_branch/20110406/ippTools/share/stacktool_sassskyfile.sql
r28375 r31428 18 18 where stack_id = stackRun.stack_id limit 1 19 19 ) as camera 20 FROM stack Run21 JOIN stack SumSkyfile USING(stack_id)22 JOIN stack AssociationMapUSING(stack_id)23 JOIN stackAssociation USING(sass_id)20 FROM stackAssociation 21 JOIN stackAssociationMap USING(sass_id) 22 JOIN stackRun USING(stack_id) 23 LEFT JOIN stackSumSkyfile USING(stack_id) -
branches/czw_branch/20110406/ippTools/src/difftool.c
r31253 r31428 1625 1625 PXOPT_COPY_S64(config->args, selectWhere, "-exp_id", "inputRawExp.exp_id", "=="); 1626 1626 PXOPT_COPY_S64(config->args, selectWhere, "-template_exp_id", "templateRawExp.exp_id", "=="); 1627 PXOPT_COPY_S64(config->args, selectWhere, "-template_warp_id", "templateWarpRun.warp_id", "=="); 1627 1628 PXOPT_COPY_STR(config->args, selectWhere, "-filter", "inputRawExp.filter", "=="); 1628 1629 PXOPT_COPY_STR(config->args, selectWhere, "-obs_mode", "inputRawExp.obs_mode", "=="); -
branches/czw_branch/20110406/ippTools/src/difftoolConfig.c
r31253 r31428 278 278 psMetadataAddBool(definewarpwarpArgs, PS_LIST_TAIL, "-not-bothways", 0, "only do the single-direction subtraction?", false); 279 279 psMetadataAddS64(definewarpwarpArgs, PS_LIST_TAIL, "-template_exp_id", 0, "search by template exposure ID", 0); 280 psMetadataAddS64(definewarpwarpArgs, PS_LIST_TAIL, "-template_warp_id", 0, "search by template warp ID", 0); 280 281 psMetadataAddStr(definewarpwarpArgs, PS_LIST_TAIL, "-filter", 0, "search by filter", NULL); 281 282 psMetadataAddF32(definewarpwarpArgs, PS_LIST_TAIL, "-distance", 0, "limit distance between input and template (deg)", NAN); -
branches/czw_branch/20110406/ippTools/src/laptool.c
r31417 r31428 295 295 return(false); 296 296 } 297 psStringAppend(&query, " %s", whereClause); 297 298 if (whereClause) { 299 psStringSubstitute(&query,whereClause,"@WHERE@"); 300 } 298 301 psFree(where); 299 302 … … 467 470 } 468 471 else { 469 return( false);472 return(true); // We shouldn't really fail if we didn't change anything. Maybe there's nothing to change. 470 473 } 471 474 } 472 return(true); 473 } 474 else { 475 return(false); 476 } 475 476 } 477 478 return(true); 477 479 } 478 480 … … 496 498 if (psListLength(where->list)) { 497 499 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 498 psStringAppend(&query, " WHERE%s", whereClause);500 psStringAppend(&query, "\n AND %s", whereClause); 499 501 psFree(whereClause); 500 502 } 501 503 psStringAppend(&query, " ORDER BY rawExp.dateobs "); 504 502 505 if (limit) { 503 506 psString limitString = psDBGenerateLimitSQL(limit); 504 psStringAppend(&query, " %s", limitString);507 psStringAppend(&query, "\n %s", limitString); 505 508 psFree(limitString); 506 509 } 507 psStringAppend(&query, " ORDER BY rawExp.dateobs "); 510 508 511 509 512 if (!p_psDBRunQuery(config->dbh, query)) { … … 615 618 616 619 psMetadata *where = psMetadataAlloc(); 617 PXOPT_COPY_S64(config->args, where, "-lap_id", "lap _id", "==");620 PXOPT_COPY_S64(config->args, where, "-lap_id", "lapRun.lap_id", "=="); 618 621 619 622 psString query = pxDataGet("laptool_stacks.sql");
Note:
See TracChangeset
for help on using the changeset viewer.
