Changeset 28304 for branches/czw_branch/20100519/ippScripts/scripts
- Timestamp:
- Jun 10, 2010, 6:28:51 PM (16 years ago)
- Location:
- branches/czw_branch/20100519
- Files:
-
- 9 edited
- 2 copied
-
. (modified) (1 prop)
-
ippScripts/scripts/addstar_run.pl (modified) (7 diffs)
-
ippScripts/scripts/automate_stacks.pl (modified) (16 diffs)
-
ippScripts/scripts/diff_skycell.pl (modified) (3 diffs)
-
ippScripts/scripts/lossy_compress_imfile.pl (modified) (11 diffs)
-
ippScripts/scripts/magic_process.pl (modified) (3 diffs)
-
ippScripts/scripts/minidvodb_createdb.pl (copied) (copied from trunk/ippScripts/scripts/minidvodb_createdb.pl )
-
ippScripts/scripts/minidvodb_merge.pl (copied) (copied from trunk/ippScripts/scripts/minidvodb_merge.pl )
-
ippScripts/scripts/skycell_jpeg.pl (modified) (9 diffs)
-
ippScripts/scripts/stack_skycell.pl (modified) (2 diffs)
-
ippScripts/scripts/staticsky.pl (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20100519
- Property svn:mergeinfo changed
-
branches/czw_branch/20100519/ippScripts/scripts/addstar_run.pl
r27718 r28304 37 37 } 38 38 39 my ( $exp_tag, $add_id, $camera, $outroot, $camroot, $dbname, $reduction, $dvodb, $ image_only, $verbose, $no_update,39 my ( $exp_tag, $add_id, $camera, $outroot, $camroot, $dbname, $reduction, $dvodb, $minidvodb, $minidvodb_name, $minidvodb_group, $image_only, $verbose, $no_update, 40 40 $no_op, $redirect, $save_temps); 41 41 GetOptions( … … 48 48 'reduction=s' => \$reduction, # Reduction class 49 49 'dvodb|w=s' => \$dvodb, # output DVO database 50 'minidvodb_name|w=s'=> \$minidvodb_name, # miniDVO database name 51 'minidvodb_group|w=s' => \$minidvodb_group, # miniDVO database group 52 'minidvodb' => \$minidvodb, # use minidvodb? 50 53 'image-only' => \$image_only, # Print to stdout 51 54 'verbose' => \$verbose, # Print to stdout … … 58 61 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 59 62 pod2usage( 60 -msg => "Required options: --exp_tag --add_id --camera --outroot ",63 -msg => "Required options: --exp_tag --add_id --camera --outroot --dvodb --camroot", 61 64 -exitval => 3, 62 65 ) unless … … 65 68 defined $outroot and 66 69 defined $camroot and 70 defined $dvodb and 67 71 defined $camera; 68 72 if ($minidvodb && !defined($minidvodb_group)) { 73 my_die( "missing minidvodb_group", $add_id, 3 ); 74 } 69 75 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $add_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 70 76 … … 98 104 if (defined $dvodb) { 99 105 $dvodbReal = $ipprc->dvo_catdir( $dvodb ); # catdir for DVO 100 $dvodbReal = $ipprc->convert_filename_absolute( $dvodbReal ); 101 } 106 $dvodbReal = $ipprc->convert_filename_absolute( $dvodbReal ) or &my_die("can't get path for dvodb", $add_id, $PS_EXIT_CONFIG_ERROR); 107 } 108 109 110 102 111 103 112 my $dtime_addstar = 0; 104 113 114 if (defined $dvodbReal) { 115 if ($minidvodb) { 116 117 if (!defined($minidvodb_name)) { 118 #take the active one, if it's not defined on the command line 119 #reverts would have this already set, for example. 120 my $command = "addtool -listminidvodbrun "; 121 $command .= " -minidvodb_group $minidvodb_group" if defined $minidvodb_group; 122 $command .= " -state 'active' -limit 1"; 123 $command .= " -dbname $dbname" if defined $dbname; 124 print $command; 125 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 126 run(command => $command, verbose => $verbose); 127 &my_die( "Unable to get active minidvodb_name", $add_id, $PS_EXIT_SYS_ERROR) unless $success; 128 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 129 &my_die("Unable to parse metadata config", $add_id, $PS_EXIT_PROG_ERROR); 130 131 my $components = parse_md_list($metadata) or 132 &my_die("Unable to parse metadata list", $add_id, $PS_EXIT_PROG_ERROR); 133 my $comp = $$components[0]; 134 $minidvodb_name = $comp->{minidvodb_name}; 135 136 if (!defined($minidvodb_name)) { 137 &my_die("Unable to parse minidvodb_name", $add_id, $PS_EXIT_PROG_ERROR); 138 } 139 140 } 141 # tack on the minidvodb part to the db. 142 $dvodbReal = $dvodbReal . '/' . $minidvodb_name . '/'; 143 144 } 105 145 unless ($no_op) { 106 if (defined $dvodbReal) {146 print $dvodbReal; 107 147 108 148 ## addstar can either save the full set of detections, or just … … 142 182 $fpaCommand .= " -path_base $outroot"; 143 183 $fpaCommand .= " -dtime_addstar $dtime_addstar"; 184 $fpaCommand .= " -dvodb_path $dvodbReal" if defined $dvodbReal; 185 $fpaCommand .= " -minidvodb_name $minidvodb_name" if defined $minidvodb_name; 144 186 $fpaCommand .= " -dbname $dbname" if defined $dbname; 145 187 print $fpaCommand; 146 188 # Add the result into the database 147 189 unless ($no_update) { … … 171 213 $command .= " -addprocessedexp"; 172 214 $command .= " -fault $exit_code"; 215 $command .= " -dvodb_path $dvodbReal" if defined $dvodbReal; 173 216 $command .= " -path_base $outroot" if defined $outroot; 174 217 $command .= (" -dtime_addstar " . ((DateTime->now->mjd - $mjd_start) * 86400)); 218 $fpaCommand .= " -minidvodb_name $minidvodb_name" if defined $minidvodb_name; 175 219 $command .= " -dbname $dbname" if defined $dbname; 176 220 system ($command); -
branches/czw_branch/20100519/ippScripts/scripts/automate_stacks.pl
r27938 r28304 20 20 my $stacktool= can_run('stacktool') or (warn "Can't find stacktool" and $missing_tools = 1); 21 21 my $difftool = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1); 22 my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1); 22 23 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); 23 24 my $mkBTpcontrol = can_run('make_burntool_pcontrol.pl') or (warn "Can't find make_burntool_pcontrol.pl" and $missing_tools = 1); … … 59 60 my ( $check_registration, $define_burntool, $queue_burntool, $check_chips, $queue_chips); 60 61 my ( $check_stacks, $queue_stacks, $check_diffs, $queue_diffs, $clean_old); 62 my ( $check_detrends, $queue_detrends); 61 63 62 64 GetOptions( … … 81 83 'check_stacks' => \$check_stacks, 82 84 'queue_stacks' => \$queue_stacks, 85 'check_detrends' => \$check_detrends, 86 'queue_detrends' => \$queue_detrends, 83 87 'check_diffs' => \$check_diffs, 84 88 'queue_diffs' => \$queue_diffs, … … 105 109 --check_stacks Confirm that stacks can be built. 106 110 --queue_stacks Issue stacktool commands to queue stacks. 111 --check_detrends Confirm that detrend verify runs can be built. 112 --queue_detrends Issue dettool commands to queue detrend verify runs. 107 113 --check_diffs Confirm that diffs can be done. 108 114 --queue_diffs Issue difftool commands to queue diffs. … … 115 121 ) unless 116 122 defined $check_registration or defined $define_burntool or defined $queue_burntool or 117 defined $queue_chips or defined $queue_stacks or 118 defined $check_chips or defined $check_stacks or 123 defined $queue_chips or defined $queue_stacks or $queue_detrends or 124 defined $check_chips or defined $check_stacks or $check_detrends or 119 125 defined $test_mode or defined $clean_old or defined $check_mode; 120 126 … … 128 134 my %stackable_list = (); 129 135 my %reduction_class = (); 136 my @detrend_list = (); 137 my %dettype_list = (); 138 my %exptype_list = (); 139 my %refID_list = (); 140 my %refIter_list = (); 141 my %detfilter_list = (); 142 my %detmax_list = (); 130 143 my %clean_commands = (); 131 144 my %clean_retention = (); … … 158 171 } 159 172 } 160 # if (${ $entry }{name} eq 'RETENTION_TIME') {161 # $retention_time = ${ $entry }{value};162 # }163 173 elsif (${ $entry }{name} eq 'FILTERS') { 164 174 push @filter_list, ${ $entry }{value}; … … 195 205 } 196 206 } 197 } 198 199 200 207 elsif (${ $entry }{name} eq 'DETRENDS') { 208 my @detrend_data = @{ ${ $entry }{value} }; 209 my $this_detrend = ''; 210 foreach my $dentry (@detrend_data) { 211 if (${ $dentry }{name} eq 'NAME') { 212 $this_detrend = ${ $dentry }{value}; 213 push @detrend_list, $this_detrend; 214 } 215 elsif (${ $dentry }{name} eq 'DETTYPE') { 216 $dettype_list{$this_detrend} = ${ $dentry }{value}; 217 } 218 elsif (${ $dentry }{name} eq 'EXPTYPE') { 219 $exptype_list{$this_detrend} = ${ $dentry }{value}; 220 } 221 elsif (${ $dentry }{name} eq 'REF_ID') { 222 $refID_list{$this_detrend} = ${ $dentry }{value}; 223 } 224 elsif (${ $dentry }{name} eq 'REF_ITER') { 225 $refIter_list{$this_detrend} = ${ $dentry }{value}; 226 } 227 elsif (${ $dentry }{name} eq 'FILTER') { 228 $detfilter_list{$this_detrend} = ${ $dentry }{value}; 229 } 230 elsif (${ $dentry }{name} eq 'MAX') { 231 $detmax_list{$this_detrend} = ${ $dentry }{value}; 232 } 233 } 234 } 235 } 201 236 202 237 unless(defined($date)) { … … 256 291 return_metadata($date); 257 292 unless (defined($test_mode) || defined($check_mode)) { exit(0); } 293 } 294 if (defined($check_detrends) || defined($test_mode)) { 295 $metadata_out{nsState} = 'CHECKDETRENDS'; 296 &execute_detrends($date,"pretend"); 297 return_metadata($date); 298 unless (defined($test_mode) || defined($check_mode)) { exit(0); } 299 } 300 if (defined($queue_detrends)) { 301 $metadata_out{nsState} = 'QUEUEDETRENDS'; 302 &execute_detrends($date,"pretend"); 303 return_metadata($date); 304 exit(0); 258 305 } 259 306 if (defined($define_burntool) || defined($test_mode)) { … … 498 545 499 546 my $cmd = "$chiptool"; 500 $cmd .= ' -simple -dbname gpc1 -definebyquery -set_end_stage warp ';547 $cmd .= " -simple -dbname $dbname -definebyquery -set_end_stage warp "; 501 548 $cmd .= " -set_label $label "; 502 549 $cmd .= " -set_workdir $workdir -set_dist_group $dist_group "; … … 566 613 } 567 614 615 616 568 617 sub chip_queue { 569 618 my $date = shift; … … 612 661 613 662 # 663 # Detrend verification 664 ################################################################################ 665 666 sub construct_dettool_cmd { 667 my $date = shift; 668 my $target = shift; 669 670 my ($label,$workdir,$filter,$exp_type,$det_type,$ref_det_id,$ref_iter,$maxN) = get_dettool_parameters($date,$target); 671 672 my $select = "-select_dateobs_begin ${date}T00:00:00 -select_dateobs_end ${date}T23:59:59 "; 673 $date =~ s/-//g; 674 675 my $cmd = "$dettool"; 676 $cmd .= " -pretend "; 677 $cmd .= " -simple -dbname $dbname -definebyquery -det_type $det_type "; 678 $cmd .= " -mode verify -ref_det_id $ref_det_id -ref_iter $ref_iter "; 679 $cmd .= " $select "; 680 $cmd .= " -inst $camera "; 681 $cmd .= " -select_exp_type $exp_type "; 682 $cmd .= " -select_filter $filter " if defined($filter); 683 $cmd .= " -workdir $workdir "; 684 $cmd .= " -label $label "; 685 if ($maxN > 0) { 686 $cmd .= " -random_subset -random_limit $maxN "; 687 } 688 if ($debug == 1) { 689 $cmd .= ' -pretend '; 690 } 691 print STDERR "$cmd\n"; 692 return($cmd); 693 } 694 695 sub verify_uniqueness_detverify { 696 my $date = shift; 697 my $target = shift; 698 699 my ($label,$workdir,$filter,$exp_type,$det_type,$ref_det_id,$ref_iter,$maxN) = get_dettool_parameters($date,$target); 700 701 my $db = init_gpc_db(); 702 my $sth = "SELECT * FROM detRun WHERE workdir = '$workdir' AND ref_det_id = $ref_det_id AND ref_iter = $ref_iter"; 703 my $data_ref = $db->selectall_arrayref( $sth ); 704 705 return($#{ $data_ref } + 1); 706 } 707 708 sub pre_detrend_queue { 709 my $date = shift; 710 my $target = shift; 711 712 my $command = construct_dettool_cmd($date,$target) . ' -pretend '; 713 my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 714 run ( command => $command, verbose => $verbose); 715 unless ($success) { 716 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 717 &my_die("Unable to perform dettool: $error_code", 0,0, $date, $PS_EXIT_SYS_ERROR); 718 } 719 720 my @input_exposures = split /\n/, (join '', @$stdout_buf); 721 return($#input_exposures + 1); 722 } 723 724 sub detrend_queue { 725 my $date = shift; 726 my $target = shift; 727 728 my $command = construct_dettool_cmd($date,$target); 729 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 730 run ( command => $command, verbose => $verbose); 731 unless ($success) { 732 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 733 &my_die("Unable to perform chiptool: $error_code", 0,0,$date, $PS_EXIT_SYS_ERROR); 734 } 735 $metadata_out{nsState} = 'DETREND_QUEUED'; 736 return(0); 737 } 738 739 sub execute_detrends { 740 my $date = shift; 741 my $pretend = shift; 742 my $exposures = 0; 743 foreach my $target (@detrend_list) { 744 my ($Nexposures) = pre_detrend_queue($date,$target); 745 if ($Nexposures == 0) { 746 print STDERR "execute_detrends: Target $target on $date had no exposures.\n"; 747 next; 748 } 749 $exposures++; 750 unless(defined($pretend)) { 751 detrend_queue($date,$target); 752 } 753 } 754 if ($exposures == 0) { 755 $metadata_out{nsState} = 'DETREND_DROP'; 756 } 757 } 758 759 # 614 760 # Stacking 615 761 ################################################################################ … … 627 773 my $cmd = "$stacktool"; 628 774 # $cmd .= ' -pretend -simple -dbname gpc1 -definebyquery -min_new 4 '; # Probably silly, but I want to be safe and not overwrite 629 $cmd .= ' -simple -dbname gpc1 -definebyquery ';775 $cmd .= " -simple -dbname $dbname -definebyquery "; 630 776 $cmd .= " -set_label $label -select_label $label "; 631 777 $cmd .= " -set_workdir $workdir -set_dist_group $dist_group "; … … 779 925 my ($label,$workdir,$obs_mode,$object,$comment,$tess_id,$dist_group,$data_group,$reduction) = get_tool_parameters($cleaning_date,$target); 780 926 my $args = $command; 781 $args .= " -dbname gpc1-updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -label $label -data_group $data_group ";927 $args .= " -dbname $dbname -updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -label $label -data_group $data_group "; 782 928 if ($debug == 1) { 783 929 $args .= ' -pretend '; … … 826 972 827 973 my $label = "${target}.nightlyscience"; 828 my $workdir = "neb://\@HOST\@.0/ gpc1/${target}.nt/${workdir_date}";974 my $workdir = "neb://\@HOST\@.0/${dbname}/${target}.nt/${workdir_date}"; 829 975 my $obs_mode = $obsmode_list{$target}; 830 976 my $object = $object_list{$target}; … … 837 983 } 838 984 985 sub get_dettool_parameters { 986 my $date = shift; 987 my $target = shift; 988 my $workdir_date = $date; $workdir_date =~ s%-%/%g; 989 my $trunc_date = $date; $trunc_date =~ s/-//g; 990 991 my $exp_type = $exptype_list{$target}; 992 my $det_type = $dettype_list{$target}; 993 my $ref_det_id = $refID_list{$target}; 994 my $ref_iter = $refIter_list{$target}; 995 my $det_filter = $detfilter_list{$target}; 996 my $internal_filter; 997 if (defined($det_filter)) { 998 $internal_filter = $det_filter; $internal_filter =~ s/\..*//; 999 $internal_filter = '.' . $internal_filter; 1000 } 1001 else { 1002 $internal_filter = ''; 1003 } 1004 my $maxN = $detmax_list{$target}; 1005 1006 my $lc_type = lc($exp_type); 1007 my $label = "${lc_type}${internal_filter}.$trunc_date"; 1008 my $workdir = 'neb://@HOST@.0/' . $dbname . "/detverify.nt/${workdir_date}/${lc_type}${internal_filter}"; 1009 return($label,$workdir,$det_filter,$exp_type,$det_type,$ref_det_id,$ref_iter,$maxN); 1010 } 839 1011 840 1012 sub init_gpc_db { -
branches/czw_branch/20100519/ippScripts/scripts/diff_skycell.pl
r28043 r28304 197 197 my $recipe_ppSub = $ipprc->reduction($reduction, 'DIFF_PPSUB'); # Recipe to use for ppSub 198 198 my $recipe_psphot = $ipprc->reduction($reduction, 'DIFF_PSPHOT'); # Recipe to use for psphot 199 my $recipe_ppstats = 'DIFFSTATS'; 199 200 unless ($recipe_ppSub and $recipe_psphot) { 200 201 &my_die("Couldn't find selected reduction for DIFF_PPSUB and DIFF_PSPHOT: $reduction\n", $diff_id, $skycell_id, $PS_EXIT_CONFIG_ERROR); … … 257 258 $traceDest .= '.update'; 258 259 $outputStats .= '.update'; 260 261 $recipe_ppstats = 'WARPSTATS'; 259 262 } 260 263 … … 292 295 $command .= " -recipe PPSUB $recipe_ppSub"; 293 296 $command .= " -recipe PSPHOT $recipe_psphot"; 294 $command .= " -recipe PPSTATS DIFFSTATS";297 $command .= " -recipe PPSTATS $recipe_ppstats"; 295 298 $command .= " -F PSPHOT.PSF.SAVE PSPHOT.PSF.SKY.SAVE"; 296 299 $command .= " -F PSPHOT.OUTPUT PSPHOT.OUT.CMF.MEF"; -
branches/czw_branch/20100519/ippScripts/scripts/lossy_compress_imfile.pl
r27718 r28304 61 61 defined $state; 62 62 63 my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $exp_id, $exp_name, $class_id, $uri, $ PS_EXIT_CONFIG_ERROR );63 my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $exp_id, $exp_name, $class_id, $uri, $state, $PS_EXIT_CONFIG_ERROR ); 64 64 if (defined($logfile)) { 65 $ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $exp_id, $exp_name, $class_id, $uri, $ PS_EXIT_SYS_ERROR );65 $ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $exp_id, $exp_name, $class_id, $uri, $state, $PS_EXIT_SYS_ERROR ); 66 66 } 67 67 … … 87 87 if ($state eq 'goto_compressed') { 88 88 # Find the actual filename for this run: 89 &my_die("Couldn't find input file: $uri\n", $exp_id,$exp_name,$class_id,$uri,$ PS_EXIT_SYS_ERROR)89 &my_die("Couldn't find input file: $uri\n", $exp_id,$exp_name,$class_id,$uri,$state,$PS_EXIT_SYS_ERROR) 90 90 unless ($ipprc->file_exists($uri)); 91 91 my $uriReal = $ipprc->file_resolve( $uri ); … … 93 93 # Create a compressed version: 94 94 my $compUri = $uri . ".fz"; 95 &my_die("Output compressed file already exists: $compUri\n", $exp_id,$exp_name,$class_id,$uri,$ PS_EXIT_SYS_ERROR)95 &my_die("Output compressed file already exists: $compUri\n", $exp_id,$exp_name,$class_id,$uri,$state,$PS_EXIT_SYS_ERROR) 96 96 if ($ipprc->file_exists($compUri)); 97 97 my $compReal= $ipprc->file_resolve( $compUri, 'create'); … … 109 109 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 110 110 &my_die("Unable to uncompress file: $uri -> $compUri: $error_code", 111 $exp_id,$exp_name,$class_id,$uri, $ PS_EXIT_SYS_ERROR);111 $exp_id,$exp_name,$class_id,$uri, $state, $PS_EXIT_SYS_ERROR); 112 112 } 113 113 my $compress_command = "$fpack -h -s 8 -S $tempReal > $compReal"; … … 118 118 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 119 119 &my_die("Unable to compress file: $uri -> $compUri: $error_code", 120 $exp_id,$exp_name,$class_id,$uri, $ PS_EXIT_SYS_ERROR);120 $exp_id,$exp_name,$class_id,$uri, $state, $PS_EXIT_SYS_ERROR); 121 121 } 122 122 my $database_command = "$regtool -updateprocessedimfile -exp_id $exp_id -class_id $class_id -set_state compressed"; 123 123 $database_command .= " -dbname $dbname" if defined $dbname; 124 124 125 &my_die("Expected output compressed file not found: $compUri\n", $exp_id,$exp_name,$class_id, $uri,$ PS_EXIT_SYS_ERROR)125 &my_die("Expected output compressed file not found: $compUri\n", $exp_id,$exp_name,$class_id, $uri,$state, $PS_EXIT_SYS_ERROR) 126 126 unless ($ipprc->file_exists($compUri)); 127 127 … … 135 135 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 136 136 &my_die("Unable to update database file: $uri -> $compUri: $error_code", 137 $exp_id,$exp_name,$class_id,$uri, $ PS_EXIT_SYS_ERROR);137 $exp_id,$exp_name,$class_id,$uri, $state, $PS_EXIT_SYS_ERROR); 138 138 } 139 139 } … … 149 149 if ($state eq 'goto_lossy') { 150 150 # Confirm we have both files 151 &my_die("Couldn't find original file: $uri\n", $exp_id,$exp_name,$class_id,$uri,$ PS_EXIT_SYS_ERROR)151 &my_die("Couldn't find original file: $uri\n", $exp_id,$exp_name,$class_id,$uri,$state,$PS_EXIT_SYS_ERROR) 152 152 unless($ipprc->file_exists($uri)); 153 153 my $uriReal = $ipprc->file_resolve( $uri ); … … 156 156 unless($ipprc->file_exists($compUri)) { 157 157 &my_die("Couldn't find compressed version of the file: $compUri\n", 158 $exp_id,$exp_name,$class_id,$uri,$ PS_EXIT_SYS_ERROR);158 $exp_id,$exp_name,$class_id,$uri,$state,$PS_EXIT_SYS_ERROR); 159 159 160 160 # If that die is removed, this will compress things as well. … … 185 185 $neb->swap($uri,$compUri) or 186 186 &my_die("Nebulous swap failed between $uri and $compUri", 187 $exp_id,$exp_name,$class_id,$uri,$ PS_EXIT_SYS_ERROR);187 $exp_id,$exp_name,$class_id,$uri,$state,$PS_EXIT_SYS_ERROR); 188 188 } 189 189 # Update database … … 204 204 $neb->swap($uri,$compUri) or 205 205 &my_die("DB update failed and Nebulous swap-back failed between $uri and $compUri", 206 $exp_id,$exp_name,$class_id,$uri,$ PS_EXIT_SYS_ERROR);206 $exp_id,$exp_name,$class_id,$uri,$state,$PS_EXIT_SYS_ERROR); 207 207 &my_die("Unable to update database file: $uri -> $compUri: $error_code", 208 $exp_id,$exp_name,$class_id,$uri, $ PS_EXIT_SYS_ERROR);208 $exp_id,$exp_name,$class_id,$uri, $state,$PS_EXIT_SYS_ERROR); 209 209 } 210 210 # remove original version … … 224 224 my $class_id = shift; # Class identifier 225 225 my $uri = shift; # uri for the file 226 my $state = shift; 226 227 my $exit_code = shift; # Exit code 227 228 # outputImage and path_base are globals 229 my $fail_state = $state; 230 $fail_state =~ s/goto_/error_/; 231 my $error_command = "$regtool -updateprocessedimfile -exp_id $exp_id -class_id $class_id -set_state $fail_state "; 232 $error_command .= " -dbname $dbname" if defined $dbname; 233 my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) = 234 run(command => $error_command, verbose => $verbose); 235 unless($success) { 236 warn("Failed at setting the error state too."); 237 } 228 238 229 239 $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code; -
branches/czw_branch/20100519/ippScripts/scripts/magic_process.pl
r27987 r28304 151 151 152 152 my $kernel = $ipprc->filename("PPSUB.OUTPUT.KERNELS", $diff_base); # Name of kernel file 153 &my_die("Unable to find kernel file ", $magic_id, $node, $PS_EXIT_DATA_ERROR) unless $ipprc->file_exists($kernel);153 &my_die("Unable to find kernel file $kernel", $magic_id, $node, $PS_EXIT_DATA_ERROR) unless $ipprc->file_exists($kernel); 154 154 155 155 my ($image, $mask); # Image and mask … … 191 191 192 192 { 193 &my_die("Unable to find image and mask ", $magic_id, $node, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($image) and $ipprc->file_exists($mask);193 &my_die("Unable to find image and mask: $image $mask", $magic_id, $node, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($image) and $ipprc->file_exists($mask); 194 194 195 195 my $command = "$ppSubConvolve $tempPath -image $image -mask $mask -kernel $kernel"; … … 204 204 $template = $ipprc->filename("PPSUB.INPUT.CONV", $tempPath) or &my_die("Unable to determine filename for created template", $magic_id, $node, $PS_EXIT_PROG_ERROR); 205 205 $template = $ipprc->file_resolve($template) or &my_die("Unable to resolve filename for created template", $magic_id, $node, $PS_EXIT_PROG_ERROR); 206 &my_die("Unable to find created template ", $magic_id, $node, $PS_EXIT_PROG_ERROR) unless $ipprc->file_exists($template);206 &my_die("Unable to find created template: $template", $magic_id, $node, $PS_EXIT_PROG_ERROR) unless $ipprc->file_exists($template); 207 207 } 208 208 } -
branches/czw_branch/20100519/ippScripts/scripts/skycell_jpeg.pl
r28245 r28304 38 38 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2) if @ARGV; 39 39 pod2usage( 40 -msg => "Required options: --stage --stage_id -- outroot\nHelpful options: --camera --dbname",40 -msg => "Required options: --stage --stage_id --path_base\nHelpful options: --camera --dbname", 41 41 -exitval => 3, 42 42 ) unless … … 125 125 } 126 126 # Update database: 127 $command = "$warptool -addsummary -warp_id $stage_id -projection_cell $projection_cell - outroot$outroot";127 $command = "$warptool -addsummary -warp_id $stage_id -projection_cell $projection_cell -path_base $outroot"; 128 128 if (defined($dbname)) { 129 129 $command .= " -dbname $dbname"; … … 136 136 } 137 137 } 138 if (scalar (keys %tangents) == 0) { 139 my $projection_cell = 'NULL'; 140 $command = "$warptool -addsummary -warp_id $stage_id -projection_cell $projection_cell -path_base $outroot"; 141 if (defined($dbname)) { 142 $command .= " -dbname $dbname"; 143 } 144 145 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 146 unless ($success) { 147 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 148 &my_die("unable to update diff summary: $error_code", $stage_id, $error_code); 149 } 150 } 138 151 } #end warp stage 139 152 if ($stage eq 'diff') { … … 165 178 my $state = $imfile->{data_state}; 166 179 my $projection_cell = $skycell_id; 167 if ($quality == 8007 or $ state ne 'full') {180 if ($quality == 8007 or $quality = 1010 or $state ne 'full') { 168 181 next; 169 182 } … … 209 222 } 210 223 # Update database: 211 $command = "$difftool -addsummary -diff_id $stage_id -projection_cell $projection_cell - outroot$outroot";224 $command = "$difftool -addsummary -diff_id $stage_id -projection_cell $projection_cell -path_base $outroot"; 212 225 if (defined($dbname)) { 213 226 $command .= " -dbname $dbname"; … … 220 233 } 221 234 } 235 if (scalar (keys %tangents) == 0) { 236 my $projection_cell = 'NULL'; 237 $command = "$difftool -addsummary -diff_id $stage_id -projection_cell $projection_cell -path_base $outroot"; 238 if (defined($dbname)) { 239 $command .= " -dbname $dbname"; 240 } 241 242 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 243 unless ($success) { 244 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 245 &my_die("unable to update diff summary: $error_code", $stage_id, $error_code); 246 } 247 } 222 248 } #end diff stage 223 249 if ($stage eq 'stack') { 224 250 my $imfiles; 225 my $command = "$stacktool -s tackskyfile -stack_id $stage_id";251 my $command = "$stacktool -sassskyfile -sass_id $stage_id"; 226 252 if (defined($dbname)) { 227 253 $command .= " -dbname $dbname"; … … 248 274 my $quality = $imfile->{quality}; 249 275 my $state = $imfile->{data_state}; 276 my $fault = $imfile->{fault}; 250 277 my $projection_cell = $skycell_id; 251 if ($quality == 8007 or $state ne 'full' ) {278 if ($quality == 8007 or $state ne 'full' or $fault != 0) { 252 279 next; 253 280 } … … 293 320 } 294 321 # Update database: 295 $command = "$stacktool -addsummary -s tack_id $stage_id -projection_cell $projection_cell -outroot$outroot";322 $command = "$stacktool -addsummary -sass_id $stage_id -projection_cell $projection_cell -path_base $outroot"; 296 323 if (defined($dbname)) { 297 324 $command .= " -dbname $dbname"; … … 304 331 } 305 332 } 333 if (scalar (keys %tangents) == 0) { 334 my $projection_cell = 'NULL'; 335 $command = "$stacktool -addsummary -stack_id $stage_id -projection_cell $projection_cell -path_base $outroot"; 336 if (defined($dbname)) { 337 $command .= " -dbname $dbname"; 338 } 339 340 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 341 unless ($success) { 342 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 343 &my_die("unable to update diff summary: $error_code", $stage_id, $error_code); 344 } 345 } 346 306 347 } #end stack stage 307 348 -
branches/czw_branch/20100519/ippScripts/scripts/stack_skycell.pl
r28043 r28304 149 149 my $recipe_ppSub = $ipprc->reduction($reduction, 'STACK_PPSUB'); # Recipe to use for ppSub 150 150 my $recipe_psphot = $ipprc->reduction($reduction, 'STACK_PSPHOT'); # Recipe to use for psphot 151 my $recipe_ppstats = 'STACKSTATS'; 152 if ($run_state eq 'update') { 153 $recipe_ppstats = 'WARPSTATS'; 154 } 151 155 unless ($recipe_ppStack and $recipe_ppSub and $recipe_psphot) { 152 156 &my_die("Couldn't find selected reduction for STACK_PPSTACK, STACK_PPSUB and STACK_PSPHOT: $reduction\n", $stack_id, $PS_EXIT_CONFIG_ERROR); … … 232 236 $command .= " -recipe PPSUB $recipe_ppSub"; 233 237 $command .= " -recipe PSPHOT $recipe_psphot"; 234 $command .= " -recipe PPSTATS STACKSTATS" if $do_stats;;238 $command .= " -recipe PPSTATS $recipe_ppstats" if $do_stats;; 235 239 $command .= " -F PSPHOT.PSF.SAVE PSPHOT.PSF.SKY.SAVE"; 236 240 $command .= " -F PSPHOT.OUTPUT PSPHOT.OUT.CMF.MEF"; -
branches/czw_branch/20100519/ippScripts/scripts/staticsky.pl
r28164 r28304 38 38 } 39 39 40 my ($sky_id, $camera, $dbname, $threads, $outroot, $reduction, $inverse, $run_state, $verbose, $no_update, $no_op, $redirect, $save_temps); 40 # XXX test: 41 print "run staticsky.pl @ARGV\n"; 42 # exit 0; 43 44 my ($sky_id, $camera, $dbname, $threads, $outroot, $reduction, $verbose, $no_update, $no_op, $redirect, $save_temps); 41 45 GetOptions( 42 46 'sky_id=s' => \$sky_id, # Diff identifier … … 44 48 'dbname|d=s' => \$dbname, # Database name 45 49 'threads=s' => \$threads, # Number of threads to use 46 'run-state=s' => \$run_state, # state for run: 'new' or 'update'47 50 'outroot=s' => \$outroot, # Output root name 48 51 'reduction=s' => \$reduction, # Reduction class … … 56 59 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 57 60 pod2usage( 58 -msg => "Required options: --sky_id --outroot --camera (--run_state)",61 -msg => "Required options: --sky_id --outroot --camera", 59 62 -exitval => 3, 60 63 ) unless … … 62 65 defined $outroot and 63 66 defined $camera; 64 # and defined $run_state;65 67 66 68 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $sky_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 67 69 68 70 my $logDest = $ipprc->filename("LOG.EXP", $outroot); 69 # $logDest .= ".update" if $run_state eq "update";70 71 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $sky_id, $PS_EXIT_SYS_ERROR ) if $redirect; 71 72 … … 85 86 unless ($success) { 86 87 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 87 &my_die("Unable to perform difftool -inputskyfile: $error_code", $sky_id, $error_code);88 &my_die("Unable to perform staticskytool -inputs: $error_code", $sky_id, $error_code); 88 89 } 89 90 … … 152 153 print "recipe_psphot: $recipe_psphot\n"; 153 154 154 my $cmdflags;155 156 # Perform s ubtraction155 # my $cmdflags; 156 157 # Perform stack photometry analysis 157 158 { 158 159 my $command = "$psphotStack $outroot"; … … 167 168 168 169 unless ($no_op) { 169 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 170 run(command => $command, verbose => $verbose); 171 unless ($success) { 172 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 173 &my_die("Unable to perform ppSub: $error_code", $sky_id, $error_code); 174 } 170 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 171 unless ($success) { 172 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 173 &my_die("Unable to perform psphotStack: $error_code", $sky_id, $error_code); 174 } 175 175 176 176 # my $outputStatsReal = $ipprc->file_resolve($outputStats); … … 190 190 # chomp $cmdflags; 191 191 192 my ($quality) = $cmdflags =~ /-quality (\d+)/; # Quality flag 193 192 # my ($quality) = $cmdflags =~ /-quality (\d+)/; # Quality flag 193 194 my $quality = 0; 194 195 if (!$quality) { 195 196 … … 197 198 # we have one set of output files per input file set 198 199 for (my $i = 0; $i < @$files; $i++) { 199 my $outputName = $ipprc->filename("PSPHOT.STACK.OUTPUT.IMAGE", $outroot );200 my $outputMask = $ipprc->filename("PSPHOT.STACK.OUTPUT.MASK", $outroot );201 my $outputVariance = $ipprc->filename("PSPHOT.STACK.OUTPUT.VARIANCE", $outroot );202 my $outputSources = $ipprc->filename("PSPHOT.STACK.OUTPUT", $outroot );200 my $outputName = $ipprc->filename("PSPHOT.STACK.OUTPUT.IMAGE", $outroot, $i); 201 my $outputMask = $ipprc->filename("PSPHOT.STACK.OUTPUT.MASK", $outroot, $i); 202 my $outputVariance = $ipprc->filename("PSPHOT.STACK.OUTPUT.VARIANCE", $outroot, $i); 203 my $outputSources = $ipprc->filename("PSPHOT.STACK.OUTPUT", $outroot, $i); 203 204 204 205 &my_die("Couldn't find expected output file: $outputName", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName); … … 211 212 #my $outputStats = $ipprc->filename("SKYCELL.STATS", $outroot); 212 213 #my $traceDest = $ipprc->filename("TRACE.EXP", $outroot); 213 214 # if ($run_state eq 'update') {215 # $traceDest .= '.update';216 # $outputStats .= '.update';217 # }218 214 219 215 my $chisqName = $ipprc->filename("PSPHOT.CHISQ.IMAGE", $outroot); … … 235 231 { 236 232 my $command = "$staticskytool -sky_id $sky_id"; 237 # if ($run_state eq 'new') {238 233 $command .= " -addresult -path_base $outroot"; 239 234 $command .= " -num_inputs $nInputs"; 240 $command .= " $cmdflags";235 # $command .= " $cmdflags"; 241 236 $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400)); 242 237 $command .= " -hostname $host" if defined $host; 243 # } else {244 # $command .= " -tofullskyfile";245 # }246 238 $command .= " -dbname $dbname" if defined $dbname; 247 239 … … 250 242 unless ($success) { 251 243 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 252 my $err_message = $run_state eq "update" ? 253 "Unable to perform difftool -adddiffskyfile" : 254 "Unable to perform difftool -tofullskyfile"; 255 &my_die("$err_message: $error_code", $sky_id, $error_code); 244 my $err_message = "Unable to perform staticskytool -addresult"; 245 warn($err_message); 246 exit $error_code; 256 247 } 257 248 } … … 270 261 if (defined $sky_id and not $no_update) { 271 262 my $command = "$staticskytool -sky_id $sky_id -fault $exit_code"; 272 if ($run_state eq 'new') { 273 $command .= " -adddiffskyfile"; 274 $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400)); 275 $command .= " -hostname $host" if defined $host; 276 $command .= " -path_base $outroot" if defined $outroot; 277 $command .= " -dbname $dbname" if defined $dbname; 278 } else { 279 $command .= " -updatediffskyfile"; 280 } 263 $command .= " -addresult"; 264 $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400)); 265 $command .= " -hostname $host" if defined $host; 266 $command .= " -path_base $outroot" if defined $outroot; 267 $command .= " -dbname $dbname" if defined $dbname; 281 268 run(command => $command, verbose => $verbose); 282 269 }
Note:
See TracChangeset
for help on using the changeset viewer.
