Changeset 28375
- Timestamp:
- Jun 16, 2010, 5:30:27 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 36 edited
- 9 copied
-
. (modified) (1 prop)
-
Ohana (modified) (1 prop)
-
dbconfig/changes.txt (modified) (4 diffs)
-
dbconfig/diff.md (modified) (1 diff)
-
dbconfig/stack.md (modified) (1 diff)
-
dbconfig/warp.md (modified) (1 diff)
-
ippScripts/Build.PL (modified) (1 diff)
-
ippScripts/MANIFEST (modified) (1 diff)
-
ippScripts/scripts/skycell_jpeg.pl (copied) (copied from branches/czw_branch/20100519/ippScripts/scripts/skycell_jpeg.pl )
-
ippTasks/diff.pro (modified) (7 diffs)
-
ippTasks/stack.pro (modified) (7 diffs)
-
ippTasks/warp.pro (modified) (6 diffs)
-
ippTools/share/Makefile.am (modified) (4 diffs)
-
ippTools/share/difftool_addsummary.sql (copied) (copied from branches/czw_branch/20100519/ippTools/share/difftool_addsummary.sql )
-
ippTools/share/difftool_tosummary.sql (copied) (copied from branches/czw_branch/20100519/ippTools/share/difftool_tosummary.sql )
-
ippTools/share/pxadmin_create_tables.sql (modified) (3 diffs)
-
ippTools/share/pxadmin_drop_tables.sql (modified) (1 diff)
-
ippTools/share/stacktool_addsummary.sql (copied) (copied from branches/czw_branch/20100519/ippTools/share/stacktool_addsummary.sql )
-
ippTools/share/stacktool_associationdefine_select.sql (copied) (copied from branches/czw_branch/20100519/ippTools/share/stacktool_associationdefine_select.sql ) (1 diff)
-
ippTools/share/stacktool_sassskyfile.sql (copied) (copied from branches/czw_branch/20100519/ippTools/share/stacktool_sassskyfile.sql )
-
ippTools/share/stacktool_tosummary.sql (copied) (copied from branches/czw_branch/20100519/ippTools/share/stacktool_tosummary.sql )
-
ippTools/share/warptool_addsummary.sql (copied) (copied from branches/czw_branch/20100519/ippTools/share/warptool_addsummary.sql )
-
ippTools/share/warptool_tosummary.sql (copied) (copied from branches/czw_branch/20100519/ippTools/share/warptool_tosummary.sql )
-
ippTools/src/difftool.c (modified) (3 diffs)
-
ippTools/src/difftool.h (modified) (1 diff)
-
ippTools/src/difftoolConfig.c (modified) (3 diffs)
-
ippTools/src/stacktool.c (modified) (15 diffs)
-
ippTools/src/stacktool.h (modified) (1 diff)
-
ippTools/src/stacktoolConfig.c (modified) (4 diffs)
-
ippTools/src/warptool.c (modified) (3 diffs)
-
ippTools/src/warptool.h (modified) (1 diff)
-
ippTools/src/warptoolConfig.c (modified) (2 diffs)
-
ippconfig/recipes/filerules-mef.mdc (modified) (1 diff)
-
ippconfig/recipes/filerules-simple.mdc (modified) (1 diff)
-
ippconfig/recipes/filerules-split.mdc (modified) (1 diff)
-
ippconfig/recipes/ppSkycell.config (modified) (1 diff)
-
ppImage/src/ppImageLoop.c (modified) (2 diffs)
-
ppImage/src/ppImagePhotom.c (modified) (3 diffs)
-
ppSkycell/src/ppSkycell.h (modified) (1 diff)
-
ppSkycell/src/ppSkycellCamera.c (modified) (2 diffs)
-
ppSkycell/src/ppSkycellLoop.c (modified) (2 diffs)
-
psModules (modified) (1 prop)
-
psconfig/tagsets/ipp-2.9.dist (modified) (1 diff)
-
psphot (modified) (1 prop)
-
psphot/src/psphotReadout.c (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/czw_branch/20100519 (added) merged: 28044-28045,28164,28245,28304,28334,28338
- Property svn:mergeinfo changed
-
trunk/Ohana
- Property svn:mergeinfo changed
/branches/czw_branch/20100519/Ohana (added) merged: 28304,28334,28338
- Property svn:mergeinfo changed
-
trunk/dbconfig/changes.txt
r28343 r28375 1634 1634 ALTER TABLE diffSkyfile ADD COLUMN maskfrac_advisory FLOAT after maskfrac_magic; 1635 1635 1636 1636 1637 ALTER TABLE chipRun CHANGE maskfrac_npix maskfrac_npix FLOAT; 1637 1638 ALTER TABLE camRun CHANGE maskfrac_npix maskfrac_npix FLOAT; … … 1730 1731 -- this adds the new tables 1731 1732 1732 1733 1733 CREATE TABLE minidvodbRun ( 1734 1734 minidvodb_id BIGINT AUTO_INCREMENT, … … 1741 1741 PRIMARY KEY(minidvodb_id), KEY(minidvodb_name), INDEX(minidvodb_id) 1742 1742 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1743 1744 1745 1743 1746 1744 CREATE TABLE minidvodbProcessed ( … … 1791 1789 FOREIGN KEY(diff_phot_id) REFERENCES diffPhotRun(diff_phot_id) 1792 1790 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1791 1792 1793 -- Version 1.1.69 warp/stack/diff summary and stack associations. 1794 1795 CREATE TABLE warpSummary ( 1796 warp_id BIGINT, 1797 projection_cell VARCHAR(64) NOT NULL, 1798 path_base VARCHAR(255) NOT NULL, 1799 PRIMARY KEY(warp_id), 1800 KEY(projection_cell), 1801 FOREIGN KEY(warp_id) REFERENCES warpRun(warp_id) 1802 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1803 1804 CREATE TABLE diffSummary ( 1805 diff_id BIGINT, 1806 projection_cell VARCHAR(64) NOT NULL, 1807 path_base VARCHAR(255) NOT NULL, 1808 PRIMARY KEY(diff_id), 1809 KEY(projection_cell), 1810 FOREIGN KEY(diff_id) REFERENCES diffRun(diff_id) 1811 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1812 1813 CREATE TABLE stackAssociation ( 1814 sass_id BIGINT AUTO_INCREMENT, 1815 data_group VARCHAR(64) NOT NULL, 1816 projection_cell VARCHAR(64) NOT NULL, 1817 tess_id VARCHAR(64) NOT NULL, 1818 filter VARCHAR(64) NOT NULL, 1819 PRIMARY KEY(sass_id), 1820 KEY(data_group), 1821 KEY(projection_cell), 1822 KEY(tess_id) 1823 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1824 1825 CREATE TABLE stackAssociationMap ( 1826 sass_id BIGINT, 1827 stack_id BIGINT, 1828 PRIMARY KEY(sass_id, stack_id), 1829 FOREIGN KEY(sass_id) REFERENCES stackAssociation(sass_id), 1830 FOREIGN KEY(stack_id) REFERENCES stackRun(stack_id) 1831 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1832 1833 CREATE TABLE stackSummary ( 1834 sass_id BIGINT, 1835 projection_cell VARCHAR(64) NOT NULL, 1836 path_base VARCHAR(255) NOT NULL, 1837 PRIMARY KEY(sass_id), 1838 KEY(projection_cell), 1839 FOREIGN KEY(sass_id) REFERENCES stackAssociation(sass_id) 1840 ) ENGINE=innodb DEFAULT CHARSET=latin1; -
trunk/dbconfig/diff.md
r28056 r28375 75 75 maskfrac_advisory F32 0.0 76 76 END 77 78 diffSummary METADATA 79 diff_id S64 0 # Primary Key fkey(diff_id) ref diffRun(diff_id) 80 projection_cell STR 32 # Primary Key 81 path_base STR 255 82 END -
trunk/dbconfig/stack.md
r28043 r28375 53 53 quality S16 0 54 54 END 55 56 stackSummary METADATA 57 sass_id S64 0 # Primary Key fkey(sass_id) ref stackAssociation(sass_id) 58 projection_cell STR 32 # Primary Key 59 path_base STR 255 60 END 61 62 stackAssociation METADATA 63 sass_id S64 0 # Primary Key AUTO_INCREMENT 64 data_group STR 64 # Key 65 projection_cell STR 64 # Key 66 tess_id STR 64 # Key 67 filter STR 64 68 END 69 70 stackAssociationMap METADATA 71 sass_id S64 0 # Primary Key fkey(sass_id) ref stackAssociation(sass_id) 72 stack_id S64 0 # Primary Key fkey(stack_id) ref stackRun(stack_id) 73 END -
trunk/dbconfig/warp.md
r28056 r28375 79 79 label STR 64 # Primary Key 80 80 END 81 82 warpSummary METADATA 83 warp_id S64 0 # Primary Key fkey(warp_id) ref warpRun(warp_id) 84 projection_cell STR 32 # Primary Key 85 path_base STR 255 86 END -
trunk/ippScripts/Build.PL
r28360 r28375 109 109 scripts/bundle_detrends.pl 110 110 scripts/ipp_cluster_load_monitor.pl 111 scripts/skycell_jpeg.pl 111 112 scripts/diffphot.pl 112 113 )], -
trunk/ippScripts/MANIFEST
r27504 r28375 42 42 scripts/bundle_detrends.pl 43 43 scripts/ipp_cluster_load_monitor.pl 44 scripts/skycell_jpeg.pl 44 45 t/00_distribution.t -
trunk/ippTasks/diff.pro
r27920 r28375 11 11 book init diffSkyfile 12 12 #book init diffCleanup 13 book init diffPendingSummary 13 14 14 15 ### Database lists … … 16 17 $diffAdvance_DB = 0 17 18 $diff_revert_DB = 0 19 $diffSummary_DB = 0 18 20 #$diffCleanup_DB = 0 19 21 … … 27 29 macro diff.reset 28 30 book init diffSkyfile 31 book init diffPendingSummary 29 32 # book init diffCleanup 30 33 end … … 44 47 active false 45 48 end 49 task diff.summary.load 50 active true 51 end 52 task diff.summary.run 53 active true 54 end 46 55 end 47 56 … … 58 67 end 59 68 task diff.revert 69 active false 70 end 71 task diff.summary.load 72 active false 73 end 74 task diff.summary.run 60 75 active false 61 76 end … … 193 208 # host anyhost 194 209 # $WORKDIR = $WORKDIR_TEMPLATE 195 196 210 if (($DIFF_MODE == 1)||("$DIFF_MODE" == "NULL")) 197 211 $DIFF_TAG = "" … … 477 491 end 478 492 end 493 494 ### Load tasks for doing the diffs 495 ### Tasks are loaded into diffPendingSkyCell. 496 task diff.summary.load 497 host local 498 499 periods -poll $LOADPOLL 500 periods -exec $LOADEXEC 501 periods -timeout 1200 502 npending 1 503 504 stdout NULL 505 stderr $LOGDIR/diff.summary.log 506 507 task.exec 508 if ($LABEL:n == 0) break 509 $run = difftool -tosummary 510 if ($DB:n == 0) 511 option DEFAULT 512 else 513 # save the DB name for the exit tasks 514 option $DB:$diffSummary_DB 515 $run = $run -dbname $DB:$diffSummary_DB 516 $diffSummary_DB ++ 517 if ($diffSummary_DB >= $DB:n) set diffSummary_DB = 0 518 end 519 add_poll_args run 520 add_poll_labels run 521 command $run 522 end 523 524 # success 525 task.exit 0 526 # convert 'stdout' to book format 527 # XXX change tess_id to tess_dir when db is updated 528 ipptool2book stdout diffPendingSummary -key diff_id -uniq -setword dbname $options:0 -setword pantaskState INIT 529 if ($VERBOSE > 2) 530 book listbook diffPendingSummary 531 end 532 533 # delete existing entries in the appropriate pantaskStates 534 process_cleanup diffPendingSummary 535 end 536 537 # locked list 538 task.exit default 539 showcommand failure 540 end 541 542 task.exit crash 543 showcommand crash 544 end 545 546 # operation times out? 547 task.exit timeout 548 showcommand timeout 549 end 550 end 551 552 ### Run tasks for calculating the diff overlaps 553 ### Tasks are taken from diffPendingSkyCell. 554 task diff.summary.run 555 periods -poll $RUNPOLL 556 periods -exec $RUNEXEC 557 periods -timeout 60 558 559 task.exec 560 # if we are unable to run the 'exec', use a long retry time 561 periods -exec $RUNEXEC 562 563 book npages diffPendingSummary -var N 564 if ($N == 0) break 565 if ($NETWORK == 0) break 566 567 # look for new images in diffPendingSkyCell (pantaskState == INIT) 568 book getpage diffPendingSummary 0 -var pageName -key pantaskState INIT 569 if ("$pageName" == "NULL") break 570 571 book setword diffPendingSummary $pageName pantaskState RUN 572 book getword diffPendingSummary $pageName diff_id -var DIFF_ID 573 book getword diffPendingSummary $pageName camera -var CAMERA 574 book getword diffPendingSummary $pageName workdir -var WORKDIR_TEMPLATE 575 book getword diffPendingSummary $pageName dbname -var DBNAME 576 book getword diffPendingSummary $pageName tess_id -var TESS_DIR 577 book getword diffPendingSummary $pageName diff_mode -var DIFF_MODE 578 book getword diffPendingSummary $pageName state -var RUN_STATE 579 580 # set the host and workdir based on the skycell hash 581 host anyhost 582 strsub $WORKDIR_TEMPLATE @HOST@.0 $default_host -var WORKDIR 583 # set.workdir.by.skycell $SKYCELL_ID $WORKDIR_TEMPLATE $default_host WORKDIR 584 585 # if ("$PATH_BASE" == "NULL") 586 587 if (($DIFF_MODE == 1)||("$DIFF_MODE" == "NULL")) 588 $DIFF_TAG = "" 589 end 590 if ($DIFF_MODE == 2) 591 $DIFF_TAG = "WS." 592 end 593 if ($DIFF_MODE == 3) 594 $DIFF_TAG = "SW." 595 end 596 if ($DIFF_MODE == 4) 597 $DIFF_TAG = "SS." 598 end 599 600 basename $TESS_DIR -var TESS_ID 601 602 ## generate outroot specific to this exposure 603 sprintf outroot "%s/%s/%s.%sdif.%s.summary" $WORKDIR $TESS_ID $TESS_ID $DIFF_TAG $DIFF_ID 604 605 606 stdout $LOGDIR/diff.summary.log 607 stderr $LOGDIR/diff.summary.log 608 609 $run = skycell_jpeg.pl --stage diff --stage_id $DIFF_ID --camera $CAMERA --outroot $outroot 610 add_standard_args run 611 612 # save the pageName for future reference below 613 options $pageName 614 615 # create the command line 616 if ($VERBOSE > 1) 617 echo command $run 618 end 619 periods -exec 0.05 620 command $run 621 end 622 623 # default exit status 624 task.exit default 625 process_exit diffPendingSummary $options:0 $JOB_STATUS 626 end 627 628 # locked list 629 task.exit crash 630 showcommand crash 631 echo "hostname: $JOB_HOSTNAME" 632 book setword diffPendingSummary $options:0 pantaskState CRASH 633 end 634 635 # operation timed out? 636 task.exit timeout 637 showcommand timeout 638 book setword diffPendingSummary $options:0 pantaskState TIMEOUT 639 end 640 end -
trunk/ippTasks/stack.pro
r27929 r28375 10 10 ### Initialise the books containing the tasks to do 11 11 book init stackSumSkyfile 12 book init stackPendingSummary 12 13 #book init stackCleanup 13 14 … … 16 17 $stack_revert_DB = 0 17 18 #$stackCleanup_DB = 0 19 $stackSummary_DB = 0 18 20 19 21 ### Check status of stacking tasks … … 26 28 macro stack.reset 27 29 book init stackSumSkyfile 30 book init stackPendingSummary 28 31 # book init stackCleanup 29 32 end … … 40 43 active false 41 44 end 45 task stack.summary.load 46 active true 47 end 48 task stack.summary.run 49 active true 50 end 42 51 end 43 52 … … 51 60 end 52 61 task stack.revert 62 active false 63 end 64 task stack.summary.load 65 active false 66 end 67 task stack.summary.run 53 68 active false 54 69 end … … 349 364 # end 350 365 366 367 368 351 369 task stack.revert 352 370 host local … … 400 418 end 401 419 420 ### Load tasks for doing the stack summary 421 ### Tasks are loaded into stackPendingSummary 422 task stack.summary.load 423 host local 424 425 periods -poll $LOADPOLL 426 periods -exec $LOADEXEC 427 periods -timeout 1200 428 trange 07:00:00 08:00:00 -nmax 1 429 npending 1 430 431 stdout NULL 432 stderr $LOGDIR/stack.summary.load 433 434 task.exec 435 if ($LABEL:n == 0) break 436 $run = stacktool -tosummary 437 if ($DB:n == 0) 438 option DEFAULT 439 else 440 # save the DB name for the exit tasks 441 option $DB:$stackSummary_DB 442 $run = $run -dbname $DB:$stackSummary_DB 443 $stackSummary_DB ++ 444 if ($stackSummary_DB >= $DB:n) set stackSummary_DB = 0 445 end 446 add_poll_args run 447 add_poll_labels run 448 command $run 449 end 450 451 # success 452 task.exit 0 453 # convert 'stdout' to book format 454 ipptool2book stdout stackPendingSummary -key sass_id -uniq -setword dbname $options:0 -setword pantaskState INIT 455 if ($VERBOSE > 2) 456 book listbook stackPendingSummary 457 end 458 459 # delete existing entries in the appropriate pantaskStates 460 process_cleanup stackPendingSummary 461 end 462 463 # locked list 464 task.exit default 465 showcommand failure 466 end 467 468 task.exit crash 469 showcommand crash 470 end 471 472 # operation times out? 473 task.exit timeout 474 showcommand timeout 475 end 476 end 477 478 ### Run tasks for doing the stack summary 479 task stack.summary.run 480 periods -poll $RUNPOLL 481 periods -exec $RUNEXEC 482 periods -timeout 60 483 484 task.exec 485 # if we are unable to run the 'exec', use a long retry time 486 periods -exec $RUNEXEC 487 488 book npages stackPendingSummary -var N 489 if ($N == 0) break 490 if ($NETWORK == 0) break 491 492 # look for new images in stackPendingSummary (pantaskState == INIT) 493 book getpage stackPendingSummary 0 -var pageName -key pantaskState INIT 494 if ("$pageName" == "NULL") break 495 496 book setword stackPendingSummary $pageName pantaskState RUN 497 book getword stackPendingSummary $pageName sass_id -var SASS_ID 498 book getword stackPendingSummary $pageName camera -var CAMERA 499 book getword stackPendingSummary $pageName workdir -var WORKDIR_TEMPLATE 500 book getword stackPendingSummary $pageName dbname -var DBNAME 501 book getword stackPendingSummary $pageName tess_id -var TESS_DIR 502 book getword stackPendingSummary $pageName state -var RUN_STATE 503 book getword stackPendingSummary $pageName projection_cell -var projection_cell 504 505 # set the host and workdir 506 host anyhost 507 strsub $WORKDIR_TEMPLATE @HOST@.0 $default_host -var WORKDIR 508 509 basename $TESS_DIR -var TESS_ID 510 511 ## generate outroot specific to this association 512 sprintf outroot "%s/%s/%s.stk.%s.summary" $WORKDIR $TESS_ID $TESS_ID $SASS_ID 513 514 stdout $LOGDIR/stack.summary.log 515 stderr $LOGDIR/stack.summary.log 516 517 $run = skycell_jpeg.pl --stage stack --stage_id $SASS_ID --camera $CAMERA --outroot $outroot 518 add_standard_args run 519 520 # save the pageName for future reference below 521 options $pageName 522 523 # create the command line 524 if ($VERBOSE > 1) 525 echo command $run 526 end 527 periods -exec 0.05 528 command $run 529 end 530 531 # default exit status 532 task.exit default 533 process_exit stackPendingSummary $options:0 $JOB_STATUS 534 end 535 536 # locked list 537 task.exit crash 538 showcommand crash 539 echo "hostname: $JOB_HOSTNAME" 540 book setword stackPendingSummary $options:0 pantaskState CRASH 541 end 542 543 # operation timed out? 544 task.exit timeout 545 showcommand timeout 546 book setword stackPendingSummary $options:0 pantaskState TIMEOUT 547 end 548 end 549 -
trunk/ippTasks/warp.pro
r27926 r28375 13 13 book init warpPendingSkyCell 14 14 book init warpPendingCleanup 15 book init warpPendingSummary 15 16 16 17 ### Database lists … … 19 20 $warp_revert_overlap_DB = 0 20 21 $warp_revert_warped_DB = 0 22 $warpSummary_DB = 0 21 23 22 24 ### Check status of warping tasks … … 30 32 book init warpInputExp 31 33 book init warpPendingSkyCell 34 book init warpPendingSummary 32 35 end 33 36 … … 55 58 active true 56 59 end 60 task warp.summary.load 61 active true 62 end 63 task warp.summary.run 64 active true 65 end 57 66 end 58 67 … … 78 87 end 79 88 task warp.revert.warped 89 active false 90 end 91 task warp.summary.load 92 active false 93 end 94 task warp.summary.run 80 95 active false 81 96 end … … 525 540 end 526 541 end 542 543 ### Load tasks for doing the warps 544 ### Tasks are loaded into warpPendingSkyCell. 545 task warp.summary.load 546 host local 547 548 periods -poll $LOADPOLL 549 periods -exec $LOADEXEC 550 periods -timeout 1200 551 npending 1 552 553 stdout NULL 554 stderr $LOGDIR/warp.summary.log 555 556 task.exec 557 if ($LABEL:n == 0) break 558 $run = warptool -tosummary 559 if ($DB:n == 0) 560 option DEFAULT 561 else 562 # save the DB name for the exit tasks 563 option $DB:$warpSummary_DB 564 $run = $run -dbname $DB:$warpSummary_DB 565 $warpSummary_DB ++ 566 if ($warpSummary_DB >= $DB:n) set warpSummary_DB = 0 567 end 568 add_poll_args run 569 add_poll_labels run 570 command $run 571 end 572 573 # success 574 task.exit 0 575 # convert 'stdout' to book format 576 # XXX change tess_id to tess_dir when db is updated 577 ipptool2book stdout warpPendingSummary -key warp_id -uniq -setword dbname $options:0 -setword pantaskState INIT 578 if ($VERBOSE > 2) 579 book listbook warpPendingSummary 580 end 581 582 # delete existing entries in the appropriate pantaskStates 583 process_cleanup warpPendingSummary 584 end 585 586 # locked list 587 task.exit default 588 showcommand failure 589 end 590 591 task.exit crash 592 showcommand crash 593 end 594 595 # operation times out? 596 task.exit timeout 597 showcommand timeout 598 end 599 end 600 601 ### Run tasks for calculating the warp overlaps 602 ### Tasks are taken from warpPendingSkyCell. 603 task warp.summary.run 604 periods -poll $RUNPOLL 605 periods -exec $RUNEXEC 606 periods -timeout 60 607 608 task.exec 609 # if we are unable to run the 'exec', use a long retry time 610 periods -exec $RUNEXEC 611 612 book npages warpPendingSummary -var N 613 if ($N == 0) break 614 if ($NETWORK == 0) break 615 616 # look for new images in warpPendingSkyCell (pantaskState == INIT) 617 book getpage warpPendingSummary 0 -var pageName -key pantaskState INIT 618 if ("$pageName" == "NULL") break 619 620 book setword warpPendingSummary $pageName pantaskState RUN 621 book getword warpPendingSummary $pageName warp_id -var WARP_ID 622 book getword warpPendingSummary $pageName camera -var CAMERA 623 book getword warpPendingSummary $pageName workdir -var WORKDIR_TEMPLATE 624 book getword warpPendingSummary $pageName dbname -var DBNAME 625 book getword warpPendingSummary $pageName tess_id -var TESS_DIR 626 book getword warpPendingSummary $pageName exp_tag -var EXP_TAG 627 book getword warpPendingSummary $pageName state -var RUN_STATE 628 629 # set the host and workdir based on the skycell hash 630 host anyhost 631 strsub $WORKDIR_TEMPLATE @HOST@.0 $default_host -var WORKDIR 632 # set.workdir.by.skycell $SKYCELL_ID $WORKDIR_TEMPLATE $default_host WORKDIR 633 634 # if ("$PATH_BASE" == "NULL") 635 ## generate outroot specific to this exposure 636 basename $TESS_DIR -var TESS_ID 637 638 sprintf outroot "%s/%s/%s.wrp.%s.%s" $WORKDIR $EXP_TAG $EXP_TAG $WARP_ID $TESS_ID 639 640 641 stdout $LOGDIR/warp.summary.log 642 stderr $LOGDIR/warp.summary.log 643 644 $run = skycell_jpeg.pl --stage warp --stage_id $WARP_ID --camera $CAMERA --outroot $outroot 645 add_standard_args run 646 647 # save the pageName for future reference below 648 options $pageName 649 650 # create the command line 651 if ($VERBOSE > 1) 652 echo command $run 653 end 654 periods -exec 0.05 655 command $run 656 end 657 658 # default exit status 659 task.exit default 660 process_exit warpPendingSummary $options:0 $JOB_STATUS 661 end 662 663 # locked list 664 task.exit crash 665 showcommand crash 666 echo "hostname: $JOB_HOSTNAME" 667 book setword warpPendingSummary $options:0 pantaskState CRASH 668 end 669 670 # operation timed out? 671 task.exit timeout 672 showcommand timeout 673 book setword warpPendingSummary $options:0 pantaskState TIMEOUT 674 end 675 end -
trunk/ippTools/share/Makefile.am
r28343 r28375 126 126 difftool_skyfile.sql \ 127 127 difftool_todiffskyfile.sql \ 128 difftool_tosummary.sql \ 129 difftool_addsummary.sql \ 128 130 disttool_definebyquery_camera.sql \ 129 131 disttool_definebyquery_chip.sql \ … … 278 280 regtool_updatebyquery.sql \ 279 281 regtool_updatebyqueryimfile.sql \ 282 stacktool_associationdefine_select.sql \ 280 283 stacktool_definebyquery_insert.sql \ 281 284 stacktool_definebyquery_insert_random_part1.sql \ … … 293 296 stacktool_revertsumskyfile_delete.sql \ 294 297 stacktool_sumskyfile.sql \ 298 stacktool_sassskyfile.sql \ 295 299 stacktool_tosum.sql \ 300 stacktool_tosummary.sql \ 301 stacktool_addsummary.sql \ 296 302 staticskytool_definebyquery_select.sql \ 297 303 staticskytool_definebyquery_inputs.sql \ … … 326 332 warptool_updateskyfile.sql \ 327 333 warptool_warped.sql \ 334 warptool_tosummary.sql \ 335 warptool_addsummary.sql \ 328 336 diffphottool_definerun.sql \ 329 337 diffphottool_input.sql \ -
trunk/ippTools/share/pxadmin_create_tables.sql
r28348 r28375 981 981 ) ENGINE=innodb DEFAULT CHARSET=latin1; 982 982 983 CREATE TABLE warpSummary ( 984 warp_id BIGINT, 985 projection_cell VARCHAR(64) NOT NULL, 986 path_base VARCHAR(255) NOT NULL, 987 PRIMARY KEY(warp_id), 988 KEY(projection_cell), 989 FOREIGN KEY(warp_id) REFERENCES warpRun(warp_id) 990 ) ENGINE=innodb DEFAULT CHARSET=latin1; 991 983 992 CREATE TABLE stackRun ( 984 993 stack_id BIGINT AUTO_INCREMENT, … … 1049 1058 KEY(quality), 1050 1059 FOREIGN KEY(stack_id) REFERENCES stackRun(stack_id) 1060 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1061 1062 CREATE TABLE stackAssociation ( 1063 sass_id BIGINT AUTO_INCREMENT, 1064 data_group VARCHAR(64) NOT NULL, 1065 projection_cell VARCHAR(64) NOT NULL, 1066 tess_id VARCHAR(64) NOT NULL, 1067 filter VARCHAR(64) NOT NULL, 1068 PRIMARY KEY(sass_id), 1069 KEY(data_group), 1070 KEY(projection_cell), 1071 KEY(tess_id) 1072 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1073 1074 CREATE TABLE stackAssociationMap ( 1075 sass_id BIGINT, 1076 stack_id BIGINT, 1077 PRIMARY KEY(sass_id, stack_id), 1078 FOREIGN KEY(sass_id) REFERENCES stackAssociation(sass_id), 1079 FOREIGN KEY(stack_id) REFERENCES stackRun(stack_id) 1080 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1081 1082 CREATE TABLE stackSummary ( 1083 sass_id BIGINT, 1084 projection_cell VARCHAR(64) NOT NULL, 1085 path_base VARCHAR(255) NOT NULL, 1086 PRIMARY KEY(sass_id), 1087 KEY(projection_cell), 1088 FOREIGN KEY(sass_id) REFERENCES stackAssociation(sass_id) 1051 1089 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1052 1090 … … 1147 1185 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1148 1186 1187 CREATE TABLE diffSummary ( 1188 diff_id BIGINT, 1189 projection_cell VARCHAR(64) NOT NULL, 1190 path_base VARCHAR(255) NOT NULL, 1191 PRIMARY KEY(diff_id), 1192 KEY(projection_cell), 1193 FOREIGN KEY(diff_id) REFERENCES diffRun(diff_id) 1194 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1195 1149 1196 CREATE TABLE magicRun ( 1150 1197 magic_id BIGINT AUTO_INCREMENT, -
trunk/ippTools/share/pxadmin_drop_tables.sql
r28349 r28375 41 41 DROP TABLE IF EXISTS warpSkyfile; 42 42 DROP TABLE IF EXISTS warpMask; 43 DROP TABLE IF EXISTS warpSummary; 43 44 DROP TABLE IF EXISTS diffRun; 44 45 DROP TABLE IF EXISTS diffInputSkyfile; 45 46 DROP TABLE IF EXISTS diffSkyfile; 47 DROP TABLE IF EXISTS diffSummary; 46 48 DROP TABLE IF EXISTS stackRun; 47 49 DROP TABLE IF EXISTS stackInputSkyfile; 48 50 DROP TABLE IF EXISTS stackSumSkyfile; 51 DROP TABLE IF EXISTS stackSummary; 52 DROP TABLE IF EXISTS stackAssociation; 53 DROP TABLE IF EXISTS stackAssociationMap; 49 54 DROP TABLE IF EXISTS magicRun; 50 55 DROP TABLE IF EXISTS magicInputSkyfile; -
trunk/ippTools/share/stacktool_associationdefine_select.sql
r28338 r28375 2 2 sass_id, 3 3 data_group, 4 projection_cell, 4 5 tess_id, 5 filter, 6 CASE WHEN LOCATE('.',skycell_id,9) > 0 THEN 7 SUBSTRING_INDEX(skycell_id,'.',2) ELSE 8 SUBSTRING_INDEX(skycell_id,'.',1) END 9 AS projection_cell 6 filter 7 FROM stackAssociation 8 RIGHT JOIN ( 9 SELECT 10 data_group, 11 tess_id, 12 filter, 13 CASE WHEN LOCATE('.',skycell_id,9) > 0 THEN 14 SUBSTRING_INDEX(skycell_id,'.',2) ELSE 15 SUBSTRING_INDEX(skycell_id,'.',1) END 16 AS projection_cell 10 17 FROM stackRun 11 LEFT JOIN stackAssociationMap USING (stack_id)12 WHERE stackRun.stack_id = @STACK_ID@18 WHERE stackRun.stack_id = @STACK_ID@ 19 ) AS RUN USING (data_group,tess_id,filter,projection_cell) LIMIT 1 -
trunk/ippTools/src/difftool.c
r28056 r28375 44 44 static bool definewarpwarpMode(pxConfig *config); 45 45 static bool definestackstackMode(pxConfig *config); 46 static bool tosummaryMode(pxConfig *config); 47 static bool addsummaryMode(pxConfig *config); 46 48 static bool pendingcleanuprunMode(pxConfig *config); 47 49 static bool pendingcleanupskyfileMode(pxConfig *config); … … 93 95 MODECASE(DIFFTOOL_MODE_DEFINEWARPWARP, definewarpwarpMode); 94 96 MODECASE(DIFFTOOL_MODE_DEFINESTACKSTACK, definestackstackMode); 97 MODECASE(DIFFTOOL_MODE_TOSUMMARY, tosummaryMode); 98 MODECASE(DIFFTOOL_MODE_ADDSUMMARY, addsummaryMode); 95 99 MODECASE(DIFFTOOL_MODE_PENDINGCLEANUPRUN, pendingcleanuprunMode); 96 100 MODECASE(DIFFTOOL_MODE_PENDINGCLEANUPSKYFILE, pendingcleanupskyfileMode); … … 2250 2254 } 2251 2255 2256 static bool tosummaryMode(pxConfig *config) { 2257 PS_ASSERT_PTR_NON_NULL(config, NULL); 2258 2259 psMetadata *where = psMetadataAlloc(); 2260 PXOPT_COPY_S64(config->args, where, "-warp_id", "diffSkyfile.warp_id", "=="); 2261 PXOPT_COPY_STR(config->args, where, "-tess_id", "diffSkyfile.tess_id", "=="); 2262 PXOPT_COPY_STR(config->args, where, "-state", "diffRun.state", "=="); 2263 PXOPT_COPY_TIME(config->args, where, "-dateobs_begin", "rawExp.dateobs", ">="); 2264 PXOPT_COPY_TIME(config->args, where, "-dateobs_end", "rawExp.dateobs", "<="); 2265 PXOPT_COPY_STR(config->args, where, "-filter", "rawExp.filter", "LIKE"); 2266 PXOPT_COPY_S64(config->args, where, "-magicked", "diffSkyfile.magicked", "=="); 2267 pxAddLabelSearchArgs (config, where, "-label", "diffRun.label", "LIKE"); 2268 pxAddLabelSearchArgs (config, where, "-data_group", "diffRun.data_group", "LIKE"); 2269 2270 PXOPT_LOOKUP_BOOL(all, config->args, "-all", false); 2271 2272 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 2273 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 2274 2275 // find all rawImfiles matching the default query 2276 psString query = pxDataGet("difftool_tosummary.sql"); 2277 if (!query) { 2278 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 2279 return false; 2280 } 2281 2282 // generate where strings for arguments that require extra processing 2283 // beyond PXOPT_COPY* 2284 psString where2 = NULL; 2285 if (!pxmagicAddWhere(config, &where2, "diffSkyfile")) { 2286 psError(psErrorCodeLast(), false, "pxMagicAddWhere failed"); 2287 return false; 2288 } 2289 2290 if (psListLength(where->list)) { 2291 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 2292 psStringAppend(&query, " AND %s", whereClause); 2293 psFree(whereClause); 2294 } else if (!all && !where2) { 2295 psError(PXTOOLS_ERR_CONFIG, true, "search parameters or -all are required"); 2296 return false; 2297 } 2298 2299 if (where2) { 2300 if (psListLength(where->list)) { 2301 psStringAppend(&query, " %s", where2); 2302 } else { 2303 psStringAppend(&query, " AND 1 %s", where2); 2304 } 2305 } 2306 psFree(where); 2307 2308 // treat limit == 0 as "no limit" 2309 if (limit) { 2310 psString limitString = psDBGenerateLimitSQL(limit); 2311 psStringAppend(&query, " %s", limitString); 2312 psFree(limitString); 2313 } 2314 2315 if (!p_psDBRunQuery(config->dbh, query)) { 2316 psError(PS_ERR_UNKNOWN, false, "database error"); 2317 psFree(query); 2318 return false; 2319 } 2320 psFree(query); 2321 2322 psArray *output = p_psDBFetchResult(config->dbh); 2323 if (!output) { 2324 psErrorCode err = psErrorCodeLast(); 2325 switch (err) { 2326 case PS_ERR_DB_CLIENT: 2327 psError(PXTOOLS_ERR_SYS, false, "database error"); 2328 case PS_ERR_DB_SERVER: 2329 psError(PXTOOLS_ERR_PROG, false, "database error"); 2330 default: 2331 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 2332 } 2333 2334 return false; 2335 } 2336 if (!psArrayLength(output)) { 2337 psTrace("difftool", PS_LOG_INFO, "no rows found"); 2338 psFree(output); 2339 return true; 2340 } 2341 2342 if (psArrayLength(output)) { 2343 // negative simple so the default is true 2344 if (!ippdbPrintMetadatas(stdout, output, "diffRun", !simple)) { 2345 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 2346 psFree(output); 2347 return false; 2348 } 2349 } 2350 2351 psFree(output); 2352 return(true); 2353 } 2354 static bool addsummaryMode(pxConfig *config) { 2355 PS_ASSERT_PTR_NON_NULL(config, NULL); 2356 2357 PXOPT_LOOKUP_S64(diff_id, config->args, "-diff_id", true, false); 2358 PXOPT_LOOKUP_STR(projection_cell, config->args, "-projection_cell", true, false); 2359 PXOPT_LOOKUP_STR(path_base, config->args, "-path_base", true, false); 2360 2361 psString query = pxDataGet("difftool_addsummary.sql"); 2362 if (!query) { 2363 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 2364 return(false); 2365 } 2366 if (!p_psDBRunQueryF(config->dbh, query, diff_id, projection_cell, path_base)) { 2367 psError(PS_ERR_UNKNOWN, false, "database error"); 2368 psFree(query); 2369 return(false); 2370 } 2371 psS64 numUpdated = psDBAffectedRows(config->dbh); 2372 2373 if (numUpdated != 1) { 2374 psError(PS_ERR_UNKNOWN, false, "should have affected 1 row"); 2375 psFree(query); 2376 return false; 2377 } 2378 2379 psFree(query); 2380 2381 // Print anything here? 2382 2383 return(true); 2384 } 2385 2386 2252 2387 static bool pendingcleanuprunMode(pxConfig *config) 2253 2388 { -
trunk/ippTools/src/difftool.h
r27794 r28375 32 32 DIFFTOOL_MODE_ADDDIFFSKYFILE, 33 33 DIFFTOOL_MODE_ADVANCE, 34 DIFFTOOL_MODE_TOSUMMARY, 35 DIFFTOOL_MODE_ADDSUMMARY, 34 36 DIFFTOOL_MODE_DIFFSKYFILE, 35 37 DIFFTOOL_MODE_REVERTDIFFSKYFILE, -
trunk/ippTools/src/difftoolConfig.c
r28054 r28375 323 323 psMetadataAddU64(pendingcleanuprunArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 324 324 325 // -tosummary 326 psMetadata *tosummaryArgs = psMetadataAlloc(); 327 psMetadataAddS64(tosummaryArgs, PS_LIST_TAIL, "-diff_id", 0, "search by diff ID", 0); 328 psMetadataAddStr(tosummaryArgs, PS_LIST_TAIL, "-tess_id", 0, "search by tessellation ID", NULL); 329 psMetadataAddStr(tosummaryArgs, PS_LIST_TAIL, "-state", 0, "search by state", NULL); 330 psMetadataAddS64(tosummaryArgs, PS_LIST_TAIL, "-exp_id", 0, "search by exposure ID", 0); 331 psMetadataAddStr(tosummaryArgs , PS_LIST_TAIL, "-exp_name", 0, "search by exposure name", NULL); 332 psMetadataAddS64(tosummaryArgs, PS_LIST_TAIL, "-warp_id", 0, "search by warp ID", 0); 333 334 psMetadataAddTime(tosummaryArgs, PS_LIST_TAIL, "-dateobs_begin", 0, "search for exposures by time (>=)", NULL); 335 psMetadataAddTime(tosummaryArgs, PS_LIST_TAIL, "-dateobs_end", 0, "search for exposures by time (<=)", NULL); 336 psMetadataAddStr(tosummaryArgs, PS_LIST_TAIL, "-filter", 0, "search for filter", NULL); 337 psMetadataAddS64(tosummaryArgs, PS_LIST_TAIL, "-magicked", 0, "search by magic id", 0); 338 psMetadataAddStr(tosummaryArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by diffRun label (LIKE comparison)", NULL); 339 psMetadataAddStr(tosummaryArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "search by diffRun data_group (LIKE comparison)", NULL); 340 psMetadataAddStr(tosummaryArgs, PS_LIST_TAIL, "-dist_group", PS_META_DUPLICATE_OK, "search by diffRun dist_group (LIKE comparison)", NULL); 341 psMetadataAddBool(tosummaryArgs, PS_LIST_TAIL, "-destreaked", 0, "search for runs that have been destreaked", false); 342 psMetadataAddBool(tosummaryArgs, PS_LIST_TAIL, "-not_destreaked", 0, "search for runs that have not been destreaked", false); 343 344 psMetadataAddBool(tosummaryArgs, PS_LIST_TAIL, "-all", 0, "search without arguments", false); 345 psMetadataAddU64(tosummaryArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 346 psMetadataAddBool(tosummaryArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 347 348 // -addsummary 349 psMetadata *addsummaryArgs = psMetadataAlloc(); 350 psMetadataAddS64(addsummaryArgs, PS_LIST_TAIL, "-diff_id", 0, "search by diff ID", 0); 351 psMetadataAddStr(addsummaryArgs, PS_LIST_TAIL, "-projection_cell", 0, "set projection cell", NULL); 352 psMetadataAddStr(addsummaryArgs, PS_LIST_TAIL, "-path_base", 0, "set summary path base", NULL); 353 325 354 // -pendingcleanupskyfile 326 355 psMetadata *pendingcleanupskyfileArgs = psMetadataAlloc(); … … 380 409 psMetadata *importrunArgs = psMetadataAlloc(); 381 410 psMetadataAddStr(importrunArgs, PS_LIST_TAIL, "-infile", 0, "import from this file (required)", NULL); 382 383 411 384 412 … … 415 443 PXOPT_ADD_MODE("-toscrubbedskyfile", "set skyfile as scrubbed", DIFFTOOL_MODE_TOSCRUBBEDSKYFILE, toscrubbedskyfileArgs); 416 444 PXOPT_ADD_MODE("-tofullskyfile", "set skyfile as full", DIFFTOOL_MODE_TOFULLSKYFILE, tofullskyfileArgs); 445 PXOPT_ADD_MODE("-tosummary", "show runs that can be summarized", DIFFTOOL_MODE_TOSUMMARY, tosummaryArgs); 446 PXOPT_ADD_MODE("-addsummary", "add entry to the summary table", DIFFTOOL_MODE_ADDSUMMARY, addsummaryArgs); 417 447 418 448 if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) { -
trunk/ippTools/src/stacktool.c
r28043 r28375 39 39 static bool addsumskyfileMode(pxConfig *config); 40 40 static bool sumskyfileMode(pxConfig *config); 41 static bool sassskyfileMode(pxConfig *config); 41 42 static bool revertsumskyfileMode(pxConfig *config); 43 static bool tosummaryMode(pxConfig *config); 44 static bool addsummaryMode(pxConfig *config); 42 45 static bool pendingcleanuprunMode(pxConfig *config); 43 46 static bool pendingcleanupskyfileMode(pxConfig *config); … … 75 78 MODECASE(STACKTOOL_MODE_ADDSUMSKYFILE, addsumskyfileMode); 76 79 MODECASE(STACKTOOL_MODE_SUMSKYFILE, sumskyfileMode); 80 MODECASE(STACKTOOL_MODE_SASSSKYFILE, sassskyfileMode); 77 81 MODECASE(STACKTOOL_MODE_REVERTSUMSKYFILE, revertsumskyfileMode); 82 MODECASE(STACKTOOL_MODE_TOSUMMARY, tosummaryMode); 83 MODECASE(STACKTOOL_MODE_ADDSUMMARY, addsummaryMode); 78 84 MODECASE(STACKTOOL_MODE_PENDINGCLEANUPRUN, pendingcleanuprunMode); 79 85 MODECASE(STACKTOOL_MODE_PENDINGCLEANUPSKYFILE, pendingcleanupskyfileMode); … … 102 108 exit(exit_status); 103 109 } 110 //stackAssociationRow *association = pxStackAssociationDefine(data_group,tess_id,filter,skycell_id); 111 stackAssociationRow *pxStackAssociationDefine(pxConfig *config, psS64 stack_id) { 112 psString select = pxDataGet("stacktool_associationdefine_select.sql"); 113 if (!select) { 114 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 115 return false; 116 } 117 118 psString idString = NULL; 119 psStringAppend(&idString, "%" PRId64, stack_id); 120 // Copy string to get around the issue with psStringSubstitute not believing 121 // that select is a psString. 122 psString rep = psStringCopy(select); 123 psFree(select); 124 select = rep; 125 psStringSubstitute(&select, idString, "@STACK_ID@"); 126 psFree(idString); 127 128 if (!p_psDBRunQuery(config->dbh, select)) { 129 psError(PS_ERR_UNKNOWN,false, "database error"); 130 psFree(select); 131 return(NULL); 132 } 133 psFree(select); 134 psArray *output = p_psDBFetchResult(config->dbh); 135 if (!output) { 136 psErrorCode err = psErrorCodeLast(); 137 switch (err) { 138 case PS_ERR_DB_CLIENT: 139 psError(PXTOOLS_ERR_SYS, false, "database error"); 140 case PS_ERR_DB_SERVER: 141 psError(PXTOOLS_ERR_PROG, false, "database error"); 142 default: 143 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 144 } 145 return(NULL); 146 } 147 if (psArrayLength(output) != 1) { 148 psWarning("stacktool: incorrect number of rows found"); 149 psFree(output); 150 return(NULL); 151 } 152 psMetadata *outrow = psMetadataAlloc(); 153 for (long i = 0; i < output->n; i++) { 154 psMetadata *row = output->data[i]; 155 156 printf("%" PRId64 " %s %s %s %s\n",psMetadataLookupS64(NULL,row,"sass_id"), 157 psMetadataLookupStr(NULL,row,"data_group"), 158 psMetadataLookupStr(NULL,row,"tess_id"), 159 psMetadataLookupStr(NULL,row,"filter"), 160 psMetadataLookupStr(NULL,row,"projection_cell")); 161 162 if (psMetadataLookupS64(NULL,row,"sass_id") == PS_MAX_S64) { 163 psMetadataAddS64(outrow,PS_LIST_TAIL,"sass_id",PS_META_REPLACE,"",0); 164 } 165 else { 166 psMetadataAddS64(outrow,PS_LIST_TAIL,"sass_id",PS_META_REPLACE,"",psMetadataLookupS64(NULL,row,"sass_id")); 167 } 168 psMetadataAddStr(outrow,PS_LIST_TAIL,"data_group",PS_META_REPLACE,"",psMetadataLookupStr(NULL,row,"data_group")); 169 psMetadataAddStr(outrow,PS_LIST_TAIL,"tess_id",PS_META_REPLACE,"",psMetadataLookupStr(NULL,row,"tess_id")); 170 psMetadataAddStr(outrow,PS_LIST_TAIL,"filter",PS_META_REPLACE,"",psMetadataLookupStr(NULL,row,"filter")); 171 psMetadataAddStr(outrow,PS_LIST_TAIL,"projection_cell",PS_META_REPLACE,"", 172 psMetadataLookupStr(NULL,row,"projection_cell")); 173 } 174 printf("%" PRId64 " %s %s %s %s\n",psMetadataLookupS64(NULL,outrow,"sass_id"), 175 psMetadataLookupStr(NULL,outrow,"data_group"), 176 psMetadataLookupStr(NULL,outrow,"tess_id"), 177 psMetadataLookupStr(NULL,outrow,"filter"), 178 psMetadataLookupStr(NULL,outrow,"projection_cell")); 179 180 181 psFree(output); 182 stackAssociationRow *sassRow = stackAssociationObjectFromMetadata(outrow); 183 psFree(outrow); 184 return(sassRow); 185 } 186 187 188 189 104 190 105 191 … … 395 481 psFree(run); 396 482 483 //CZW Add an association entry here. 484 // Define the requested association, and insert it if it doesn't already exist 485 stackAssociationRow *association = pxStackAssociationDefine(config,stack_id); 486 psS64 sass_id; 487 if (!association->sass_id) { 488 psTrace("stacktool.association",2,"No required Association found. Adding."); 489 490 if (!stackAssociationInsertObject(config->dbh,association)) { 491 if (!psDBRollback(config->dbh)) { 492 psError(PS_ERR_UNKNOWN, false, "database error"); 493 } 494 psError(PS_ERR_UNKNOWN, false, "database error"); 495 psFree(output); 496 psFree(run); 497 psFree(insert); 498 psFree(list); 499 psFree(association); 500 if (!psDBRollback(config->dbh)) { 501 psError(PS_ERR_UNKNOWN, false, "database error"); 502 } 503 return(false); 504 } 505 sass_id = psDBLastInsertID(config->dbh); 506 association->sass_id = sass_id; 507 } 508 // Insert the map entry for this row. 509 stackAssociationMapRow *maprow = stackAssociationMapRowAlloc(sass_id,stack_id); 510 if (!stackAssociationMapInsertObject(config->dbh,maprow)) { 511 if (!psDBRollback(config->dbh)) { 512 psError(PS_ERR_UNKNOWN, false, "database error"); 513 } 514 psError(PS_ERR_UNKNOWN, false, "database error"); 515 psFree(output); 516 psFree(run); 517 psFree(insert); 518 psFree(list); 519 psFree(association); 520 if (!psDBRollback(config->dbh)) { 521 psError(PS_ERR_UNKNOWN, false, "database error"); 522 } 523 return(false); 524 } 525 526 397 527 // Create a suitable insertion query for this run 398 528 psString thisInsert = psStringCopy(insert); … … 552 682 run->stack_id = psDBLastInsertID(config->dbh); 553 683 684 //CZW Add an association entry here. 685 554 686 // insert the stackInputSkyfile rows 555 687 psListIterator *iter = psListIteratorAlloc(warp_ids->data.list, 0, false); … … 603 735 #endif 604 736 psMetadata *where = psMetadataAlloc(); 605 PXOPT_COPY_S64(config->args, where, "-stack_id", "stack_id", "=="); 606 PXOPT_COPY_STR(config->args, where, "-label", "label", "=="); 607 PXOPT_COPY_STR(config->args, where, "-state", "state", "=="); 737 PXOPT_COPY_S64(config->args, where, "-stack_id", "stackRun.stack_id", "=="); 738 PXOPT_COPY_STR(config->args, where, "-label", "stackRun.label", "=="); 739 PXOPT_COPY_STR(config->args, where, "-state", "stackRun.state", "=="); 740 PXOPT_COPY_STR(config->args, where, "-sass_id", "stackAssociationMap.sass_id", "=="); 608 741 if (!psListLength(where->list)) { 609 742 psFree(where); … … 612 745 } 613 746 747 //CZW join against stackAssociationMap 614 748 psString query = psStringCopy("UPDATE stackRun"); 615 749 … … 1038 1172 } 1039 1173 1040 1041 static bool revertsumskyfileMode(pxConfig *config) 1174 static bool sassskyfileMode(pxConfig *config) 1042 1175 { 1043 1176 PS_ASSERT_PTR_NON_NULL(config, false); 1044 1177 1045 1178 psMetadata *where = psMetadataAlloc(); 1046 PXOPT_COPY_S64(config->args, where, "-stack_id", "stackSumSkyfile.stack_id", "=="); 1047 pxAddLabelSearchArgs(config, where, "-label", "stackRun.label", "=="); 1048 PXOPT_COPY_S16(config->args, where, "-fault", "stackSumSkyfile.fault", "=="); 1049 1050 if (!psListLength(where->list) && !psMetadataLookupBool(NULL, config->args, "-all")) { 1051 psFree(where); 1052 psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required"); 1053 return false; 1054 } 1055 1056 // Delete product 1057 psString delete = pxDataGet("stacktool_revertsumskyfile_delete.sql"); 1058 if (!delete) { 1179 PXOPT_COPY_S64(config->args, where, "-sass_id", "stackAssociation.sass_id", "=="); 1180 PXOPT_COPY_STR(config->args, where, "-tess_id", "stackAssociation.tess_id", "=="); 1181 PXOPT_COPY_STR(config->args, where, "-projection_cell", "stackAssociation.projection_cell", "=="); 1182 PXOPT_COPY_STR(config->args, where, "-filter", "stackAssociation.filter", "LIKE"); 1183 PXOPT_COPY_STR(config->args, where, "-data_group", "stackAssociation.data_group", "LIKE"); 1184 1185 // The following three selectors are incompatible with the sql so omit them 1186 // PXOPT_COPY_S64(config->args, where, "-warp_id", "warpRun.warp_id", "=="); 1187 // PXOPT_COPY_S64(config->args, where, "-exp_id", "rawExp.exp_id", "=="); 1188 // PXOPT_COPY_STR(config->args, where, "-exp_name", "rawExp.exp_name", "=="); 1189 1190 PXOPT_LOOKUP_BOOL(all, config->args, "-all", false); 1191 1192 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1193 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1194 1195 psString query = pxDataGet("stacktool_sassskyfile.sql"); 1196 if (!query) { 1059 1197 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1060 1198 return false; … … 1063 1201 if (psListLength(where->list)) { 1064 1202 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1065 psStringAppend(& delete, " AND%s", whereClause);1203 psStringAppend(&query, " WHERE %s", whereClause); 1066 1204 psFree(whereClause); 1067 } 1068 1069 if (!p_psDBRunQuery(config->dbh, delete)) { 1070 psError(PS_ERR_UNKNOWN, false, "database error"); 1071 psFree(delete); 1072 psFree(where); 1073 return false; 1074 } 1075 psFree(delete); 1076 1077 int numRows = psDBAffectedRows(config->dbh); // Number of row affected 1078 psLogMsg("stacktool", PS_LOG_INFO, "Deleted %d rows", numRows); 1079 1080 psFree(where); 1081 1082 return true; 1083 } 1084 1085 1086 static bool setstackRunState(pxConfig *config, psS64 stack_id, const char *state) 1087 { 1088 PS_ASSERT_PTR_NON_NULL(state, false); 1089 1090 // check that state is a valid string value 1091 if (!pxIsValidState(state)) { 1092 psError(PS_ERR_UNKNOWN, false, "invalid stackRun state: %s", state); 1093 return false; 1094 } 1095 1096 char *query = "UPDATE stackRun SET state = '%s' WHERE stack_id = %"PRId64; 1097 if (!p_psDBRunQueryF(config->dbh, query, state, stack_id)) { 1098 psError(PS_ERR_UNKNOWN, false, 1099 "failed to change state for stack_id %"PRId64, stack_id); 1100 return false; 1101 } 1102 1103 return true; 1104 } 1105 1106 #ifdef notdef 1107 static bool setstackRunStateByLabel(pxConfig *config, const char *label, const char *state) 1108 { 1109 PS_ASSERT_PTR_NON_NULL(state, false); 1110 1111 // check that state is a valid string value 1112 if (!pxIsValidState(state)) { 1113 psError(PS_ERR_UNKNOWN, false, "invalid stackRun state: %s", state); 1114 return false; 1115 } 1116 1117 char *query = "UPDATE stackRun SET state = '%s' WHERE label = '%s'"; 1118 if (!p_psDBRunQueryF(config->dbh, query, state, label)) { 1119 psError(PS_ERR_UNKNOWN, false, 1120 "failed to change state for label %s", label); 1121 return false; 1122 } 1123 1124 return true; 1125 } 1126 #endif 1127 1128 static bool pendingcleanuprunMode(pxConfig *config) 1129 { 1130 PS_ASSERT_PTR_NON_NULL(config, NULL); 1131 1132 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1133 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1134 1135 psMetadata *where = psMetadataAlloc(); 1136 pxAddLabelSearchArgs (config, where, "-label", "stackRun.label", "=="); 1137 1138 psString query = pxDataGet("stacktool_pendingcleanuprun.sql"); 1139 if (!query) { 1140 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1141 return false; 1142 } 1143 1144 if (where && psListLength(where->list)) { 1145 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1146 psStringAppend(&query, " AND %s", whereClause); 1147 psFree(whereClause); 1148 } 1205 } else if (!all) { 1206 psError(PXTOOLS_ERR_CONFIG, true, "search parameters or -all are required"); 1207 return false; 1208 } 1209 1149 1210 psFree(where); 1150 1211 … … 1165 1226 psArray *output = p_psDBFetchResult(config->dbh); 1166 1227 if (!output) { 1167 psError(PS_ERR_UNKNOWN, false, "database error"); 1228 psErrorCode err = psErrorCodeLast(); 1229 switch (err) { 1230 case PS_ERR_DB_CLIENT: 1231 psError(PXTOOLS_ERR_SYS, false, "database error"); 1232 case PS_ERR_DB_SERVER: 1233 psError(PXTOOLS_ERR_PROG, false, "database error"); 1234 default: 1235 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 1236 } 1237 1168 1238 return false; 1169 1239 } … … 1174 1244 } 1175 1245 1246 if (psArrayLength(output)) { 1247 if (!ippdbPrintMetadatas(stdout, output, "stackSumSkyfile", !simple)) { 1248 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1249 psFree(output); 1250 return false; 1251 } 1252 } 1253 1254 psFree(output); 1255 1256 return true; 1257 } 1258 1259 1260 static bool revertsumskyfileMode(pxConfig *config) 1261 { 1262 PS_ASSERT_PTR_NON_NULL(config, false); 1263 1264 psMetadata *where = psMetadataAlloc(); 1265 PXOPT_COPY_S64(config->args, where, "-stack_id", "stackSumSkyfile.stack_id", "=="); 1266 pxAddLabelSearchArgs(config, where, "-label", "stackRun.label", "=="); 1267 PXOPT_COPY_S16(config->args, where, "-fault", "stackSumSkyfile.fault", "=="); 1268 1269 if (!psListLength(where->list) && !psMetadataLookupBool(NULL, config->args, "-all")) { 1270 psFree(where); 1271 psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required"); 1272 return false; 1273 } 1274 1275 // Delete product 1276 psString delete = pxDataGet("stacktool_revertsumskyfile_delete.sql"); 1277 if (!delete) { 1278 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1279 return false; 1280 } 1281 1282 if (psListLength(where->list)) { 1283 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1284 psStringAppend(&delete, " AND %s", whereClause); 1285 psFree(whereClause); 1286 } 1287 1288 if (!p_psDBRunQuery(config->dbh, delete)) { 1289 psError(PS_ERR_UNKNOWN, false, "database error"); 1290 psFree(delete); 1291 psFree(where); 1292 return false; 1293 } 1294 psFree(delete); 1295 1296 int numRows = psDBAffectedRows(config->dbh); // Number of row affected 1297 psLogMsg("stacktool", PS_LOG_INFO, "Deleted %d rows", numRows); 1298 1299 psFree(where); 1300 1301 return true; 1302 } 1303 1304 1305 static bool setstackRunState(pxConfig *config, psS64 stack_id, const char *state) 1306 { 1307 PS_ASSERT_PTR_NON_NULL(state, false); 1308 1309 // check that state is a valid string value 1310 if (!pxIsValidState(state)) { 1311 psError(PS_ERR_UNKNOWN, false, "invalid stackRun state: %s", state); 1312 return false; 1313 } 1314 1315 char *query = "UPDATE stackRun SET state = '%s' WHERE stack_id = %"PRId64; 1316 if (!p_psDBRunQueryF(config->dbh, query, state, stack_id)) { 1317 psError(PS_ERR_UNKNOWN, false, 1318 "failed to change state for stack_id %"PRId64, stack_id); 1319 return false; 1320 } 1321 1322 return true; 1323 } 1324 1325 #ifdef notdef 1326 static bool setstackRunStateByLabel(pxConfig *config, const char *label, const char *state) 1327 { 1328 PS_ASSERT_PTR_NON_NULL(state, false); 1329 1330 // check that state is a valid string value 1331 if (!pxIsValidState(state)) { 1332 psError(PS_ERR_UNKNOWN, false, "invalid stackRun state: %s", state); 1333 return false; 1334 } 1335 1336 char *query = "UPDATE stackRun SET state = '%s' WHERE label = '%s'"; 1337 if (!p_psDBRunQueryF(config->dbh, query, state, label)) { 1338 psError(PS_ERR_UNKNOWN, false, 1339 "failed to change state for label %s", label); 1340 return false; 1341 } 1342 1343 return true; 1344 } 1345 #endif 1346 static bool tosummaryMode(pxConfig *config) { 1347 PS_ASSERT_PTR_NON_NULL(config, NULL); 1348 1349 psMetadata *where = psMetadataAlloc(); 1350 PXOPT_COPY_S64(config->args, where, "-stack_id", "stackSumSkyfile.warp_id", "=="); 1351 PXOPT_COPY_S64(config->args, where, "-sass_id", "stackAssociationMap.sass_id", "=="); 1352 PXOPT_COPY_STR(config->args, where, "-tess_id", "stackSumSkyfile.tess_id", "=="); 1353 PXOPT_COPY_STR(config->args, where, "-state", "stackRun.state", "=="); 1354 PXOPT_COPY_STR(config->args, where, "-filter", "stackRun.filter", "LIKE"); 1355 pxAddLabelSearchArgs (config, where, "-label", "stackRun.label", "LIKE"); 1356 pxAddLabelSearchArgs (config, where, "-data_group", "stackRun.data_group", "LIKE"); 1357 1358 PXOPT_LOOKUP_BOOL(all, config->args, "-all", false); 1359 1360 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1361 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1362 1363 // find all rawImfiles matching the default query 1364 psString query = pxDataGet("stacktool_tosummary.sql"); 1365 if (!query) { 1366 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1367 return false; 1368 } 1369 1370 // generate where strings for arguments that require extra processing 1371 // beyond PXOPT_COPY* 1372 if (psListLength(where->list)) { 1373 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1374 psStringAppend(&query, " AND %s", whereClause); 1375 psFree(whereClause); 1376 } else if (!all) { 1377 psError(PXTOOLS_ERR_CONFIG, true, "search parameters or -all are required"); 1378 return false; 1379 } 1380 1381 psFree(where); 1382 1383 // treat limit == 0 as "no limit" 1384 if (limit) { 1385 psString limitString = psDBGenerateLimitSQL(limit); 1386 psStringAppend(&query, " %s", limitString); 1387 psFree(limitString); 1388 } 1389 1390 if (!p_psDBRunQuery(config->dbh, query)) { 1391 psError(PS_ERR_UNKNOWN, false, "database error"); 1392 psFree(query); 1393 return false; 1394 } 1395 psFree(query); 1396 1397 psArray *output = p_psDBFetchResult(config->dbh); 1398 if (!output) { 1399 psErrorCode err = psErrorCodeLast(); 1400 switch (err) { 1401 case PS_ERR_DB_CLIENT: 1402 psError(PXTOOLS_ERR_SYS, false, "database error"); 1403 case PS_ERR_DB_SERVER: 1404 psError(PXTOOLS_ERR_PROG, false, "database error"); 1405 default: 1406 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 1407 } 1408 1409 return false; 1410 } 1411 if (!psArrayLength(output)) { 1412 psTrace("stacktool", PS_LOG_INFO, "no rows found"); 1413 psFree(output); 1414 return true; 1415 } 1416 1417 if (psArrayLength(output)) { 1176 1418 // negative simple so the default is true 1177 if (!ippdbPrintMetadatas(stdout, output, "stackPendingCleanupRun", !simple)) { 1178 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1179 psFree(output); 1180 return false; 1181 } 1182 1183 psFree(output); 1184 1185 return true; 1186 } 1187 1188 static bool pendingcleanupskyfileMode(pxConfig *config) 1419 if (!ippdbPrintMetadatas(stdout, output, "stackRun", !simple)) { 1420 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1421 psFree(output); 1422 return false; 1423 } 1424 } 1425 1426 psFree(output); 1427 return(true); 1428 } 1429 static bool addsummaryMode(pxConfig *config) { 1430 PS_ASSERT_PTR_NON_NULL(config, NULL); 1431 1432 PXOPT_LOOKUP_S64(sass_id, config->args, "-sass_id", true, false); 1433 PXOPT_LOOKUP_STR(projection_cell, config->args, "-projection_cell", true, false); 1434 PXOPT_LOOKUP_STR(path_base, config->args, "-path_base", true, false); 1435 1436 psString query = pxDataGet("stacktool_addsummary.sql"); 1437 if (!query) { 1438 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1439 return(false); 1440 } 1441 if (!p_psDBRunQueryF(config->dbh, query, sass_id, projection_cell, path_base)) { 1442 psError(PS_ERR_UNKNOWN, false, "database error"); 1443 psFree(query); 1444 return(false); 1445 } 1446 psS64 numUpdated = psDBAffectedRows(config->dbh); 1447 1448 if (numUpdated != 1) { 1449 psError(PS_ERR_UNKNOWN, false, "should have affected 1 row"); 1450 psFree(query); 1451 return false; 1452 } 1453 1454 psFree(query); 1455 1456 // Print anything here? 1457 1458 return(true); 1459 } 1460 1461 static bool pendingcleanuprunMode(pxConfig *config) 1189 1462 { 1190 1463 PS_ASSERT_PTR_NON_NULL(config, NULL); 1191 1464 1192 PXOPT_LOOKUP_S64(stack_id, config->args, "-stack_id", false, false);1193 1465 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1194 1466 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1195 1467 1196 1468 psMetadata *where = psMetadataAlloc(); 1197 if (stack_id) {1198 PXOPT_COPY_S64(config->args, where, "-stack_id", "stack_id", "==");1199 }1469 PXOPT_COPY_S64(config->args, where, "-stack_id", "stackRun.stack_id", "=="); 1470 PXOPT_COPY_S64(config->args, where, "-sass_id", "stackAssociationMap.sass_id", "=="); 1471 1200 1472 pxAddLabelSearchArgs (config, where, "-label", "stackRun.label", "=="); 1201 1473 1202 psString query = pxDataGet("stacktool_pendingcleanup skyfile.sql");1474 psString query = pxDataGet("stacktool_pendingcleanuprun.sql"); 1203 1475 if (!query) { 1204 1476 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); … … 1239 1511 1240 1512 // negative simple so the default is true 1241 if (!ippdbPrintMetadatas(stdout, output, "stackPendingCleanup Skyfile", !simple)) {1513 if (!ippdbPrintMetadatas(stdout, output, "stackPendingCleanupRun", !simple)) { 1242 1514 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1243 1515 psFree(output); … … 1250 1522 } 1251 1523 1252 1253 static bool donecleanupMode(pxConfig *config) 1524 static bool pendingcleanupskyfileMode(pxConfig *config) 1254 1525 { 1255 1526 PS_ASSERT_PTR_NON_NULL(config, NULL); 1256 1527 1528 PXOPT_LOOKUP_S64(stack_id, config->args, "-stack_id", false, false); 1257 1529 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1258 1530 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1259 1531 1260 1532 psMetadata *where = psMetadataAlloc(); 1261 PXOPT_COPY_STR(config->args, where, "-label", "label", "=="); 1262 1263 psString query = pxDataGet("stacktool_donecleanup.sql"); 1533 if (stack_id) { 1534 PXOPT_COPY_S64(config->args, where, "-stack_id", "stack_id", "=="); 1535 } 1536 pxAddLabelSearchArgs (config, where, "-label", "stackRun.label", "=="); 1537 1538 psString query = pxDataGet("stacktool_pendingcleanupskyfile.sql"); 1264 1539 if (!query) { 1265 1540 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); … … 1300 1575 1301 1576 // negative simple so the default is true 1577 if (!ippdbPrintMetadatas(stdout, output, "stackPendingCleanupSkyfile", !simple)) { 1578 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1579 psFree(output); 1580 return false; 1581 } 1582 1583 psFree(output); 1584 1585 return true; 1586 } 1587 1588 1589 static bool donecleanupMode(pxConfig *config) 1590 { 1591 PS_ASSERT_PTR_NON_NULL(config, NULL); 1592 1593 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1594 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1595 1596 psMetadata *where = psMetadataAlloc(); 1597 PXOPT_COPY_STR(config->args, where, "-label", "label", "=="); 1598 PXOPT_COPY_STR(config->args, where, "-sass_id", "sass_id", "=="); 1599 1600 psString query = pxDataGet("stacktool_donecleanup.sql"); 1601 if (!query) { 1602 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1603 return false; 1604 } 1605 1606 if (where && psListLength(where->list)) { 1607 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1608 psStringAppend(&query, " AND %s", whereClause); 1609 psFree(whereClause); 1610 } 1611 psFree(where); 1612 1613 // treat limit == 0 as "no limit" 1614 if (limit) { 1615 psString limitString = psDBGenerateLimitSQL(limit); 1616 psStringAppend(&query, " %s", limitString); 1617 psFree(limitString); 1618 } 1619 1620 if (!p_psDBRunQuery(config->dbh, query)) { 1621 psError(PS_ERR_UNKNOWN, false, "database error"); 1622 psFree(query); 1623 return false; 1624 } 1625 psFree(query); 1626 1627 psArray *output = p_psDBFetchResult(config->dbh); 1628 if (!output) { 1629 psError(PS_ERR_UNKNOWN, false, "database error"); 1630 return false; 1631 } 1632 if (!psArrayLength(output)) { 1633 psTrace("stacktool", PS_LOG_INFO, "no rows found"); 1634 psFree(output); 1635 return true; 1636 } 1637 1638 // negative simple so the default is true 1302 1639 if (!ippdbPrintMetadatas(stdout, output, "stackDoneCleanup", !simple)) { 1303 1640 psError(PS_ERR_UNKNOWN, false, "failed to print array"); … … 1329 1666 } 1330 1667 1668 //CZW I have not added sass information to the export/import run modes yet. 1331 1669 bool exportrunMode(pxConfig *config) 1332 1670 { -
trunk/ippTools/src/stacktool.h
r23310 r28375 33 33 STACKTOOL_MODE_ADDSUMSKYFILE, 34 34 STACKTOOL_MODE_SUMSKYFILE, 35 STACKTOOL_MODE_SASSSKYFILE, 35 36 STACKTOOL_MODE_REVERTSUMSKYFILE, 37 STACKTOOL_MODE_TOSUMMARY, 38 STACKTOOL_MODE_ADDSUMMARY, 36 39 STACKTOOL_MODE_PENDINGCLEANUPRUN, 37 40 STACKTOOL_MODE_PENDINGCLEANUPSKYFILE, -
trunk/ippTools/src/stacktoolConfig.c
r28043 r28375 197 197 psMetadataAddBool(sumskyfileArgs, PS_LIST_TAIL, "-all", 0, "enable search without arguments", false); 198 198 199 // -sassskyfile 200 psMetadata *sassskyfileArgs = psMetadataAlloc(); 201 psMetadataAddS64(sassskyfileArgs, PS_LIST_TAIL, "-sass_id", 0, "search by stack association ID", 0); 202 psMetadataAddStr(sassskyfileArgs, PS_LIST_TAIL, "-tess_id", 0, "search by tess ID", 0); 203 psMetadataAddStr(sassskyfileArgs, PS_LIST_TAIL, "-projection_cell", 0, "search by projection cell", 0); 204 205 psMetadataAddStr(sassskyfileArgs, PS_LIST_TAIL, "-data_group", 0, "search by stackAssociation.data_group (LIKE comparison)", NULL); 206 psMetadataAddStr(sassskyfileArgs, PS_LIST_TAIL, "-filter", 0, "search by filter (LIKE comparison)", NULL); 207 psMetadataAddU64(sassskyfileArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 208 psMetadataAddBool(sassskyfileArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 209 psMetadataAddBool(sassskyfileArgs, PS_LIST_TAIL, "-all", 0, "enable search without arguments", false); 210 199 211 // -revertsumskyfile 200 212 psMetadata *revertsumskyfileArgs= psMetadataAlloc(); … … 204 216 psMetadataAddBool(revertsumskyfileArgs, PS_LIST_TAIL, "-all", 0, "allow no search terms", 0); 205 217 218 // -tosummary 219 psMetadata *tosummaryArgs = psMetadataAlloc(); 220 psMetadataAddS64(tosummaryArgs, PS_LIST_TAIL, "-stack_id", 0, "search by stack ID", 0); 221 psMetadataAddS64(tosummaryArgs, PS_LIST_TAIL, "-sass_id", 0, "search by stack association ID", 0); 222 psMetadataAddStr(tosummaryArgs, PS_LIST_TAIL, "-tess_id", 0, "search by tessellation ID", NULL); 223 psMetadataAddStr(tosummaryArgs, PS_LIST_TAIL, "-state", 0, "search by state", NULL); 224 psMetadataAddStr(tosummaryArgs, PS_LIST_TAIL, "-filter", 0, "search by filter", NULL); 225 psMetadataAddStr(tosummaryArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by stackRun label (LIKE comparison)", NULL); 226 psMetadataAddStr(tosummaryArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "search by stackRun data_group (LIKE comparison)", NULL); 227 psMetadataAddStr(tosummaryArgs, PS_LIST_TAIL, "-dist_group", PS_META_DUPLICATE_OK, "search by stackRun dist_group (LIKE comparison)", NULL); 228 229 psMetadataAddBool(tosummaryArgs, PS_LIST_TAIL, "-all", 0, "search without arguments", false); 230 psMetadataAddU64(tosummaryArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 231 psMetadataAddBool(tosummaryArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 232 233 // -addsummary 234 psMetadata *addsummaryArgs = psMetadataAlloc(); 235 psMetadataAddS64(addsummaryArgs, PS_LIST_TAIL, "-sass_id", 0, "set stack Association ID", 0); 236 psMetadataAddStr(addsummaryArgs, PS_LIST_TAIL, "-projection_cell", 0, "set projection cell", NULL); 237 psMetadataAddStr(addsummaryArgs, PS_LIST_TAIL, "-path_base", 0, "set summary path base", NULL); 238 206 239 // -pendingcleanuprun 207 240 psMetadata *pendingcleanuprunArgs = psMetadataAlloc(); … … 252 285 PXOPT_ADD_MODE("-addsumskyfile", "", STACKTOOL_MODE_ADDSUMSKYFILE, addsumskyfileArgs); 253 286 PXOPT_ADD_MODE("-sumskyfile", "list results of stackRun", STACKTOOL_MODE_SUMSKYFILE, sumskyfileArgs); 287 PXOPT_ADD_MODE("-sassskyfile", "list results of stackAssociation", STACKTOOL_MODE_SASSSKYFILE, sassskyfileArgs); 254 288 PXOPT_ADD_MODE("-revertsumskyfile","", STACKTOOL_MODE_REVERTSUMSKYFILE, revertsumskyfileArgs); 255 289 PXOPT_ADD_MODE("-pendingcleanuprun", "show runs that need to be cleaned up", STACKTOOL_MODE_PENDINGCLEANUPRUN, pendingcleanuprunArgs); … … 257 291 PXOPT_ADD_MODE("-donecleanup", "show runs that have been cleaned", STACKTOOL_MODE_DONECLEANUP, donecleanupArgs); 258 292 PXOPT_ADD_MODE("-updatesumskyfile", "update fault code for sumskyfile", STACKTOOL_MODE_UPDATESUMSKYFILE, updatesumskyfileArgs); 293 PXOPT_ADD_MODE("-tosummary", "show runs that can be summarized", STACKTOOL_MODE_TOSUMMARY, tosummaryArgs); 294 PXOPT_ADD_MODE("-addsummary", "add entry to the summary table", STACKTOOL_MODE_ADDSUMMARY, addsummaryArgs); 259 295 PXOPT_ADD_MODE("-exportrun", "export run for import on other database", STACKTOOL_MODE_EXPORTRUN, exportrunArgs); 260 296 PXOPT_ADD_MODE("-importrun", "import run from metadata file", STACKTOOL_MODE_IMPORTRUN, importrunArgs); -
trunk/ippTools/src/warptool.c
r28202 r28375 48 48 static bool maskedMode(pxConfig *config); 49 49 static bool unblockMode(pxConfig *config); 50 static bool tosummaryMode(pxConfig *config); 51 static bool addsummaryMode(pxConfig *config); 50 52 static bool pendingcleanuprunMode(pxConfig *config); 51 53 static bool pendingcleanupwarpMode(pxConfig *config); … … 101 103 MODECASE(WARPTOOL_MODE_MASKED, maskedMode); 102 104 MODECASE(WARPTOOL_MODE_UNBLOCK, unblockMode); 105 MODECASE(WARPTOOL_MODE_TOSUMMARY, tosummaryMode); 106 MODECASE(WARPTOOL_MODE_ADDSUMMARY, addsummaryMode); 103 107 MODECASE(WARPTOOL_MODE_PENDINGCLEANUPRUN, pendingcleanuprunMode); 104 108 MODECASE(WARPTOOL_MODE_PENDINGCLEANUPSKYFILE, pendingcleanupwarpMode); … … 1548 1552 } 1549 1553 1554 static bool tosummaryMode(pxConfig *config) { 1555 PS_ASSERT_PTR_NON_NULL(config, NULL); 1556 1557 psMetadata *where = psMetadataAlloc(); 1558 PXOPT_COPY_S64(config->args, where, "-warp_id", "warpSkyfile.warp_id", "=="); 1559 PXOPT_COPY_STR(config->args, where, "-tess_id", "warpSkyfile.tess_id", "=="); 1560 PXOPT_COPY_STR(config->args, where, "-state", "warpRun.state", "=="); 1561 PXOPT_COPY_S64(config->args, where, "-exp_id", "rawExp.exp_id", "=="); 1562 PXOPT_COPY_STR(config->args, where, "-exp_name", "rawExp.exp_name", "=="); 1563 PXOPT_COPY_S64(config->args, where, "-fake_id", "fakeRun.fake_id", "=="); 1564 PXOPT_COPY_TIME(config->args, where, "-dateobs_begin", "rawExp.dateobs", ">="); 1565 PXOPT_COPY_TIME(config->args, where, "-dateobs_end", "rawExp.dateobs", "<="); 1566 PXOPT_COPY_STR(config->args, where, "-filter", "rawExp.filter", "LIKE"); 1567 PXOPT_COPY_S64(config->args, where, "-magicked", "warpSkyfile.magicked", "=="); 1568 pxAddLabelSearchArgs (config, where, "-label", "warpRun.label", "LIKE"); 1569 pxAddLabelSearchArgs (config, where, "-data_group", "warpRun.data_group", "LIKE"); 1570 1571 PXOPT_LOOKUP_BOOL(all, config->args, "-all", false); 1572 1573 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1574 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1575 1576 // find all rawImfiles matching the default query 1577 psString query = pxDataGet("warptool_tosummary.sql"); 1578 if (!query) { 1579 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1580 return false; 1581 } 1582 1583 // generate where strings for arguments that require extra processing 1584 // beyond PXOPT_COPY* 1585 psString where2 = NULL; 1586 if (!pxmagicAddWhere(config, &where2, "warpSkyfile")) { 1587 psError(psErrorCodeLast(), false, "pxMagicAddWhere failed"); 1588 return false; 1589 } 1590 1591 if (psListLength(where->list)) { 1592 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1593 psStringAppend(&query, " AND %s", whereClause); 1594 psFree(whereClause); 1595 } else if (!all && !where2) { 1596 psError(PXTOOLS_ERR_CONFIG, true, "search parameters or -all are required"); 1597 return false; 1598 } 1599 1600 if (where2) { 1601 psStringAppend(&query, " %s", where2); 1602 } 1603 psFree(where); 1604 1605 // treat limit == 0 as "no limit" 1606 if (limit) { 1607 psString limitString = psDBGenerateLimitSQL(limit); 1608 psStringAppend(&query, " %s", limitString); 1609 psFree(limitString); 1610 } 1611 1612 if (!p_psDBRunQuery(config->dbh, query)) { 1613 psError(PS_ERR_UNKNOWN, false, "database error"); 1614 psFree(query); 1615 return false; 1616 } 1617 psFree(query); 1618 1619 psArray *output = p_psDBFetchResult(config->dbh); 1620 if (!output) { 1621 psErrorCode err = psErrorCodeLast(); 1622 switch (err) { 1623 case PS_ERR_DB_CLIENT: 1624 psError(PXTOOLS_ERR_SYS, false, "database error"); 1625 case PS_ERR_DB_SERVER: 1626 psError(PXTOOLS_ERR_PROG, false, "database error"); 1627 default: 1628 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 1629 } 1630 1631 return false; 1632 } 1633 if (!psArrayLength(output)) { 1634 psTrace("warptool", PS_LOG_INFO, "no rows found"); 1635 psFree(output); 1636 return true; 1637 } 1638 1639 if (psArrayLength(output)) { 1640 // negative simple so the default is true 1641 if (!ippdbPrintMetadatas(stdout, output, "warpRun", !simple)) { 1642 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1643 psFree(output); 1644 return false; 1645 } 1646 } 1647 1648 psFree(output); 1649 return(true); 1650 } 1651 static bool addsummaryMode(pxConfig *config) { 1652 PS_ASSERT_PTR_NON_NULL(config, NULL); 1653 1654 PXOPT_LOOKUP_S64(warp_id, config->args, "-warp_id", true, false); 1655 PXOPT_LOOKUP_STR(projection_cell, config->args, "-projection_cell", true, false); 1656 PXOPT_LOOKUP_STR(path_base, config->args, "-path_base", true, false); 1657 1658 psString query = pxDataGet("warptool_addsummary.sql"); 1659 if (!query) { 1660 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1661 return(false); 1662 } 1663 if (!p_psDBRunQueryF(config->dbh, query, warp_id, projection_cell, path_base)) { 1664 psError(PS_ERR_UNKNOWN, false, "database error"); 1665 psFree(query); 1666 return(false); 1667 } 1668 psS64 numUpdated = psDBAffectedRows(config->dbh); 1669 1670 if (numUpdated != 1) { 1671 psError(PS_ERR_UNKNOWN, false, "should have affected 1 row"); 1672 psFree(query); 1673 return false; 1674 } 1675 1676 psFree(query); 1677 1678 // Print anything here? 1679 1680 return(true); 1681 } 1682 1550 1683 static bool pendingcleanuprunMode(pxConfig *config) 1551 1684 { -
trunk/ippTools/src/warptool.h
r27737 r28375 44 44 WARPTOOL_MODE_MASKED, 45 45 WARPTOOL_MODE_UNBLOCK, 46 WARPTOOL_MODE_TOSUMMARY, 47 WARPTOOL_MODE_ADDSUMMARY, 46 48 WARPTOOL_MODE_PENDINGCLEANUPRUN, 47 49 WARPTOOL_MODE_PENDINGCLEANUPSKYFILE, -
trunk/ippTools/src/warptoolConfig.c
r28054 r28375 321 321 psMetadataAddStr(unblockArgs, PS_LIST_TAIL, "-label", 0, "name of a label to unmask (required)", NULL); 322 322 323 // -tosummary 324 psMetadata *tosummaryArgs = psMetadataAlloc(); 325 psMetadataAddS64(tosummaryArgs, PS_LIST_TAIL, "-warp_id", 0, "search by warp ID", 0); 326 psMetadataAddStr(tosummaryArgs, PS_LIST_TAIL, "-tess_id", 0, "search by tessellation ID", NULL); 327 psMetadataAddStr(tosummaryArgs, PS_LIST_TAIL, "-state", 0, "search by state", NULL); 328 psMetadataAddS64(tosummaryArgs, PS_LIST_TAIL, "-exp_id", 0, "search by exposure tag", 0); 329 psMetadataAddStr(tosummaryArgs, PS_LIST_TAIL, "-exp_name", 0, "search by exposure tag", 0); 330 psMetadataAddS64(tosummaryArgs, PS_LIST_TAIL, "-fake_id", 0, "search by phase 3 version of exposure tag", 0); 331 psMetadataAddTime(tosummaryArgs, PS_LIST_TAIL, "-dateobs_begin", 0, "search for exposures by time (>=)", NULL); 332 psMetadataAddTime(tosummaryArgs, PS_LIST_TAIL, "-dateobs_end", 0, "search for exposures by time (<=)", NULL); 333 psMetadataAddStr(tosummaryArgs, PS_LIST_TAIL, "-filter", 0, "search for exposures by filter", NULL); 334 psMetadataAddS64(tosummaryArgs, PS_LIST_TAIL, "-magicked", 0, "search by magic id", 0); 335 psMetadataAddStr(tosummaryArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by warpRun label", NULL); 336 psMetadataAddStr(tosummaryArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "search by warpRun data_group", NULL); 337 psMetadataAddStr(tosummaryArgs, PS_LIST_TAIL, "-dist_group", PS_META_DUPLICATE_OK, "search by warpRun dist_group", NULL); 338 psMetadataAddBool(tosummaryArgs, PS_LIST_TAIL, "-destreaked", 0, "search for runs that have been destreaked", false); 339 psMetadataAddBool(tosummaryArgs, PS_LIST_TAIL, "-not_destreaked", 0, "search for runs that have not been destreaked", false); 340 341 psMetadataAddBool(tosummaryArgs, PS_LIST_TAIL, "-all", 0, "search without arguments", false); 342 psMetadataAddU64(tosummaryArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 343 psMetadataAddBool(tosummaryArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 344 345 // -addsummary 346 psMetadata *addsummaryArgs = psMetadataAlloc(); 347 psMetadataAddS64(addsummaryArgs, PS_LIST_TAIL, "-warp_id", 0, "set warp ID", 0); 348 psMetadataAddStr(addsummaryArgs, PS_LIST_TAIL, "-projection_cell", 0, "set projection cell", NULL); 349 psMetadataAddStr(addsummaryArgs, PS_LIST_TAIL, "-path_base", 0, "set summary path base", NULL); 350 323 351 // -pendingcleanuprun 324 352 psMetadata *pendingcleanuprunArgs = psMetadataAlloc(); … … 430 458 PXOPT_ADD_MODE("-updateskyfile", "update fault code for skyfile", WARPTOOL_MODE_UPDATESKYFILE, updateskyfileArgs); 431 459 PXOPT_ADD_MODE("-setskyfiletoupdate", "set cleaned skyfile to be updated", WARPTOOL_MODE_SETSKYFILETOUPDATE, setskyfiletoupdateArgs); 460 PXOPT_ADD_MODE("-tosummary", "show runs that can be summarized", WARPTOOL_MODE_TOSUMMARY, tosummaryArgs); 461 PXOPT_ADD_MODE("-addsummary", "add entry to the summary table", WARPTOOL_MODE_ADDSUMMARY, addsummaryArgs); 462 432 463 PXOPT_ADD_MODE("-exportrun", "export run for import on other database", WARPTOOL_MODE_EXPORTRUN, exportrunArgs); 433 464 PXOPT_ADD_MODE("-importrun", "import run from metadata file", WARPTOOL_MODE_IMPORTRUN, importrunArgs); -
trunk/ippconfig/recipes/filerules-mef.mdc
r28286 r28375 312 312 PPSKYCELL.JPEG1 OUTPUT {OUTPUT}.{FILE.INDEX}.b1.jpeg JPEG NONE CHIP TRUE NONE 313 313 PPSKYCELL.JPEG2 OUTPUT {OUTPUT}.{FILE.INDEX}.b2.jpeg JPEG NONE CHIP TRUE NONE 314 PPSKYCELL.BIN1 OUTPUT {OUTPUT}.{FILE.INDEX}.b1.fits IMAGE NONE FPA TRUE NONE 315 PPSKYCELL.BIN2 OUTPUT {OUTPUT}.{FILE.INDEX}.b2.fits IMAGE NONE FPA TRUE NONE 314 316 315 317 LOG.IMFILE OUTPUT {OUTPUT}.{CHIP.NAME}.log TEXT NONE CHIP TRUE NONE -
trunk/ippconfig/recipes/filerules-simple.mdc
r28361 r28375 277 277 PPSKYCELL.JPEG1 OUTPUT {OUTPUT}.{FILE.INDEX}.b1.jpeg JPEG NONE CHIP TRUE NONE 278 278 PPSKYCELL.JPEG2 OUTPUT {OUTPUT}.{FILE.INDEX}.b2.jpeg JPEG NONE CHIP TRUE NONE 279 PPSKYCELL.BIN1 OUTPUT {OUTPUT}.{FILE.INDEX}.b1.fits IMAGE NONE FPA TRUE NONE 280 PPSKYCELL.BIN2 OUTPUT {OUTPUT}.{FILE.INDEX}.b2.fits IMAGE NONE FPA TRUE NONE 279 281 280 282 LOG.IMFILE OUTPUT {OUTPUT}.imfile.log TEXT NONE FPA TRUE NONE -
trunk/ippconfig/recipes/filerules-split.mdc
r28286 r28375 297 297 PPSKYCELL.JPEG1 OUTPUT {OUTPUT}.{FILE.INDEX}.b1.jpeg JPEG NONE CHIP TRUE NONE 298 298 PPSKYCELL.JPEG2 OUTPUT {OUTPUT}.{FILE.INDEX}.b2.jpeg JPEG NONE CHIP TRUE NONE 299 PPSKYCELL.BIN1 OUTPUT {OUTPUT}.{FILE.INDEX}.b1.fits IMAGE NONE FPA TRUE NONE 300 PPSKYCELL.BIN2 OUTPUT {OUTPUT}.{FILE.INDEX}.b2.fits IMAGE NONE FPA TRUE NONE 299 301 300 302 LOG.IMFILE OUTPUT {OUTPUT}.{CHIP.NAME}.log TEXT NONE CHIP TRUE NONE -
trunk/ippconfig/recipes/ppSkycell.config
r24010 r28375 4 4 BIN1 S32 4 # Binning factor for output 1 5 5 BIN2 S32 4 # Binning factor for output 2 6 6 MAKEFITS BOOL T # Make fits image as well? -
trunk/ppImage/src/ppImageLoop.c
r28043 r28375 175 175 ESCAPE("Unable to measures pixel stats for image"); 176 176 } 177 177 178 if (!ppImageMosaicChip(config, options, view, "PPIMAGE.CHIP", "PPIMAGE.OUTPUT")) { 178 179 ESCAPE("Unable to mosaic chip"); … … 181 182 182 183 // we perform photometry on the readouts of this chip in the output 184 183 185 psTimerStart(TIMER_PHOT); 184 186 if (options->doPhotom) { -
trunk/ppImage/src/ppImagePhotom.c
r23688 r28375 11 11 pmCell *cell; 12 12 pmReadout *readout; 13 13 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 14 14 psphotInit(); 15 15 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 16 16 // find or define a pmFPAfile PSPHOT.INPUT 17 17 pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSPHOT.INPUT"); … … 20 20 return false; 21 21 } 22 22 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 23 23 // we make a new copy of the output chip to keep psphot from modifying the output image 24 24 pmChip *oldChip = pmFPAviewThisChip (view, input->src); 25 25 pmChip *newChip = pmFPAviewThisChip (view, input->fpa); 26 26 pmChipCopy (newChip, oldChip); 27 27 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 28 28 // iterate over the cells and readout for this chip 29 29 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) { … … 34 34 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) { 35 35 if (! readout->data_exists) { continue; } 36 36 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 37 37 // run the actual photometry analysis 38 38 if (!psphotReadout (config, view)) { -
trunk/ppSkycell/src/ppSkycell.h
r23992 r28375 16 16 int bin1, bin2; // Binning factors 17 17 pmConfig *config; // Configuration 18 bool doFits; // hold whether to do fits as well. 18 19 } ppSkycellData; 19 20 -
trunk/ppSkycell/src/ppSkycellCamera.c
r24009 r28375 103 103 return false; 104 104 } 105 if (!pmFPAfileDefineOutput(data->config, NULL, "PPSKYCELL.BIN1")) { 106 psError(psErrorCodeLast(), false, "Unable to define output."); 107 return false; 108 } 109 if (!pmFPAfileDefineOutput(data->config, NULL, "PPSKYCELL.BIN2")) { 110 psError(psErrorCodeLast(), false, "Unable to define output."); 111 return false; 112 } 105 113 106 114 // Now the camera has been determined, we can read the recipe … … 116 124 data->bin2 = psMetadataLookupS32(NULL, recipe, "BIN2"); 117 125 126 data->doFits = psMetadataLookupBool(NULL, recipe, "MAKEFITS"); 127 118 128 if (data->bin1 <= 0 || data->bin2 <= 0) { 119 129 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Unable to find legitimate values for BIN1 and BIN2"); -
trunk/ppSkycell/src/ppSkycellLoop.c
r24005 r28375 284 284 pmFPAfileActivate(data->config->files, true, "PPSKYCELL.JPEG1"); 285 285 pmFPAfileActivate(data->config->files, true, "PPSKYCELL.JPEG2"); 286 if (data->doFits) { 287 pmFPAfileActivate(data->config->files, true, "PPSKYCELL.BIN1"); 288 pmFPAfileActivate(data->config->files, true, "PPSKYCELL.BIN2"); 289 } 290 286 291 pmFPAview *view = filesIterateDown(data->config); // View to readout 287 292 293 288 294 pmCell *cell1 = pmFPAfileThisCell(data->config->files, view, "PPSKYCELL.JPEG1"); // Rebinned cell 1 289 295 pmCell *cell2 = pmFPAfileThisCell(data->config->files, view, "PPSKYCELL.JPEG2"); // Rebinned cell 2 290 psFree(view); 296 291 297 pmReadout *ro1 = pmReadoutAlloc(cell1), *ro2 = pmReadoutAlloc(cell2); // Binned readouts 292 298 … … 298 304 ro1->data_exists = cell1->data_exists = cell1->parent->data_exists = true; 299 305 ro2->data_exists = cell2->data_exists = cell2->parent->data_exists = true; 300 306 301 307 pmFPAfile *file1 = pmFPAfileSelectSingle(data->config->files, "PPSKYCELL.JPEG1", 0); 302 308 file1->save = true; 303 file1-> index = i;309 file1->fileIndex = i; 304 310 pmFPAfile *file2 = pmFPAfileSelectSingle(data->config->files, "PPSKYCELL.JPEG2", 0); 305 311 file2->save = true; 306 file2->index = i; 312 file2->fileIndex = i; 313 314 if (data->doFits) { 315 pmCell *Fcell1 = pmFPAfileThisCell(data->config->files, view, "PPSKYCELL.BIN1"); // Rebinned cell 1 316 pmCell *Fcell2 = pmFPAfileThisCell(data->config->files, view, "PPSKYCELL.BIN2"); // Rebinned cell 2 317 318 // This is a hack to get a functioning header created so the fits images can be written out. 319 psMetadataAddS32(Fcell1->concepts,PS_LIST_TAIL,"CELL.XPARITY", PS_META_REPLACE,"",1); 320 psMetadataAddS32(Fcell1->concepts,PS_LIST_TAIL,"CELL.YPARITY", PS_META_REPLACE,"",1); 321 psMetadataAddS32(Fcell1->concepts,PS_LIST_TAIL,"CELL.READDIR", PS_META_REPLACE,"",1); 322 psMetadataAddS32(Fcell2->concepts,PS_LIST_TAIL,"CELL.XPARITY", PS_META_REPLACE,"",1); 323 psMetadataAddS32(Fcell2->concepts,PS_LIST_TAIL,"CELL.YPARITY", PS_META_REPLACE,"",1); 324 psMetadataAddS32(Fcell2->concepts,PS_LIST_TAIL,"CELL.READDIR", PS_META_REPLACE,"",1); 325 326 psMetadataAddS32(Fcell1->parent->concepts,PS_LIST_TAIL,"CHIP.XPARITY", PS_META_REPLACE,"",1); 327 psMetadataAddS32(Fcell1->parent->concepts,PS_LIST_TAIL,"CHIP.YPARITY", PS_META_REPLACE,"",1); 328 psMetadataAddS32(Fcell2->parent->concepts,PS_LIST_TAIL,"CHIP.XPARITY", PS_META_REPLACE,"",1); 329 psMetadataAddS32(Fcell2->parent->concepts,PS_LIST_TAIL,"CHIP.YPARITY", PS_META_REPLACE,"",1); 330 331 pmReadout *Fro1 = pmReadoutAlloc(Fcell1), *Fro2 = pmReadoutAlloc(Fcell2); // Binned readouts 332 333 Fro1->image = image1; 334 Fro2->image = image2; 335 Fro1->mask = mask1; 336 Fro2->mask = mask2; 337 338 Fro1->data_exists = Fcell1->data_exists = Fcell1->parent->data_exists = true; 339 Fro2->data_exists = Fcell2->data_exists = Fcell2->parent->data_exists = true; 340 341 pmFPAfile *fits1 = pmFPAfileSelectSingle(data->config->files, "PPSKYCELL.BIN1", 0); 342 fits1->save = true; 343 fits1->fileIndex = i; 344 pmFPAfile *fits2 = pmFPAfileSelectSingle(data->config->files, "PPSKYCELL.BIN2", 0); 345 fits2->save = true; 346 fits2->fileIndex = i; 347 } 348 349 psFree(view); 307 350 #if 0 308 351 { -
trunk/psModules
- Property svn:mergeinfo changed
/branches/czw_branch/20100519/psModules (added) merged: 28164,28304,28334,28338
- Property svn:mergeinfo changed
-
trunk/psconfig/tagsets/ipp-2.9.dist
r27873 r28375 73 73 YYYYY ppTranslate ipp-2-9 -0 74 74 YYYYY ppViz ipp-2-9 -0 75 YYYYY ppSkycell ipp-2-9 -0 75 76 76 77 YYYYY extsrc/gpcsw ipp-2-9 -0 -
trunk/psphot
- Property svn:mergeinfo changed
/branches/czw_branch/20100519/psphot (added) merged: 28164,28304
- Property svn:mergeinfo changed
-
trunk/psphot/src/psphotReadout.c
r28013 r28375 14 14 // by the multiple threads, not the total time used by all threads. 15 15 psTimerStart ("psphotReadout"); 16 16 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 17 17 pmModelClassSetLimits(PM_MODEL_LIMITS_LAX); 18 18 … … 26 26 char *breakPt = psMetadataLookupStr (NULL, recipe, "BREAK_POINT"); 27 27 psAssert (breakPt, "configuration error: set BREAK_POINT"); 28 28 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 29 29 // set the photcode for this image 30 30 if (!psphotAddPhotcode (config, view, "PSPHOT.INPUT")) { … … 32 32 return false; 33 33 } 34 34 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 35 35 // Generate the mask and weight images, including the user-defined analysis region of interest 36 36 if (!psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT")) { … … 40 40 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 41 41 } 42 42 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 43 43 // generate a background model (median, smoothed image) 44 44 if (!psphotModelBackground (config, view, "PSPHOT.INPUT")) { 45 45 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 46 46 } 47 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 47 48 if (!psphotSubtractBackground (config, view, "PSPHOT.INPUT")) { 48 49 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); … … 51 52 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 52 53 } 53 54 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 54 55 // load the psf model, if suppled. FWHM_X,FWHM_Y,etc are determined and saved on 55 56 // readout->analysis XXX this function currently only works with a single PSPHOT.INPUT … … 58 59 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 59 60 } 60 61 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 61 62 // find the detections (by peak and/or footprint) in the image. 62 63 if (!psphotFindDetections (config, view, "PSPHOT.INPUT", true)) { // pass 1 … … 65 66 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 66 67 } 67 68 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 68 69 // construct sources and measure basic stats (saved on detections->newSources) 69 70 if (!psphotSourceStats (config, view, "PSPHOT.INPUT", true)) { // pass 1 … … 74 75 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 75 76 } 76 77 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 77 78 // find blended neighbors of very saturated stars (detections->newSources) 78 79 if (!psphotDeblendSatstars (config, view, "PSPHOT.INPUT")) { … … 80 81 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 81 82 } 82 83 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 83 84 // mark blended peaks PS_SOURCE_BLEND (detections->newSources) 84 85 if (!psphotBasicDeblend (config, view, "PSPHOT.INPUT")) { … … 86 87 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 87 88 } 88 89 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 89 90 // classify sources based on moments, brightness. if a PSF model has been loaded, the PSF 90 91 // clump defined for it is used not measured (detections->newSources) … … 93 94 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 94 95 } 96 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 95 97 // if we were not supplied a PSF model, determine the IQ stats here (detections->newSources) 96 98 if (!psphotImageQuality (config, view, "PSPHOT.INPUT")) { // pass 1 … … 101 103 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 102 104 } 103 105 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 104 106 // use bright stellar objects to measure PSF if we were supplied a PSF for any input file, 105 107 // this step is skipped … … 115 117 // XXX fix this in the new multi-input context 116 118 // psphotLoadExtSources (config, view, "PSPHOT.INPUT"); // pass 1 117 119 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 118 120 // construct an initial model for each object, set the radius to fitRadius, set circular 119 121 // fit mask (detections->newSources) 120 122 psphotGuessModels (config, view, "PSPHOT.INPUT"); // pass 1 121 123 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 122 124 // merge the newly selected sources into the existing list 123 125 // NOTE: merge OLD and NEW 124 126 psphotMergeSources (config, view, "PSPHOT.INPUT"); 125 127 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 126 128 // linear PSF fit to source peaks, subtract the models from the image (in PSF mask) 127 129 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false); // pass 1 (detections->allSources) 128 130 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 129 131 // identify CRs and extended sources (only unmeasured sources are measured) 130 132 psphotSourceSize (config, view, "PSPHOT.INPUT", true); // pass 1 (detections->allSources) … … 132 134 goto finish; 133 135 } 134 136 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 135 137 // non-linear PSF and EXT fit to brighter sources 136 138 // replace model flux, adjust mask as needed, fit, subtract the models (full stamp) 137 139 psphotBlendFit (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 138 140 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 139 141 // replace all sources 140 142 psphotReplaceAllSources (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 141 143 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 142 144 // linear fit to include all sources (subtract again) 143 145 // NOTE : apply to ALL sources (extended + psf) 144 146 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", true); // pass 2 (detections->allSources) 145 147 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 146 148 // if we only do one pass, skip to extended source analysis 147 149 if (!strcasecmp (breakPt, "PASS1")) goto pass1finish; 148 150 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 149 151 // NOTE: possibly re-measure background model here with objects subtracted / or masked 150 152 151 153 // add noise for subtracted objects 152 154 psphotAddNoise (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 153 155 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 154 156 // find fainter sources 155 157 // NOTE: finds new peaks and new footprints, OLD and FULL set are saved on detections 156 158 psphotFindDetections (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->peaks, detections->footprints) 157 159 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 158 160 // remove noise for subtracted objects (ie, return to normal noise level) 159 161 // NOTE: this needs to operate only on the OLD sources 160 162 psphotSubNoise (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 161 163 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 162 164 // define new sources based on only the new peaks 163 165 // NOTE: new sources are saved on detections->newSources 164 166 psphotSourceStats (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->newSources) 165 167 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 166 168 // set source type 167 169 // NOTE: apply only to detections->newSources … … 170 172 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 171 173 } 172 174 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 173 175 // create full input models, set the radius to fitRadius, set circular fit mask 174 176 // NOTE: apply only to detections->newSources 175 177 psphotGuessModels (config, view, "PSPHOT.INPUT"); // pass 2 (detections->newSources) 176 178 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 177 179 // replace all sources so fit below applies to all at once 178 180 // NOTE: apply only to OLD sources (which have been subtracted) 179 181 psphotReplaceAllSources (config, view, "PSPHOT.INPUT"); // pass 2 180 182 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 181 183 // merge the newly selected sources into the existing list 182 184 // NOTE: merge OLD and NEW 183 185 // XXX check on free of sources... 184 186 psphotMergeSources (config, view, "PSPHOT.INPUT"); // (detections->newSources + detections->allSources -> detections->allSources) 185 187 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 186 188 // NOTE: apply to ALL sources 187 189 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", true); // pass 3 (detections->allSources) 188 190 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 189 191 pass1finish: 190 192 … … 192 194 // NOTE: applies only to NEW (unmeasured) sources 193 195 psphotSourceSize (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->allSources) 194 196 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 195 197 psphotExtendedSourceAnalysis (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 196 198 psphotExtendedSourceFits (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 197 199 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 198 200 finish: 199 201 200 202 // plot positive sources 201 203 // psphotSourcePlots (readout, sources, recipe); 202 204 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 203 205 // measure aperture photometry corrections 204 206 if (!psphotApResid (config, view, "PSPHOT.INPUT")) { // pass 1 (detections->allSources) … … 206 208 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 207 209 } 208 210 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 209 211 // calculate source magnitudes 210 psphotMagnitudes(config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 211 212 if (!psphotMagnitudes(config, view, "PSPHOT.INPUT")) { // pass 1 (detections->allSources) 213 psErrorStackPrint(stderr, "Unable to do magnitudes."); 214 psErrorClear(); 215 } 212 216 if (!psphotEfficiency(config, view, "PSPHOT.INPUT")) { // pass 1 213 217 psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources"); … … 219 223 220 224 // replace background in residual image 221 psphotSkyReplace (config, view, "PSPHOT.INPUT"); // pass 1 222 225 if (!psphotSkyReplace (config, view, "PSPHOT.INPUT")) { // pass 1 226 psErrorStackPrint(stderr, "Unable to replace sky"); 227 psErrorClear(); 228 229 /* psLogMsg("psphot", 3, "failed on psphotSkyReplace"); */ 230 /* return(psphotReadoutCleanup(config, view, "PSPHOT.INPUT")); */ 231 } 223 232 // drop the references to the image pixels held by each source 224 psphotSourceFreePixels (config, view, "PSPHOT.INPUT"); // pass 1 225 233 if (!psphotSourceFreePixels (config, view, "PSPHOT.INPUT")) { // pass 1 234 psErrorStackPrint(stderr, "Unable to free source pixels"); 235 psErrorClear(); 236 237 /* psLogMsg ("psphot", 3, "failed on psphotSourceFreePixels"); */ 238 /* return(psphotReadoutCleanup(config, view, "PSPHOT.INPUT")); */ 239 } 226 240 // create the exported-metadata and free local data 227 241 return psphotReadoutCleanup(config, view, "PSPHOT.INPUT");
Note:
See TracChangeset
for help on using the changeset viewer.
