Changeset 18056 for trunk/ippScripts/scripts/warp_skycell.pl
- Timestamp:
- Jun 10, 2008, 10:04:29 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/warp_skycell.pl (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/warp_skycell.pl
r17943 r18056 25 25 my $ipprc = PS::IPP::Config->new(); # IPP configuration 26 26 27 my ($warp_id, $skycell_id, $tess_ id, $camera, $dbname, $outroot, $verbose, $no_update, $no_op, $save_temps);27 my ($warp_id, $skycell_id, $tess_dir, $camera, $dbname, $outroot, $verbose, $no_update, $no_op, $save_temps); 28 28 GetOptions( 29 29 'warp_id|i=s' => \$warp_id, # Warp identifier 30 30 'skycell_id|s=s' => \$skycell_id, # Skycell identifier 31 'tess_ id|s=s' => \$tess_id, # Tesselation identifier31 'tess_dir|s=s' => \$tess_dir, # Tesselation identifier 32 32 'camera|c=s' => \$camera, # Camera name 33 33 'dbname|d=s' => \$dbname, # Database name … … 41 41 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 42 42 pod2usage( 43 -msg => "Required options: --warp_id --skycell_id --tess_ id--camera --outroot",43 -msg => "Required options: --warp_id --skycell_id --tess_dir --camera --outroot", 44 44 -exitval => 3, 45 45 ) unless defined $warp_id 46 46 and defined $skycell_id 47 and defined $tess_ id47 and defined $tess_dir 48 48 and defined $camera 49 49 and defined $outroot; … … 79 79 my $imfiles; 80 80 { 81 my $command = "$warptool -scmap -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_id"; 81 # XXX change -tess_id to -tess_dir when db schema is updated 82 my $command = "$warptool -scmap -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_dir"; 82 83 $command .= " -dbname $dbname" if defined $dbname; 83 84 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 85 86 unless ($success) { 86 87 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 87 &my_die("Unable to perform warptool -scmap: $error_code", $warp_id, $skycell_id, $tess_ id, $error_code);88 &my_die("Unable to perform warptool -scmap: $error_code", $warp_id, $skycell_id, $tess_dir, $error_code); 88 89 } 89 90 90 91 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 91 &my_die("Unable to parse metadata config doc", $warp_id, $skycell_id, $tess_ id, $PS_EXIT_PROG_ERROR);92 &my_die("Unable to parse metadata config doc", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_PROG_ERROR); 92 93 $imfiles = parse_md_list($metadata) or 93 &my_die("Unable to parse metadata list", $warp_id, $skycell_id, $tess_ id, $PS_EXIT_PROG_ERROR);94 &my_die("Unable to parse metadata list", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_PROG_ERROR); 94 95 } 95 96 … … 121 122 122 123 my $skyFile = $ipprc->filename("SKYCELL.TEMPLATE", $outroot, $skycell_id ); 123 $ipprc->skycell_file( $tess_ id, $skycell_id, $skyFile, $verbose ) or &my_die("Unable to generate template skycell", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR);124 $ipprc->skycell_file( $tess_dir, $skycell_id, $skyFile, $verbose ) or &my_die("Unable to generate template skycell", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR); 124 125 125 126 # Get list of filenames … … 136 137 my $weight = $ipprc->filename("PPIMAGE.CHIP.WEIGHT", $imfile->{chip_path_base}, $imfile->{class_id}); # Mask name 137 138 138 &my_die("Couldn't find input file: $image", $warp_id, $skycell_id, $tess_ id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($image);139 &my_die("Couldn't find input file: $mask", $warp_id, $skycell_id, $tess_ id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($mask);139 &my_die("Couldn't find input file: $image", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($image); 140 &my_die("Couldn't find input file: $mask", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($mask); 140 141 141 142 my $astrom; # Astrometry file … … 148 149 } 149 150 150 &my_die("Couldn't find input file: $astrom", $warp_id, $skycell_id, $tess_ id, $PS_EXIT_SYS_ERROR) unless defined $astrom and $ipprc->file_exists($astrom);151 &my_die("Couldn't find input file: $astrom", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless defined $astrom and $ipprc->file_exists($astrom); 151 152 152 153 print $imageFile "$image\n"; … … 187 188 unless ($success) { 188 189 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 189 &my_die("Unable to perform pswarp: $error_code", $warp_id, $skycell_id, $tess_ id, $error_code);190 &my_die("Unable to perform pswarp: $error_code", $warp_id, $skycell_id, $tess_dir, $error_code); 190 191 } 191 192 192 193 # Check first for the stats file, and if the ACCEPT flag is set. 193 &my_die("Couldn't find expected output file: $outputStats", $warp_id, $skycell_id, $tess_ id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStats);194 &my_die("Couldn't find expected output file: $outputStats", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStats); 194 195 # Get the statistics on the warped image 195 196 my $statsFile; # File handle … … 200 201 201 202 my $metadata = $mdcParser->parse($contents) 202 or &my_die("Unable to parse metadata config", $warp_id, $skycell_id, $tess_ id, $PS_EXIT_PROG_ERROR);203 or &my_die("Unable to parse metadata config", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_PROG_ERROR); 203 204 $accept = metadataLookupBool($metadata, "ACCEPT"); 204 205 if ($accept) { 205 $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $warp_id, $skycell_id, $tess_ id, $PS_EXIT_PROG_ERROR);206 207 &my_die("Couldn't find expected output file: $outputImage", $warp_id, $skycell_id, $tess_ id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage);208 &my_die("Couldn't find expected output file: $outputMask", $warp_id, $skycell_id, $tess_ id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);209 &my_die("Couldn't find expected output file: $outputWeight", $warp_id, $skycell_id, $tess_ id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight);210 &my_die("Couldn't find expected output file: $outputSources", $warp_id, $skycell_id, $tess_ id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources);211 &my_die("Couldn't find expected output file: $outputPSF", $warp_id, $skycell_id, $tess_ id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputPSF);212 # &my_die("Couldn't find expected output file: $outputBin1", $warp_id, $skycell_id, $tess_ id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin1);213 # &my_die("Couldn't find expected output file: $outputBin2", $warp_id, $skycell_id, $tess_ id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin2);206 $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_PROG_ERROR); 207 208 &my_die("Couldn't find expected output file: $outputImage", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage); 209 &my_die("Couldn't find expected output file: $outputMask", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask); 210 &my_die("Couldn't find expected output file: $outputWeight", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight); 211 &my_die("Couldn't find expected output file: $outputSources", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources); 212 &my_die("Couldn't find expected output file: $outputPSF", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputPSF); 213 # &my_die("Couldn't find expected output file: $outputBin1", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin1); 214 # &my_die("Couldn't find expected output file: $outputBin2", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin2); 214 215 } 215 216 } 216 217 217 218 unless ($no_update) { 218 my $command = "$warptool -addwarped -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_id"; 219 # XXX change -tess_id to -tess_dir when db is updated 220 my $command = "$warptool -addwarped -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_dir"; 219 221 $command .= " -ignore" if not $accept; # Completed succesfully, but can't produce product 220 222 $command .= " -uri $outputImage -path_base $outroot" if $accept; … … 237 239 my $warp_id = shift; # Warp identifier 238 240 my $skycell_id = shift; # Skycell identifier 239 my $tess_ id= shift; # Tesselation identifier241 my $tess_dir = shift; # Tesselation identifier 240 242 my $exit_code = shift; # Exit code to add 241 243 242 244 warn($msg); 243 if (defined $warp_id and defined $skycell_id and defined $tess_id and not $no_update) { 244 my $command = "$warptool -addwarped -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_id -code $exit_code"; 245 if (defined $warp_id and defined $skycell_id and defined $tess_dir and not $no_update) { 246 # XXX change -tess_id to -tess_dir when db is updated 247 my $command = "$warptool -addwarped -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_dir -code $exit_code"; 245 248 $command .= " -hostname $host" if defined $host; 246 249 $command .= " -dbname $dbname" if defined $dbname;
Note:
See TracChangeset
for help on using the changeset viewer.
