Changeset 16728 for trunk/ippScripts/scripts/warp_skycell.pl
- Timestamp:
- Feb 28, 2008, 2:59:18 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/warp_skycell.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/warp_skycell.pl
r16723 r16728 33 33 caturi 34 34 ); 35 use PS::IPP::Operations qw( skycell_file );36 35 37 36 my $ipprc = PS::IPP::Config->new(); # IPP configuration 38 37 39 my ($warp_id, $skycell_id, $tess_id, $camera, $dbname, $ workdir, $verbose, $no_update, $no_op, $save_temps);38 my ($warp_id, $skycell_id, $tess_id, $camera, $dbname, $outroot, $verbose, $no_update, $no_op, $save_temps); 40 39 GetOptions( 41 40 'warp_id|i=s' => \$warp_id, # Warp identifier … … 44 43 'camera|c=s' => \$camera, # Camera name 45 44 'dbname|d=s' => \$dbname, # Database name 46 ' workdir|w=s' => \$workdir, # Working directory, for output files45 'outroot=s' => \$outroot, # Output root name 47 46 'verbose' => \$verbose, # Print to stdout 48 47 'no-update' => \$no_update, # Don't update the database? … … 116 115 } 117 116 118 my $skyFile = skycell_file($tess_id, $skycell_id, $workdir) or 119 &my_die("Unable to get name of skycell file", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR); 120 &my_die("Unable to find skycell file: $skyFile", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless 121 $ipprc->file_exists( $skyFile ); 122 123 $workdir = caturi( $workdir, "tess_" . $tess_id, "sky_" . $skycell_id ) if defined $workdir; 124 my $outputRoot = $ipprc->file_prepare( "$tess_id.$skycell_id.wrp$warp_id", $workdir, $$imfiles[0]->{uri} ); 125 my $outputImage = $ipprc->filename("PSWARP.OUTPUT", $outputRoot, $skycell_id ); 126 my $outputMask = $ipprc->filename("PSWARP.OUTPUT.MASK", $outputRoot, $skycell_id); 127 my $outputWeight = $ipprc->filename("PSWARP.OUTPUT.WEIGHT", $outputRoot, $skycell_id); 128 my $outputSources = $ipprc->filename("PSWARP.OUTPUT.SOURCES", $outputRoot, $skycell_id); 129 my $outputPSF = $ipprc->filename("PSPHOT.PSF.SAVE", $outputRoot, $skycell_id); 130 my $outputBin1 = $ipprc->filename("PSWARP.BIN1", $outputRoot, $skycell_id ); 131 my $outputBin2 = $ipprc->filename("PSWARP.BIN2", $outputRoot, $skycell_id ); 132 my $outputStats = $outputRoot . '.stats'; 133 134 my $traceDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".trace"; # Trace messages 135 my $logDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".log"; # Log messages 117 my $outputImage = $ipprc->filename("PSWARP.OUTPUT", $outroot, $skycell_id ); 118 my $outputMask = $ipprc->filename("PSWARP.OUTPUT.MASK", $outroot, $skycell_id); 119 my $outputWeight = $ipprc->filename("PSWARP.OUTPUT.WEIGHT", $outroot, $skycell_id); 120 my $outputSources = $ipprc->filename("PSWARP.OUTPUT.SOURCES", $outroot, $skycell_id); 121 my $outputPSF = $ipprc->filename("PSPHOT.PSF.SAVE", $outroot, $skycell_id); 122 my $outputBin1 = $ipprc->filename("PSWARP.BIN1", $outroot, $skycell_id ); 123 my $outputBin2 = $ipprc->filename("PSWARP.BIN2", $outroot, $skycell_id ); 124 my $outputStats = $ipprc->filename("SKYCELL.STATS", $outroot, $skycell_id ); 125 my $traceDest = $ipprc->filename("TRACE.EXP", $outroot, $skycell_id); 126 my $logDest = $ipprc->filename("TRACE.IMFILE", $outroot, $skycell_id); 127 128 my $skyFile = $ipprc->filename("SKYCELL.TEMPLATE", $outroot, $skycell_id ); 129 $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); 136 130 137 131 # Get list of filenames 138 my ($imageFile, $imageName) = tempfile( "$tess_id.$skycell_id.wrp$warp_id.image.list.XXXX", UNLINK => !$save_temps); 139 my ($maskFile, $maskName) = tempfile( "$tess_id.$skycell_id.wrp$warp_id.mask.list.XXXX", UNLINK => !$save_temps); 140 my ($weightFile, $weightName) = tempfile( "$tess_id.$skycell_id.wrp$warp_id.weight.list.XXXX", UNLINK => !$save_temps); 141 my ($astromFile, $astromName) = tempfile( "$tess_id.$skycell_id.wrp$warp_id.astrom.list.XXXX", UNLINK => !$save_temps); 142 143 # XXXX this is inconsistent: what is the goal of inputAstrom? 144 my $inputAstrom = 0; 132 my ($imageFile, $imageName) = tempfile( caturi($outroot, "$tess_id.$skycell_id.wrp$warp_id.image.list.XXXX"), UNLINK => !$save_temps); 133 my ($maskFile, $maskName) = tempfile( caturi($outroot, "$tess_id.$skycell_id.wrp$warp_id.mask.list.XXXX"), UNLINK => !$save_temps); 134 my ($weightFile, $weightName) = tempfile( caturi($outroot, "$tess_id.$skycell_id.wrp$warp_id.weight.list.XXXX"), UNLINK => !$save_temps); 135 my ($astromFile, $astromName) = tempfile( caturi($outroot, "$tess_id.$skycell_id.wrp$warp_id.astrom.list.XXXX"), UNLINK => !$save_temps); 136 145 137 foreach my $imfile (@$imfiles) { 146 138 my $image = $imfile->{uri}; # Image name … … 154 146 if ($astromSource eq 'PSASTRO.OUTPUT.MEF') { 155 147 $astrom = $ipprc->filename($astromSource, $imfile->{cam_path_base}); 156 &my_die("Couldn't find input file: $astrom", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($astrom); 157 $inputAstrom = 1; 158 } 159 if ($astromSource eq 'PSASTRO.OUTPUT') { 148 } elsif ($astromSource eq 'PSASTRO.OUTPUT') { 160 149 my $chipRoot = $imfile->{chip_path_base}; 161 150 my $classID = $imfile->{class_id}; 162 151 $astrom = $ipprc->filename($astromSource, $chipRoot, $classID); # Astrometry file 163 $inputAstrom = 1; 164 } 165 166 if ($inputAstrom) { 167 print $imageFile "$image\n"; 168 print $maskFile "$mask\n"; 169 print $weightFile "$weight\n"; 170 print $astromFile "$astrom\n"; 171 } 152 } 153 154 &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); 155 156 print $imageFile "$image\n"; 157 print $maskFile "$mask\n"; 158 print $weightFile "$weight\n"; 159 print $astromFile "$astrom\n"; 172 160 } 173 161 close $imageFile; … … 175 163 close $weightFile; 176 164 close $astromFile; 165 177 166 178 167 # Run pswarp … … 183 172 $command .= " -masklist $maskName"; 184 173 $command .= " -weightlist $weightName"; 185 $command .= " -astromlist $astromName" if $inputAstrom;186 $command .= " $out putRoot $skyFile";174 $command .= " -astromlist $astromName"; 175 $command .= " $outroot $skyFile"; 187 176 $command .= " -stats $outputStats"; 188 177 $command .= " -recipe PPSTATS WARPSTATS"; … … 225 214 my $command = "$warptool -addwarped -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_id"; 226 215 $command .= " -ignore" if not $accept; # Completed succesfully, but can't produce product 227 $command .= " -uri $outputImage -path_base $out putRoot" if $accept;216 $command .= " -uri $outputImage -path_base $outroot" if $accept; 228 217 $command .= $stats->cmdflags() if $accept; 229 218 $command .= " -dbname $dbname" if defined $dbname;
Note:
See TracChangeset
for help on using the changeset viewer.
