Changeset 17803
- Timestamp:
- May 23, 2008, 5:10:21 PM (18 years ago)
- Location:
- trunk/ippScripts/scripts
- Files:
-
- 7 edited
-
camera_exp.pl (modified) (10 diffs)
-
chip_imfile.pl (modified) (11 diffs)
-
diff_skycell.pl (modified) (2 diffs)
-
register_exp.pl (modified) (10 diffs)
-
register_imfile.pl (modified) (7 diffs)
-
stack_skycell.pl (modified) (13 diffs)
-
warp_skycell.pl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/camera_exp.pl
r17671 r17803 29 29 $no_op, $save_temps ); 30 30 GetOptions( 31 'exp_tag=s' => \$exp_tag, # Exposure identifier32 'cam_id=s' => \$cam_id, # Camtool identifier33 'recipe=s' => \$recipe, # Recipe to use34 'camera|c=s' => \$camera, # Camera35 'dbname|d=s' => \$dbname, # Database name36 'outroot|w=s' => \$outroot, # output file base name37 'reduction=s' => \$reduction, # Reduction class 38 'dvodb|w=s' => \$dvodb, # output DVO database39 'verbose' => \$verbose, # Print to stdout40 'no-update' => \$no_update, # Update the database?41 'no-op' => \$no_op, # Don't do any operations?42 'save-temps' => \$save_temps, # Save temporary files?43 ) or pod2usage( 2 );31 'exp_tag=s' => \$exp_tag, # Exposure identifier 32 'cam_id=s' => \$cam_id, # Camtool identifier 33 'recipe=s' => \$recipe, # Recipe to use 34 'camera|c=s' => \$camera, # Camera 35 'dbname|d=s' => \$dbname, # Database name 36 'outroot|w=s' => \$outroot, # output file base name 37 'reduction=s' => \$reduction, # Reduction class 38 'dvodb|w=s' => \$dvodb, # output DVO database 39 'verbose' => \$verbose, # Print to stdout 40 'no-update' => \$no_update, # Update the database? 41 'no-op' => \$no_op, # Don't do any operations? 42 'save-temps' => \$save_temps, # Save temporary files? 43 ) or pod2usage( 2 ); 44 44 45 45 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 46 46 pod2usage( 47 -msg => "Required options: --exp_tag --cam_id --camera --outroot",48 -exitval => 3,49 ) unless 47 -msg => "Required options: --exp_tag --cam_id --camera --outroot", 48 -exitval => 3, 49 ) unless 50 50 defined $exp_tag and 51 51 defined $cam_id and … … 66 66 # values to extract from output metadata and the stats to calculate 67 67 # these should be coming from the psastro results 68 my $CHIPSTATS = 69 [ 70 # PPSTATS KEYWORD STATISTIC CHIPTOOL FLAG71 { name => "bg", type => "mean", flag => "-bg",dtype => "float" },72 { name => "bg_stdev", type => "rms", flag => "-bg_stdev", dtype => "float" }, 73 { name => "bg_mean_stdev", type => "stdev", flag => "-bg_mean_stdev",dtype => "float" },74 { name => "bias", type => "mean", flag => "-bias", dtype => "float" }, 75 { name => "bias_stdev", type => "rms", flag => "-bias_stdev", dtype => "float" }, 76 { name => "fringe_0", type => "mean", flag => "-fringe_0", dtype => "float" },77 { name => "fringe_1", type => "rms", flag => "-fringe_1", dtype => "float" },78 { name => "fringe_0", type => "stdev", flag => "-fringe_2", dtype => "float" },79 { name => "sigma_ra", type => "rms", flag => "-sigma_ra", dtype => "float" }, 80 { name => "sigma_dec", type => "rms", flag => "-sigma_dec", dtype => "float" }, 81 { name => "ap_resid", type => "mean", flag => "-ap_resid", dtype => "float" }, 82 { name => "ap_resid_stdev", type => "rms", flag => "-ap_resid_stdev", dtype => "float" }, 83 { name => "zp_mean", type => "mean", flag => "-zp_mean", dtype => "float" }, 84 { name => "zp_stdev", type => "rms", flag => "-zp_stdev", dtype => "float" }, 85 { name => "fwhm_major", type => "mean", flag => "-fwhm_major", dtype => "float" }, 86 { name => "fwhm_minor", type => "mean", flag => "-fwhm_minor", dtype => "float" }, 87 { name => "dtime_detrend", type => "sum", flag => "-dtime_detrend", dtype => "float" }, 88 { name => "dtime_photom", type => "sum", flag => "-dtime_photom", dtype => "float" }, 89 { name => "dtime_astrom", type => "sum", flag => "-dtime_astrom", dtype => "float" }, 90 { name => "n_stars", type => "sum", flag => "-n_stars", dtype => "int" }, 91 { name => "n_extended", type => "sum", flag => "-n_extended", dtype => "int" }, 92 { name => "n_cr", type => "sum", flag => "-n_cr", dtype => "int" }, 93 { name => "n_astrom", type => "sum", flag => "-n_astrom", dtype => "int" }, 68 my $CHIPSTATS = 69 [ 70 # PPSTATS KEYWORD STATISTIC CHIPTOOL FLAG 71 { name => "bg", type => "mean", flag => "-bg", dtype => "float" }, 72 { name => "bg_stdev", type => "rms", flag => "-bg_stdev", dtype => "float" }, 73 { name => "bg_mean_stdev", type => "stdev", flag => "-bg_mean_stdev", dtype => "float" }, 74 { name => "bias", type => "mean", flag => "-bias", dtype => "float" }, 75 { name => "bias_stdev", type => "rms", flag => "-bias_stdev", dtype => "float" }, 76 { name => "fringe_0", type => "mean", flag => "-fringe_0", dtype => "float" }, 77 { name => "fringe_1", type => "rms", flag => "-fringe_1", dtype => "float" }, 78 { name => "fringe_0", type => "stdev", flag => "-fringe_2", dtype => "float" }, 79 { name => "sigma_ra", type => "rms", flag => "-sigma_ra", dtype => "float" }, 80 { name => "sigma_dec", type => "rms", flag => "-sigma_dec", dtype => "float" }, 81 { name => "ap_resid", type => "mean", flag => "-ap_resid", dtype => "float" }, 82 { name => "ap_resid_stdev", type => "rms", flag => "-ap_resid_stdev", dtype => "float" }, 83 { name => "zp_mean", type => "mean", flag => "-zp_mean", dtype => "float" }, 84 { name => "zp_stdev", type => "rms", flag => "-zp_stdev", dtype => "float" }, 85 { name => "fwhm_major", type => "mean", flag => "-fwhm_major", dtype => "float" }, 86 { name => "fwhm_minor", type => "mean", flag => "-fwhm_minor", dtype => "float" }, 87 { name => "dtime_detrend", type => "sum", flag => "-dtime_detrend", dtype => "float" }, 88 { name => "dtime_photom", type => "sum", flag => "-dtime_photom", dtype => "float" }, 89 { name => "dtime_astrom", type => "sum", flag => "-dtime_astrom", dtype => "float" }, 90 { name => "n_stars", type => "sum", flag => "-n_stars", dtype => "int" }, 91 { name => "n_extended", type => "sum", flag => "-n_extended", dtype => "int" }, 92 { name => "n_cr", type => "sum", flag => "-n_cr", dtype => "int" }, 93 { name => "n_astrom", type => "sum", flag => "-n_astrom", dtype => "int" }, 94 94 95 95 96 96 # these are not defined for the database table camProcessedExp 97 ];97 ]; 98 98 my $chipStats = PS::IPP::Metadata::Stats->new($CHIPSTATS); # Stats parser 99 99 … … 108 108 my $addstar = can_run('addstar') or (warn "Can't find addstar" and $missing_tools = 1); 109 109 110 if ($missing_tools) { 110 if ($missing_tools) { 111 111 warn("Can't find required tools."); 112 exit($PS_EXIT_CONFIG_ERROR); 113 } 114 115 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files112 exit($PS_EXIT_CONFIG_ERROR); 113 } 114 115 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 116 116 117 117 # Get list of component files 118 my $files; # Array of component files118 my $files; # Array of component files 119 119 { 120 120 my $command = "$camtool -pendingimfile -cam_id $cam_id"; # Command to run 121 121 $command .= " -dbname $dbname" if defined $dbname; 122 122 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 123 run(command => $command, verbose => $verbose);123 run(command => $command, verbose => $verbose); 124 124 unless ($success) { 125 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);126 &my_die("Unable to perform camtool: $error_code", $cam_id, $error_code);125 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 126 &my_die("Unable to perform camtool: $error_code", $cam_id, $error_code); 127 127 } 128 128 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 129 &my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_PROG_ERROR);129 &my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_PROG_ERROR); 130 130 131 131 # extract the metadata for the files into a hash list 132 132 $files = parse_md_list($metadata) or 133 &my_die("Unable to parse metadata list", $cam_id, $PS_EXIT_PROG_ERROR);133 &my_die("Unable to parse metadata list", $cam_id, $PS_EXIT_PROG_ERROR); 134 134 135 135 # extract the stats from the metadata 136 136 unless ($chipStats->parse($metadata)) { 137 &my_die("Unable to find all values in statistics output.\n", $cam_id, $PS_EXIT_PROG_ERROR);137 &my_die("Unable to find all values in statistics output.\n", $cam_id, $PS_EXIT_PROG_ERROR); 138 138 } 139 139 } … … 145 145 146 146 # XXX we perform astrometry iff photometry output exists 147 my $chipObjects; 147 my $chipObjects; 148 148 my $chipObjectsExist = 0; 149 149 foreach my $file (@$files) { … … 160 160 # if any of the output chip photometry files exist, we can run psastro / addstar below 161 161 if ($ipprc->file_exists($chipObjects)) { 162 $chipObjectsExist = 1;162 $chipObjectsExist = 1; 163 163 } 164 164 } … … 171 171 172 172 # the camera configurations should define the psastro output to be a single file (MEF), regardless of the inputs 173 my $jpeg1 = $ipprc->filename("PPIMAGE.JPEG1", $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);174 my $jpeg2 = $ipprc->filename("PPIMAGE.JPEG2", $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);173 my $jpeg1 = $ipprc->filename("PPIMAGE.JPEG1", $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR); 174 my $jpeg2 = $ipprc->filename("PPIMAGE.JPEG2", $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR); 175 175 my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT", $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR); 176 176 my $traceDest = $ipprc->filename("TRACE.EXP", $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR); 177 my $logDest = $ipprc->filename("LOG.EXP", $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);177 my $logDest = $ipprc->filename("LOG.EXP", $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR); 178 178 179 179 # convert supplied DVO database name to UNIX filename … … 190 190 # Make the jpeg for binning 1 191 191 { 192 my $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run193 $command .= " -dbname $dbname" if defined $dbname;194 195 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =196 run(command => $command, verbose => $verbose);197 unless ($success) {198 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);199 &my_die("Unable to perform ppImage: $error_code", $cam_id, $error_code);200 }201 &my_die("Unable to find expected output file: $jpeg1", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($jpeg1);192 my $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run 193 $command .= " -dbname $dbname" if defined $dbname; 194 195 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 196 run(command => $command, verbose => $verbose); 197 unless ($success) { 198 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 199 &my_die("Unable to perform ppImage: $error_code", $cam_id, $error_code); 200 } 201 &my_die("Unable to find expected output file: $jpeg1", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($jpeg1); 202 202 } 203 203 204 204 # Make the jpeg for binning 2 205 205 { 206 my $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run207 $command .= " -dbname $dbname" if defined $dbname;208 209 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =210 run(command => $command, verbose => $verbose);211 unless ($success) {212 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);213 &my_die("Unable to perform ppImage: $error_code", $cam_id, $error_code);214 }215 &my_die("Unable to find expected output file: $jpeg2", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($jpeg2);206 my $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run 207 $command .= " -dbname $dbname" if defined $dbname; 208 209 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 210 run(command => $command, verbose => $verbose); 211 unless ($success) { 212 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 213 &my_die("Unable to perform ppImage: $error_code", $cam_id, $error_code); 214 } 215 &my_die("Unable to find expected output file: $jpeg2", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($jpeg2); 216 216 } 217 217 218 218 # only run psastro / addstar if any of the output chip astrometry files exist (should we test for successful astrometry?) 219 219 if ($chipObjectsExist) { 220 # run psastro on the chipObjects, producing fpaObjects221 # XXX add a ppStats call which will collect the astrometry stats222 my $command;223 $command = "$psastro -list $list3Name $outroot";224 $command .= " -tracedest $traceDest -log $logDest";225 $command .= " -dbname $dbname" if defined $dbname;226 227 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =228 run(command => $command, verbose => $verbose);229 unless ($success) {230 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);231 &my_die("Unable to perform psastro: $error_code", $cam_id, $error_code);232 }233 # XXX do we want to give an error if astrometry fails here?234 &my_die("Unable to find expected output file: $fpaObjects", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($fpaObjects);235 236 # run addstar on the output fpaObjects (if a DVO database is defined)237 if (defined $dvodbReal) {238 # XXX this construct requires the user to have a valid .ptolemyrc 239 # XXX which in turn points at ippconfig/dvo.site240 # require a defined output dvo database to run addstar (ie, refuse to use the .ptolemyrc default)241 # XXX this needs to be converted to addstar_client...242 243 my $camdir = $ipprc->dvo_cameradir(); # Camera directory for addstar244 my $command;245 $command = "$addstar -D CAMERA $camdir -update";246 $command .= " -D CATDIR $dvodbReal";247 248 my $realFile = $ipprc->file_resolve($fpaObjects);249 $command .= " $realFile";250 251 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =252 run(command => $command, verbose => $verbose);253 unless ($success) {254 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);255 &my_die("Unable to perform addstar: $error_code", $cam_id, $error_code);256 }257 }220 # run psastro on the chipObjects, producing fpaObjects 221 # XXX add a ppStats call which will collect the astrometry stats 222 my $command; 223 $command = "$psastro -list $list3Name $outroot"; 224 $command .= " -tracedest $traceDest -log $logDest"; 225 $command .= " -dbname $dbname" if defined $dbname; 226 227 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 228 run(command => $command, verbose => $verbose); 229 unless ($success) { 230 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 231 &my_die("Unable to perform psastro: $error_code", $cam_id, $error_code); 232 } 233 # XXX do we want to give an error if astrometry fails here? 234 &my_die("Unable to find expected output file: $fpaObjects", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($fpaObjects); 235 236 # run addstar on the output fpaObjects (if a DVO database is defined) 237 if (defined $dvodbReal) { 238 # XXX this construct requires the user to have a valid .ptolemyrc 239 # XXX which in turn points at ippconfig/dvo.site 240 # require a defined output dvo database to run addstar (ie, refuse to use the .ptolemyrc default) 241 # XXX this needs to be converted to addstar_client... 242 243 my $camdir = $ipprc->dvo_cameradir(); # Camera directory for addstar 244 my $command; 245 $command = "$addstar -D CAMERA $camdir -update"; 246 $command .= " -D CATDIR $dvodbReal"; 247 248 my $realFile = $ipprc->file_resolve($fpaObjects); 249 $command .= " $realFile"; 250 251 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 252 run(command => $command, verbose => $verbose); 253 unless ($success) { 254 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 255 &my_die("Unable to perform addstar: $error_code", $cam_id, $error_code); 256 } 257 } 258 258 } 259 259 } … … 263 263 $fpaCommand .= " -uri UNKNOWN"; 264 264 $fpaCommand .= " -path_base $outroot"; 265 $fpaCommand .= " -hostname $host" if defined $host; 265 266 $fpaCommand .= " -dbname $dbname" if defined $dbname; 266 267 $fpaCommand .= $chipStats->cmdflags(); … … 269 270 unless ($no_update) { 270 271 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 271 run(command => $fpaCommand, verbose => $verbose);272 run(command => $fpaCommand, verbose => $verbose); 272 273 unless ($success) { 273 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);274 warn("Unable to add result to database: $error_code\n");275 exit($error_code);274 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 275 warn("Unable to add result to database: $error_code\n"); 276 exit($error_code); 276 277 } 277 278 } else { … … 288 289 carp($msg); 289 290 if (defined $cam_id and not $no_update) { 290 my $command = "$camtool -addprocessedexp -cam_id $cam_id -uri UNKNOWN -code $exit_code"; 291 $command .= " -dbname $dbname" if defined $dbname; 291 my $command = "$camtool -addprocessedexp -cam_id $cam_id -uri UNKNOWN -code $exit_code"; 292 $command .= " -hostname $host" if defined $host; 293 $command .= " -dbname $dbname" if defined $dbname; 292 294 system ($command); 293 295 } -
trunk/ippScripts/scripts/chip_imfile.pl
r17671 r17803 28 28 $no_update, $no_op ); 29 29 GetOptions( 30 'exp_id=s' => \$exp_id, # Exposure identifier31 'exp_tag=s' => \$exp_tag, # Exposure identifier32 'chip_id=s' => \$chip_id, # Chiptool identifier33 'class_id=s' => \$class_id, # Class identifier34 'uri|u=s' => \$uri, # Input FITS file35 'camera|c=s' => \$camera,# Camera36 'outroot|w=s' => \$outroot, # output file base name37 'dbname|d=s' => \$dbname, # Database name38 'reduction=s' => \$reduction, # Reduction class39 'verbose' => \$verbose, # Print to stdout40 'no-update' => \$no_update, # Don't update the database?41 'no-op' => \$no_op,# Don't do any operations?42 ) or pod2usage( 2 );30 'exp_id=s' => \$exp_id, # Exposure identifier 31 'exp_tag=s' => \$exp_tag, # Exposure identifier 32 'chip_id=s' => \$chip_id, # Chiptool identifier 33 'class_id=s' => \$class_id, # Class identifier 34 'uri|u=s' => \$uri, # Input FITS file 35 'camera|c=s' => \$camera, # Camera 36 'outroot|w=s' => \$outroot, # output file base name 37 'dbname|d=s' => \$dbname, # Database name 38 'reduction=s' => \$reduction, # Reduction class 39 'verbose' => \$verbose, # Print to stdout 40 'no-update' => \$no_update, # Don't update the database? 41 'no-op' => \$no_op, # Don't do any operations? 42 ) or pod2usage( 2 ); 43 43 44 44 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 45 45 pod2usage( -msg => "Required options: --exp_id --exp_tag --chip_id --class_id --uri --camera --outroot", 46 -exitval => 3) unless46 -exitval => 3) unless 47 47 defined $exp_id and 48 48 defined $exp_tag and … … 74 74 { name => "ROBUST_MEDIAN", type => "stdev", flag => "-bg_mean_stdev", dtype => "float" }, 75 75 { name => "ROBUST_STDEV", type => "rms", flag => "-bg_stdev", dtype => "float" }, 76 { name => "OVER_VAL", type => "mean", flag => "-bias", dtype => "float" },76 { name => "OVER_VAL", type => "mean", flag => "-bias", dtype => "float" }, 77 77 { name => "OVER_VAL", type => "stdev", flag => "-bias_stdev", dtype => "float" }, 78 78 { name => "FRINGE_0", type => "rms", flag => "-fringe_0", dtype => "float" }, … … 107 107 } 108 108 109 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files109 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 110 110 111 111 &my_die("Couldn't find input file: $uri\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($uri); … … 124 124 my $outputWeight = $ipprc->filename("PPIMAGE.CHIP.WEIGHT", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR); 125 125 my $outputBin1 = $ipprc->filename("PPIMAGE.BIN1", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR); 126 my $outputBin2 = $ipprc->filename("PPIMAGE.BIN2", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);127 my $outputStats = $ipprc->filename("PPIMAGE.STATS", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);128 my $traceDest = $ipprc->filename("TRACE.IMFILE", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);129 my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);126 my $outputBin2 = $ipprc->filename("PPIMAGE.BIN2", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR); 127 my $outputStats = $ipprc->filename("PPIMAGE.STATS", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR); 128 my $traceDest = $ipprc->filename("TRACE.IMFILE", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR); 129 my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR); 130 130 131 131 # Run ppImage … … 141 141 142 142 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 143 run(command => $command, verbose => $verbose);143 run(command => $command, verbose => $verbose); 144 144 unless ($success) { 145 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);146 &my_die("Unable to perform ppImage: $error_code", $exp_id, $chip_id, $class_id, $error_code);145 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 146 &my_die("Unable to perform ppImage: $error_code", $exp_id, $chip_id, $class_id, $error_code); 147 147 } 148 148 … … 150 150 $command = "$ppConfigDump -camera $camera -dump-recipe PPIMAGE -recipe PPIMAGE $recipe -"; 151 151 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 152 run(command => $command, verbose => $verbose);152 run(command => $command, verbose => $verbose); 153 153 unless ($success) { 154 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);155 &my_die("Unable to perform ppConfigDump: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);154 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 155 &my_die("Unable to perform ppConfigDump: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 156 156 } 157 157 my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or 158 &my_die("Unable to parse metadata config doc", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);158 &my_die("Unable to parse metadata config doc", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 159 159 160 160 ## allow the output images to be optional, depending on the recipe / reduction class 161 161 my $outputImageExpect = metadataLookupBool($recipeData, 'CHIP.FITS'); 162 162 if ($outputImageExpect) { 163 &my_die("Couldn't find expected output file: $outputImage\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage);163 &my_die("Couldn't find expected output file: $outputImage\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage); 164 164 } 165 165 166 166 my $outputMaskExpect = metadataLookupBool($recipeData, 'CHIP.MASK.FITS'); 167 167 if ($outputMaskExpect) { 168 &my_die("Couldn't find expected output file: $outputMask\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);168 &my_die("Couldn't find expected output file: $outputMask\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask); 169 169 } 170 170 171 171 my $outputWeightExpect = metadataLookupBool($recipeData, 'CHIP.WEIGHT.FITS'); 172 172 if ($outputWeightExpect) { 173 &my_die("Couldn't find expected output file: $outputWeight\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight);173 &my_die("Couldn't find expected output file: $outputWeight\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight); 174 174 } 175 175 … … 179 179 180 180 # Get the statistics on the processed image 181 my $statsFile; # File handle181 my $statsFile; # File handle 182 182 open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 183 183 my @contents = <$statsFile>; # Contents of file … … 185 185 186 186 # parse the statistics MDC file 187 my $mdcParser = PS::IPP::Metadata::Config->new(); # Parser for metadata config files187 my $mdcParser = PS::IPP::Metadata::Config->new(); # Parser for metadata config files 188 188 my $metadata = $mdcParser->parse(join "", @contents); 189 189 unless ($metadata) { 190 &my_die("Unable to parse metadata config doc", $exp_id, $chip_id, $class_id, $PS_EXIT_PROG_ERROR);190 &my_die("Unable to parse metadata config doc", $exp_id, $chip_id, $class_id, $PS_EXIT_PROG_ERROR); 191 191 } 192 192 193 193 # extract the stats from the metadata 194 194 unless ($stats->parse($metadata)) { 195 &my_die("Failure extracting metadata from the statistics output file.\n", $exp_id, $chip_id, $class_id, $PS_EXIT_PROG_ERROR);195 &my_die("Failure extracting metadata from the statistics output file.\n", $exp_id, $chip_id, $class_id, $PS_EXIT_PROG_ERROR); 196 196 } 197 197 } … … 204 204 $command .= " -uri $outputImage"; 205 205 $command .= " -path_base $outroot"; 206 $command .= " -hostname $host" if defined $host; 206 207 $command .= " -dbname $dbname" if defined $dbname; 207 208 $command .= $stats->cmdflags(); … … 210 211 unless ($no_update) { 211 212 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 212 run(command => $command, verbose => $verbose);213 run(command => $command, verbose => $verbose); 213 214 unless ($success) { 214 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);215 warn("Unable to perform chiptool -addprocessedimfile: $error_code\n");216 exit($error_code);215 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 216 warn("Unable to perform chiptool -addprocessedimfile: $error_code\n"); 217 exit($error_code); 217 218 } 218 219 } else { … … 230 231 carp($msg); 231 232 if (defined $chip_id and defined $class_id and not $no_update) { 232 my $command = "$chiptool -addprocessedimfile"; 233 $command .= " -exp_id $exp_id"; 234 $command .= " -chip_id $chip_id"; 235 $command .= " -class_id $class_id"; 236 $command .= " -code $exit_code"; 237 $command .= " -uri $outputImage"; 238 $command .= " -dbname $dbname" if defined $dbname; 233 my $command = "$chiptool -addprocessedimfile"; 234 $command .= " -exp_id $exp_id"; 235 $command .= " -chip_id $chip_id"; 236 $command .= " -class_id $class_id"; 237 $command .= " -code $exit_code"; 238 $command .= " -uri $outputImage"; 239 $command .= " -hostname $host" if defined $host; 240 $command .= " -dbname $dbname" if defined $dbname; 239 241 system ($command); 240 242 } -
trunk/ippScripts/scripts/diff_skycell.pl
r17797 r17803 213 213 my $command = "$difftool -adddiffskyfile -diff_id $diff_id -uri $outputName -path_base $outroot"; 214 214 $command .= $stats->cmdflags(); 215 $command .= " -hostname $host" if defined $host; 215 216 $command .= " -dbname $dbname" if defined $dbname; 216 217 … … 248 249 if (defined $diff_id and not $no_update) { 249 250 my $command = "$difftool -adddiffskyfile -diff_id $diff_id -code $exit_code"; 251 $command .= " -hostname $host" if defined $host; 250 252 $command .= " -dbname $dbname" if defined $dbname; 251 253 run(command => $command, verbose => $verbose); -
trunk/ippScripts/scripts/register_exp.pl
r17671 r17803 30 30 'exp_id|e=s' => \$exp_id, 31 31 'exp_tag|t=s' => \$exp_tag, 32 'dbname|d=s' => \$dbname, # Database name 32 'dbname|d=s' => \$dbname, # Database name 33 33 'verbose' => \$verbose, # Print to stdout 34 34 'no-update' => \$no_update, … … 38 38 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 39 39 pod2usage( -msg => "Required options: --exp_id --exp_tag", 40 -exitval => 3) unless40 -exitval => 3) unless 41 41 defined $exp_id and 42 42 defined $exp_tag; … … 47 47 48 48 # values to extract from output metadata and the stats to calculate 49 my $STATS = 49 my $STATS = 50 50 [ # register imfile 51 51 # label STATISTIC CHIPTOOL FLAG … … 83 83 { name => "env_wind_dir", type => "constant", flag => "-env_wind_dir", dtype => "float" }, # external wind direction 84 84 85 { name => "-teltemp_m1", type => "constant", flag => "-teltemp_m1", dtype => "float" }, # Primary mirror temps (C) 86 { name => "-teltemp_m1cell", type => "constant", flag => "-teltemp_m1cell", dtype => "float" }, # Primary mirror support temps (C) 87 { name => "-teltemp_m2", type => "constant", flag => "-teltemp_m2", dtype => "float" }, # Secondary mirror temps (C 88 { name => "-teltemp_spider", type => "constant", flag => "-teltemp_spider", dtype => "float" }, # Spider temperatures (C) 89 { name => "-teltemp_truss", type => "constant", flag => "-teltemp_truss", dtype => "float" }, # Mid truss temperatures (C 90 { name => "-teltemp_extra", type => "constant", flag => "-teltemp_extra", dtype => "float" }, # Miscellaneous temperatures (C) 85 { name => "-teltemp_m1", type => "constant", flag => "-teltemp_m1", dtype => "float" }, # Primary mirror temps (C) 86 { name => "-teltemp_m1cell", type => "constant", flag => "-teltemp_m1cell", dtype => "float" }, # Primary mirror support temps (C) 87 { name => "-teltemp_m2", type => "constant", flag => "-teltemp_m2", dtype => "float" }, # Secondary mirror temps (C 88 { name => "-teltemp_spider", type => "constant", flag => "-teltemp_spider", dtype => "float" }, # Spider temperatures (C) 89 { name => "-teltemp_truss", type => "constant", flag => "-teltemp_truss", dtype => "float" }, # Mid truss temperatures (C 90 { name => "-teltemp_extra", type => "constant", flag => "-teltemp_extra", dtype => "float" }, # Miscellaneous temperatures (C) 91 91 92 92 { name => "pon_time", type => "mean", flag => "-pon_time", dtype => "float" }, # time since last power on … … 102 102 or (warn "can't find regtool" and $missing_tools = 1); 103 103 104 if ($missing_tools) { 104 if ($missing_tools) { 105 105 warn ("Can't find required tools"); 106 exit($PS_EXIT_CONFIG_ERROR); 106 exit($PS_EXIT_CONFIG_ERROR); 107 107 } 108 108 … … 120 120 cache_run(command => $command, verbose => $verbose); 121 121 unless ($success) { 122 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);122 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 123 123 warn ("Unable to perform regtool -processedimfile on exposure id $exp_id: $error_code"); 124 124 exit ($error_code); … … 148 148 $command .= " -exp_id $exp_id"; 149 149 $command .= " -exp_tag $exp_tag"; 150 $command .= " -hostname $host" if defined $host; 150 151 $command .= " -dbname $dbname" if defined $dbname; 151 152 $command .= $stats->cmdflags(); … … 155 156 # Add the detrend flag, if needed 156 157 { 157 my $object = 0; # Is it an object exposure?158 my $object = 0; # Is it an object exposure? 158 159 foreach my $scienceType (@SCIENCE) { 159 if (lc($exp_type) =~ /$scienceType/) {160 $object = 1;161 last;162 }160 if (lc($exp_type) =~ /$scienceType/) { 161 $object = 1; 162 last; 163 } 163 164 } 164 165 $command .= " $DETREND_FLAG" unless $object; … … 170 171 cache_run(command => $command, verbose => $verbose); 171 172 unless ($success) { 172 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);173 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 173 174 warn ("Unable to run regtool -addprocessedexp for $exp_id: $error_code"); 174 175 exit($error_code); … … 202 203 carp($msg); 203 204 if (defined $exp_id and not $no_update) { 204 my $command = "$regtool -addprocessedexp -exp_id $exp_id -code $exit_code"; 205 $command .= " -dbname $dbname" if defined $dbname; 205 my $command = "$regtool -addprocessedexp -exp_id $exp_id -code $exit_code"; 206 $command .= " -hostname $host" if defined $host; 207 $command .= " -dbname $dbname" if defined $dbname; 206 208 system($command); 207 209 } -
trunk/ippScripts/scripts/register_imfile.pl
r17671 r17803 52 52 53 53 # values to extract from output metadata and the stats to calculate 54 my $STATS = 55 [ 54 my $STATS = 55 [ 56 56 # PPSTATS KEYWORD STATISTIC CHIPTOOL FLAG 57 57 { name => "FILE.LEVEL", type => "constant", flag => "-filelevel", dtype => "string" }, # File level … … 69 69 { name => "FPA.TIME", type => "constant", flag => "-dateobs", dtype => "string" }, # Date of observation (UTC) 70 70 { name => "FPA.TELESCOPE", type => "constant", flag => "-telescope", dtype => "string" }, # Telescope 71 { name => "FPA.INSTRUMENT", type => "constant", flag => "-inst", dtype => "string" }, # Instrument 71 { name => "FPA.INSTRUMENT", type => "constant", flag => "-inst", dtype => "string" }, # Instrument 72 72 { name => "FPA.M1X", type => "constant", flag => "-m1_x", dtype => "float" }, # M1X 73 73 { name => "FPA.M1Y", type => "constant", flag => "-m1_y", dtype => "float" }, # M1Y … … 85 85 { name => "FPA.ENV.DIR", type => "constant", flag => "-env_wind_dir", dtype => "float" }, # external wind direction 86 86 87 { name => "FPA.TELTEMP.M1", type => "constant", flag => "-teltemp_m1", dtype => "float" }, # Primary mirror temps (C) 88 { name => "FPA.TELTEMP.M1CELL", type => "constant", flag => "-teltemp_m1cell", dtype => "float" }, # Primary mirror support temps (C) 89 { name => "FPA.TELTEMP.M2", type => "constant", flag => "-teltemp_m2", dtype => "float" }, # Secondary mirror temps (C 90 { name => "FPA.TELTEMP.SPIDER", type => "constant", flag => "-teltemp_spider", dtype => "float" }, # Spider temperatures (C) 91 { name => "FPA.TELTEMP.TRUSS", type => "constant", flag => "-teltemp_truss", dtype => "float" }, # Mid truss temperatures (C 92 { name => "FPA.TELTEMP.EXTRA", type => "constant", flag => "-teltemp_extra", dtype => "float" }, # Miscellaneous temperatures (C) 87 { name => "FPA.TELTEMP.M1", type => "constant", flag => "-teltemp_m1", dtype => "float" }, # Primary mirror temps (C) 88 { name => "FPA.TELTEMP.M1CELL", type => "constant", flag => "-teltemp_m1cell", dtype => "float" }, # Primary mirror support temps (C) 89 { name => "FPA.TELTEMP.M2", type => "constant", flag => "-teltemp_m2", dtype => "float" }, # Secondary mirror temps (C 90 { name => "FPA.TELTEMP.SPIDER", type => "constant", flag => "-teltemp_spider", dtype => "float" }, # Spider temperatures (C) 91 { name => "FPA.TELTEMP.TRUSS", type => "constant", flag => "-teltemp_truss", dtype => "float" }, # Mid truss temperatures (C 92 { name => "FPA.TELTEMP.EXTRA", type => "constant", flag => "-teltemp_extra", dtype => "float" }, # Miscellaneous temperatures (C) 93 93 94 94 { name => "FPA.PON.TIME", type => "constant", flag => "-pon_time", dtype => "float" }, # time since last power on … … 109 109 or (warn "Can't find ppStats" and $missing_tools = 1); 110 110 111 if ($missing_tools) { 111 if ($missing_tools) { 112 112 warn ("Can't find required tools"); 113 exit($PS_EXIT_CONFIG_ERROR); 113 exit($PS_EXIT_CONFIG_ERROR); 114 114 } 115 115 … … 130 130 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 131 131 cache_run(command => $command, verbose => $verbose); 132 unless ($success) { 132 unless ($success) { 133 133 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 134 134 &my_die ("Unable to perform ppStats on exposure id $exp_id: $error_code", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $error_code); 135 135 } 136 136 137 137 # Parse the output 138 138 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files … … 163 163 $command .= " -tmp_class_id $tmp_class_id"; # the original class_id supplied by the user, replace by ppStats CLASS.ID 164 164 $command .= " -uri $uri "; 165 $command .= " -hostname $host" if defined $host; 165 166 $command .= " -dbname $dbname" if defined $dbname; 166 167 $command .= $stats->cmdflags(); … … 216 217 $command .= " -exp_name $exp_name"; 217 218 $command .= " -tmp_class_id $tmp_class_id"; 218 $command .= " -uri $uri ";219 $command .= " -uri $uri "; 219 220 $command .= " -telescope UNKNOWN"; 220 221 $command .= " -inst UNKNOWN"; 221 222 $command .= " -class_id $tmp_class_id"; 222 223 $command .= " -code $exit_code"; 224 $command .= " -hostname $host" if defined $host; 223 225 $command .= " -dbname $dbname" if defined $dbname; 224 226 system ($command); -
trunk/ippScripts/scripts/stack_skycell.pl
r17671 r17803 32 32 'outroot=s' => \$outroot, # Output root name 33 33 'verbose' => \$verbose, # Print to stdout 34 'no-update' => \$no_update, # Don't update the database?34 'no-update' => \$no_update, # Don't update the database? 35 35 'no-op' => \$no_op, # Don't do any operations? 36 36 'save-temps' => \$save_temps, # Save temporary files? … … 41 41 -msg => "Required options: --stack_id --outroot", 42 42 -exitval => 3, 43 ) unless defined $stack_id43 ) unless defined $stack_id 44 44 and defined $outroot; 45 45 46 my $STATS = 47 [ 46 my $STATS = 47 [ 48 48 # PPSTATS KEYWORD STATISTIC STACKTOOL FLAG 49 49 { name => "ROBUST_MEDIAN", type => "mean", flag => "-bg", dtype => "float" }, … … 58 58 my $stacktool = can_run('stacktool') or (warn "Can't find stacktool" and $missing_tools = 1); 59 59 my $ppStack = can_run('ppStack') or (warn "Can't find ppStack" and $missing_tools = 1); 60 if ($missing_tools) { 60 if ($missing_tools) { 61 61 warn("Can't find required tools."); 62 exit($PS_EXIT_CONFIG_ERROR); 62 exit($PS_EXIT_CONFIG_ERROR); 63 63 } 64 64 65 65 # Get list of components for stacking 66 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files66 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 67 67 my $files; 68 68 { … … 70 70 $command .= " -dbname $dbname" if defined $dbname; 71 71 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 72 run(command => $command, verbose => $verbose);72 run(command => $command, verbose => $verbose); 73 73 unless ($success) { 74 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);75 &my_die("Unable to perform stacktool -inputskyfile: $error_code", $stack_id, $error_code);74 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 75 &my_die("Unable to perform stacktool -inputskyfile: $error_code", $stack_id, $error_code); 76 76 } 77 77 78 78 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 79 &my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR);80 $files = parse_md_list($metadata) or 81 &my_die("Unable to parse metadata list", $stack_id, $PS_EXIT_PROG_ERROR);79 &my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR); 80 $files = parse_md_list($metadata) or 81 &my_die("Unable to parse metadata list", $stack_id, $PS_EXIT_PROG_ERROR); 82 82 } 83 83 … … 86 86 87 87 # Parse the list of input files to get the tesselation, skycell identifiers and camera 88 my $skycell_id; # Skycell identifier89 my $tess_id; # Tesselation identifier90 my $camera; # Camera88 my $skycell_id; # Skycell identifier 89 my $tess_id; # Tesselation identifier 90 my $camera; # Camera 91 91 foreach my $file (@$files) { 92 92 # skip warps which are speicified as 'ignored' 93 93 if ($file->{ignored}) { next; } 94 94 if (defined $tess_id) { 95 &my_die("Tesselation identifiers don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless96 $file->{tess_id} eq $tess_id;95 &my_die("Tesselation identifiers don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless 96 $file->{tess_id} eq $tess_id; 97 97 } else { 98 $tess_id = $file->{tess_id};98 $tess_id = $file->{tess_id}; 99 99 } 100 100 if (defined $skycell_id) { 101 &my_die("Skycell identifiers don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless102 $file->{skycell_id} eq $skycell_id;101 &my_die("Skycell identifiers don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless 102 $file->{skycell_id} eq $skycell_id; 103 103 } else { 104 $skycell_id = $file->{skycell_id};104 $skycell_id = $file->{skycell_id}; 105 105 } 106 106 if (defined $camera) { 107 &my_die("Cameras don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless $file->{camera} eq $camera;107 &my_die("Cameras don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless $file->{camera} eq $camera; 108 108 } else { 109 $camera = $file->{camera};109 $camera = $file->{camera}; 110 110 } 111 111 } … … 116 116 # Generate MDC file with the inputs 117 117 my ($listFile, $listName) = tempfile( "$tess_id.$skycell_id.stk$stack_id.list.XXXX", 118 UNLINK => !$save_temps );118 UNLINK => !$save_temps ); 119 119 my $num = 0; 120 my $inputSources; # Sources to use as stamps120 my $inputSources; # Sources to use as stamps 121 121 foreach my $file (@$files) { 122 122 if ($file->{ignored}) { next; } … … 125 125 $num++; 126 126 127 my $image = $file->{uri}; # Image name127 my $image = $file->{uri}; # Image name 128 128 my $mask = $ipprc->filename( "PSWARP.OUTPUT.MASK", $file->{path_base} ); # Mask name 129 129 my $weight = $ipprc->filename( "PSWARP.OUTPUT.WEIGHT", $file->{path_base} ); # Weight name … … 134 134 &my_die("Weight $weight does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $weight ); 135 135 &my_die("PSF $psf does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $psf ); 136 136 137 137 print $listFile "\tIMAGE\tSTR\t" . $image . "\n"; 138 print $listFile "\tMASK\tSTR\t" . $mask . "\n"; 139 print $listFile "\tWEIGHT\tSTR\t" . $weight . "\n"; 138 print $listFile "\tMASK\tSTR\t" . $mask . "\n"; 139 print $listFile "\tWEIGHT\tSTR\t" . $weight . "\n"; 140 140 print $listFile "\tPSF\tSTR\t" . $psf . "\n"; 141 141 … … 147 147 # XXX details about supplying sources, etc, need to be specified in the libraries 148 148 unless (defined $inputSources) { 149 $inputSources = $ipprc->filename("PSWARP.OUTPUT.SOURCES", $file->{path_base});150 &my_die("Source file $inputSources does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $inputSources );151 } 152 149 $inputSources = $ipprc->filename("PSWARP.OUTPUT.SOURCES", $file->{path_base}); 150 &my_die("Source file $inputSources does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $inputSources ); 151 } 152 153 153 } 154 154 … … 175 175 176 176 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 177 run(command => $command, verbose => $verbose);177 run(command => $command, verbose => $verbose); 178 178 unless ($success) { 179 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);180 &my_die("Unable to perform ppStack: $error_code", $stack_id, $error_code);179 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 180 &my_die("Unable to perform ppStack: $error_code", $stack_id, $error_code); 181 181 } 182 182 &my_die("Couldn't find expected output file: $outputName", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName); … … 189 189 190 190 # Get the statistics on the stacked image 191 my $statsFile; # File handle191 my $statsFile; # File handle 192 192 open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $stack_id, $PS_EXIT_SYS_ERROR); 193 193 my @contents = <$statsFile>; # Contents of file 194 194 close $statsFile; 195 195 my $metadata = $mdcParser->parse(join "", @contents) or 196 &my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR);196 &my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR); 197 197 $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $stack_id, $PS_EXIT_PROG_ERROR); 198 198 } … … 202 202 # Add the stack result 203 203 { 204 my $command = "$stacktool -addsumskyfile -stack_id $stack_id -uri $outputName -path_base $outroot"; 205 $command .= $stats->cmdflags(); 206 $command .= " -dbname $dbname" if defined $dbname; 207 208 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 209 run(command => $command, verbose => $verbose); 210 unless ($success) { 211 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 212 &my_die("Unable to perform stacktool -addsumskyfile: $error_code", $stack_id, $error_code); 213 } 204 my $command = "$stacktool -addsumskyfile -stack_id $stack_id -uri $outputName -path_base $outroot"; 205 $command .= $stats->cmdflags(); 206 $command .= " -hostname $host" if defined $host; 207 $command .= " -dbname $dbname" if defined $dbname; 208 209 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 210 run(command => $command, verbose => $verbose); 211 unless ($success) { 212 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 213 &my_die("Unable to perform stacktool -addsumskyfile: $error_code", $stack_id, $error_code); 214 } 214 215 } 215 216 216 217 # Register the run as completed 217 218 { 218 my $command = "$stacktool -updaterun -stack_id $stack_id -state stop"; # Command to run stacktool219 $command .= " -dbname $dbname" if defined $dbname;220 221 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =222 run(command => $command, verbose => $verbose);223 unless ($success) {224 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);225 warn("Unable to perform stacktool -updaterun: $error_code\n");226 exit($error_code);227 }219 my $command = "$stacktool -updaterun -stack_id $stack_id -state stop"; # Command to run stacktool 220 $command .= " -dbname $dbname" if defined $dbname; 221 222 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 223 run(command => $command, verbose => $verbose); 224 unless ($success) { 225 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 226 warn("Unable to perform stacktool -updaterun: $error_code\n"); 227 exit($error_code); 228 } 228 229 } 229 230 } … … 232 233 sub my_die 233 234 { 234 my $msg = shift; # Warning message on die235 my $stack_id = shift; # Stack identifier236 my $exit_code = shift; # Exit code to add235 my $msg = shift; # Warning message on die 236 my $stack_id = shift; # Stack identifier 237 my $exit_code = shift; # Exit code to add 237 238 238 239 warn($msg); 239 240 if (defined $stack_id and not $no_update) { 240 my $command = "$stacktool -addsumskyfile -stack_id $stack_id -code $exit_code"; 241 $command .= " -dbname $dbname" if defined $dbname; 241 my $command = "$stacktool -addsumskyfile -stack_id $stack_id -code $exit_code"; 242 $command .= " -hostname $host" if defined $host; 243 $command .= " -dbname $dbname" if defined $dbname; 242 244 system ($command); 243 245 } -
trunk/ippScripts/scripts/warp_skycell.pl
r17787 r17803 219 219 $command .= " -uri $outputImage -path_base $outroot" if $accept; 220 220 $command .= $stats->cmdflags() if $accept; 221 $command .= " -hostname $host" if defined $host; 221 222 $command .= " -dbname $dbname" if defined $dbname; 222 223 … … 241 242 if (defined $warp_id and defined $skycell_id and defined $tess_id and not $no_update) { 242 243 my $command = "$warptool -addwarped -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_id -code $exit_code"; 244 $command .= " -hostname $host" if defined $host; 243 245 $command .= " -dbname $dbname" if defined $dbname; 244 246 run(command => $command, verbose => $verbose);
Note:
See TracChangeset
for help on using the changeset viewer.
