- Timestamp:
- Jul 30, 2010, 9:31:50 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100621/ippScripts/scripts/diffphot.pl
r28439 r28794 31 31 my $diffphottool = can_run('diffphottool') or (warn "Can't find diffphottool" and $missing_tools = 1); 32 32 my $psphot = can_run('psphot') or (warn "Can't find psphot" and $missing_tools = 1); 33 my $ppArith = can_run('ppArith') or (warn "Can't find ppArith" and $missing_tools = 1);34 33 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1); 35 34 if ($missing_tools) { … … 177 176 # Do reverse photometry 178 177 if ($bothways) { 179 my ($tempFile, $tempName) = tempfile( "/tmp/diffphot.$diff_phot_id.$skycell_id.XXXX", 180 UNLINK => !$save_temps, SUFFIX => '.fits' ); 181 { 182 my ($tempRoot) = $tempName =~ /^(.*).fits/; 183 my $command = "$ppArith $tempRoot -file1 $inputImage -op \\* -const2 -1"; 184 unless ($no_op) { 185 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 186 run(command => $command, verbose => $verbose); 187 unless ($success) { 188 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 189 &my_die("Unable to perform ppArith: $error_code", $diff_phot_id, $skycell_id, $error_code); 190 } 191 &my_die("Couldn't find expected output file: $tempName", $diff_phot_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($tempName); 192 } else { 193 print "Skipping command: $command\n"; 194 } 195 } 178 my $inputImage = $ipprc->filename("PPSUB.INVERSE", $inputPath); 179 my $inputMask = $ipprc->filename("PPSUB.INVERSE.MASK", $inputPath); 180 my $inputVariance = $ipprc->filename("PPSUB.INVERSE.VARIANCE", $inputPath); 181 &my_die("Couldn't find input: $inputImage", $diff_phot_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inputImage); 182 &my_die("Couldn't find input: $inputMask", $diff_phot_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inputMask); 183 &my_die("Couldn't find input: $inputVariance", $diff_phot_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inputVariance); 196 184 197 185 # Get the output filenames … … 201 189 202 190 my $command = "$psphot $outroot.neg"; 203 $command .= " -file $ tempName";191 $command .= " -file $inputImage"; 204 192 $command .= " -mask $inputMask"; 205 193 $command .= " -variance $inputVariance"; … … 252 240 } 253 241 254 unless ($no_update){242 { 255 243 my $command = "$diffphottool -diff_phot_id $diff_phot_id -skycell_id $skycell_id"; 256 244 $command .= " -done -path_base $outroot"; 257 $command .= " -magicked $magicked" if $magicked;245 $command .= " -magicked $magicked" if defined $magicked; 258 246 $command .= " -quality $quality" if defined $quality; 259 247 $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400)); … … 261 249 $command .= " -dbname $dbname" if defined $dbname; 262 250 263 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 264 run(command => $command, verbose => $verbose); 265 unless ($success) { 266 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 267 &my_die("Command failed: $error_code", $diff_phot_id, $skycell_id, $error_code); 251 unless ($no_update) { 252 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 253 run(command => $command, verbose => $verbose); 254 unless ($success) { 255 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 256 &my_die("Command failed: $error_code", $diff_phot_id, $skycell_id, $error_code); 257 } 258 } else { 259 print "Skipping update: $command\n"; 268 260 } 269 261 }
Note:
See TracChangeset
for help on using the changeset viewer.
