- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippScripts/scripts/warp_skycell.pl (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_branches/ippScripts/scripts/warp_skycell.pl
r24487 r27840 7 7 use Sys::Hostname; 8 8 my $host = hostname(); 9 my $date = `date`; 9 10 print "\n\n"; 10 print "Starting script $0 on $host \n\n";11 print "Starting script $0 on $host at $date\n\n"; 11 12 12 13 use DateTime; … … 48 49 'threads=s' => \$threads, # Number of threads to use for pswarp 49 50 'run-state=s' => \$run_state, # 'new' or 'update' 50 'magicked '=> \$magicked, # input run has been magicked already?51 'magicked=s' => \$magicked, # input run has been magicked already? 51 52 'verbose' => \$verbose, # Print to stdout 52 53 'no-update' => \$no_update, # Don't update the database? … … 77 78 # Recipes to use based on reduction class 78 79 $reduction = 'DEFAULT' unless defined $reduction; 79 my $recipe_pswarp = $ipprc->reduction($reduction, 'WARP_PSWARP'); # Recipe to use for ppImage 80 unless ($recipe_pswarp) { 81 &my_die("Couldn't find selected reduction for WARP_PSWARP: $reduction\n", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_CONFIG_ERROR); 80 my $recipe_pswarp = $ipprc->reduction($reduction, 'WARP_PSWARP'); # Recipe to use 81 my $recipe_psastro = $ipprc->reduction($reduction, 'PSASTRO'); # Recipe to use 82 unless ($recipe_pswarp and $recipe_psastro) { 83 &my_die("Couldn't find selected reduction: $reduction\n", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_CONFIG_ERROR); 82 84 } 83 85 … … 121 123 $astromSource = metadataLookupStr($metadata, 'ASTROM.SOURCE'); 122 124 } 125 126 my $dynamicMasks; # Use dynamic masks? 127 { 128 # Get the PSASTRO recipe 129 my $command = "$ppConfigDump -camera $camera -recipe PSASTRO $recipe_psastro -dump-recipe PSASTRO -"; 130 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 131 run(command => $command, verbose => $verbose); 132 unless ($success) { 133 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 134 &my_die("Unable to perform ppConfigDump: $error_code", $warp_id, $PS_EXIT_CONFIG_ERROR); 135 } 136 my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or 137 &my_die("Unable to parse metadata config doc", $warp_id, $PS_EXIT_CONFIG_ERROR); 138 139 $dynamicMasks = metadataLookupBool($recipeData, 'REFSTAR_MASK'); 140 } 141 123 142 124 143 my $outputImage = $ipprc->filename("PSWARP.OUTPUT", $outroot, $skycell_id ); … … 154 173 my $weight = $ipprc->filename("PPIMAGE.CHIP.VARIANCE", $imfile->{chip_path_base}, $imfile->{class_id}); # Mask name 155 174 156 my $mask = $ipprc->filename("PSASTRO.OUTPUT.MASK", $imfile->{cam_path_base}, $imfile->{class_id});# Mask name157 if ( !$ipprc->file_exists($mask)) {158 print "Celestial mask $mask not found, using basic mask\n";159 $mask = $ipprc->filename("PPIMAGE.CHIP.MASK", $imfile->{chip_path_base}, $imfile->{class_id}); # Mask name160 &my_die("Couldn't find input file: $mask", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($mask);175 my $mask; # Mask name 176 if ($dynamicMasks) { 177 $mask = $ipprc->filename("PSASTRO.OUTPUT.MASK", $imfile->{cam_path_base}, $imfile->{class_id}); 178 } else { 179 $mask = $ipprc->filename("PPIMAGE.CHIP.MASK", $imfile->{chip_path_base}, $imfile->{class_id}); 161 180 } 162 181 163 182 &my_die("Couldn't find input file: $image", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($image); 183 &my_die("Couldn't find input file: $weight", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($weight); 184 &my_die("Couldn't find input file: $mask", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($mask); 164 185 165 186 # Astrometry file: astrometry is done at the camera stage, and always results in a MEF file … … 182 203 close $weightFile; 183 204 close $astromFile; 205 206 # We need the recipe to determine if we care whether the PSF is generated or not 207 my $recipe; 208 { 209 my $command = "$ppConfigDump -camera $camera -dump-recipe PSWARP -recipe PSWARP $recipe_pswarp -"; 210 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 211 run(command => $command, verbose => $verbose); 212 unless ($success) { 213 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 214 &my_die("Unable to perform ppConfigDump: $error_code", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR); 215 } 216 $recipe = $mdcParser->parse(join "", @$stdout_buf) or 217 &my_die("Unable to parse metadata config doc", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR); 218 } 184 219 185 220 … … 201 236 $command .= " -F SOURCE.PLOT.APRESID SOURCE.PLOT.SKY.APRESID"; 202 237 $command .= " -recipe PSWARP $recipe_pswarp"; 203 $command .= " -psf"; # Turn on PSF determination204 238 $command .= " -tracedest $traceDest -log $logDest"; 205 239 $command .= " -threads $threads" if defined $threads; … … 230 264 # Check first for the stats file 231 265 my $outputStatsReal = $ipprc->file_resolve($outputStats); 232 &my_die("Couldn't find expected output file: $outputStats", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless -f $outputStatsReal;266 &my_die("Couldn't find expected output file: $outputStats", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStatsReal); 233 267 &my_die("Stats file has zero size: $outputStats", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless -s $outputStatsReal; 234 268 … … 253 287 &my_die("Couldn't find expected output file: $outputWeight", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight); 254 288 &my_die("Couldn't find expected output file: $outputSources", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources); 255 &my_die("Couldn't find expected output file: $outputPSF", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputPSF); 289 &my_die("Couldn't find expected output file: $outputPSF", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) if metadataLookupBool($recipe, 'PSF') and not $ipprc->file_exists($outputPSF); 290 if ($run_state eq 'new') { 291 &my_die("Couldn't find expected output file: $configuration", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($configuration); 292 } 256 293 } 257 294 … … 263 300 $command .= " -tess_id $tess_dir"; 264 301 $command .= " -path_base $outroot"; # needed for logfile lookups 265 $command .= " - magicked" if $magicked;302 $command .= " -set_magicked $magicked" if $magicked; 266 303 267 304 $command .= " -uri $outputImage" if !$quality; … … 285 322 $command .= " -warp_id $warp_id"; 286 323 $command .= " -skycell_id $skycell_id"; 324 $command .= " -set_magicked $magicked" if $magicked; 287 325 $command .= " -dbname $dbname" if defined $dbname; 288 326
Note:
See TracChangeset
for help on using the changeset viewer.
