Changeset 17521 for trunk/ippScripts/scripts/camera_exp.pl
- Timestamp:
- May 4, 2008, 2:15:23 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/camera_exp.pl (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/camera_exp.pl
r17224 r17521 38 38 39 39 my ( $exp_tag, $cam_id, $camera, $outroot, $recipe, $dbname, $reduction, $dvodb, $verbose, $no_update, 40 $no_op );40 $no_op, $save_temps ); 41 41 GetOptions( 42 42 'exp_tag=s' => \$exp_tag, # Exposure identifier … … 51 51 'no-update' => \$no_update, # Update the database? 52 52 'no-op' => \$no_op, # Don't do any operations? 53 'save-temps' => \$save_temps, # Save temporary files? 53 54 ) or pod2usage( 2 ); 54 55 … … 75 76 76 77 # values to extract from output metadata and the stats to calculate 77 # these should be coming from the psastro results for Nimfile > 1,78 # these should be coming from the psastro results 78 79 my $CHIPSTATS = 79 80 [ … … 150 151 151 152 ### not needed to have such an extensive temp file name. 152 my ($list1File, $list1Name) = tempfile( "$exp_tag.cm.$cam_id.b1.list.XXXX", UNLINK => 1 ); # For binning 1 153 my ($list2File, $list2Name) = tempfile( "$exp_tag.cm.$cam_id.b2.list.XXXX", UNLINK => 1 ); # For binning 2 154 my ($list3File, $list3Name) = tempfile( "$exp_tag.cm.$cam_id.b3.list.XXXX", UNLINK => 1 ); # For astrometry 155 153 my ($list1File, $list1Name) = tempfile( "$exp_tag.cm.$cam_id.b1.list.XXXX", UNLINK => !$save_temps ); # For binning 1 154 my ($list2File, $list2Name) = tempfile( "$exp_tag.cm.$cam_id.b2.list.XXXX", UNLINK => !$save_temps ); # For binning 2 155 my ($list3File, $list3Name) = tempfile( "$exp_tag.cm.$cam_id.b3.list.XXXX", UNLINK => !$save_temps ); # For astrometry 156 157 # XXX we perform astrometry iff photometry output exists 156 158 my $chipObjects; 157 159 my $chipObjectsExist = 0; … … 161 163 162 164 # If there is only one chip, we use this name for the input to addstar 163 $chipObjects = $ipprc->filename("PSASTRO.OUTPUT", $file->{path_base}, $class_id); 165 # we expect the chip analysis stage to produce psphot output (cmf file) and two binned images 166 $chipObjects = $ipprc->filename("PSPHOT.OUTPUT", $file->{path_base}, $class_id); 164 167 print $list1File ($ipprc->filename("PPIMAGE.BIN1", $file->{path_base}, $class_id) . "\n"); 165 168 print $list2File ($ipprc->filename("PPIMAGE.BIN2", $file->{path_base}, $class_id) . "\n"); 166 169 print $list3File ($ipprc->convert_filename_absolute($chipObjects) . "\n"); 167 170 168 # if any of the output chip astrometry files exist, we can run psastro / addstar below171 # if any of the output chip photometry files exist, we can run psastro / addstar below 169 172 if ($ipprc->file_exists($chipObjects)) { 170 173 $chipObjectsExist = 1; … … 178 181 $ipprc->outroot_prepare($outroot); 179 182 183 # the camera configurations should define the psastro output to be a single file (MEF), regardless of the inputs 180 184 my $jpeg1 = $ipprc->filename("PPIMAGE.JPEG1", $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR); 181 185 my $jpeg2 = $ipprc->filename("PPIMAGE.JPEG2", $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR); 182 my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT .MEF",$outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);186 my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT", $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR); 183 187 my $traceDest = $ipprc->filename("TRACE.EXP", $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR); 184 188 my $logDest = $ipprc->filename("LOG.EXP", $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR); … … 198 202 { 199 203 my $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run 204 $command .= " -dbname $dbname" if defined $dbname; 205 200 206 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 201 207 run(command => $command, verbose => $verbose); … … 210 216 { 211 217 my $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run 218 $command .= " -dbname $dbname" if defined $dbname; 219 212 220 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 213 221 run(command => $command, verbose => $verbose); … … 219 227 } 220 228 221 # check recipe for PSASTRO.MOSAIC.MODE; run mosaic astrometry if222 # requested by the camera's PSASTRO recipe223 my $mosaicAstrom; # run mosaic-level astrometry?224 {225 my $command = "$ppConfigDump -camera $camera -dump-recipe PSASTRO -";226 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =227 run(command => $command, verbose => $verbose);228 unless ($success) {229 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);230 &my_die("Unable to perform ppConfigDump: $error_code", $cam_id, $error_code);231 }232 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or233 &my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_PROG_ERROR);234 $mosaicAstrom = metadataLookupBool($metadata, 'PSASTRO.MOSAIC.MODE');235 }236 237 229 # only run psastro / addstar if any of the output chip astrometry files exist (should we test for successful astrometry?) 238 230 if ($chipObjectsExist) { 239 if ($mosaicAstrom) { 240 # run psastro +mosastro on the set of chips or copy the chipObjects to fpaObjects 241 # XXX note that this is wrong if imfiles are cells 242 # XXX add a ppStats call which will collect the astrometry stats 243 my $command; 244 $command = "$psastro -list $list3Name $outroot"; 245 $command .= " +mosastro -chipastro"; 246 $command .= " -F PSASTRO.OUTPUT PSASTRO.OUTPUT.MEF"; 247 $command .= " -tracedest $traceDest -log $logDest"; 248 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 249 run(command => $command, verbose => $verbose); 250 unless ($success) { 251 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 252 &my_die("Unable to perform psastro: $error_code", $cam_id, $error_code); 253 } 254 # XXX do we want to give an error if astrometry fails here? 255 &my_die("Unable to find expected output file: $fpaObjects", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($fpaObjects); 231 # run psastro on the chipObjects, producing fpaObjects 232 # XXX add a ppStats call which will collect the astrometry stats 233 my $command; 234 $command = "$psastro -list $list3Name $outroot"; 235 $command .= " -tracedest $traceDest -log $logDest"; 236 $command .= " -dbname $dbname" if defined $dbname; 237 238 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 239 run(command => $command, verbose => $verbose); 240 unless ($success) { 241 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 242 &my_die("Unable to perform psastro: $error_code", $cam_id, $error_code); 256 243 } 244 # XXX do we want to give an error if astrometry fails here? 245 &my_die("Unable to find expected output file: $fpaObjects", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($fpaObjects); 257 246 258 # do we supply chipObjects or fpaObjects to addstar? 259 # run addstar on either the single chip output or the single fpa output 247 # run addstar on the output fpaObjects (if a DVO database is defined) 260 248 if (defined $dvodbReal) { 261 249 # XXX this construct requires the user to have a valid .ptolemyrc … … 269 257 $command .= " -D CATDIR $dvodbReal"; 270 258 271 if ($mosaicAstrom) { 272 my $realFile = $ipprc->file_resolve($fpaObjects); 273 $command .= " $realFile"; 274 } else { 275 $command .= " -list $list3Name"; 276 } 259 my $realFile = $ipprc->file_resolve($fpaObjects); 260 $command .= " $realFile"; 277 261 278 262 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
Note:
See TracChangeset
for help on using the changeset viewer.
