IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 10, 2008, 9:38:11 PM (18 years ago)
Author:
eugene
Message:

require mosaic / mef astrometry in camera

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080408/ippScripts/scripts/camera_exp.pl

    r17409 r17432  
    3838
    3939my ( $exp_tag, $cam_id, $camera, $outroot, $recipe, $dbname, $reduction, $dvodb, $verbose, $no_update,
    40      $no_op );
     40     $no_op, $save_temps );
    4141GetOptions(
    4242           'exp_tag=s'          => \$exp_tag, # Exposure identifier
     
    5151           'no-update'         => \$no_update, # Update the database?
    5252           'no-op'             => \$no_op, # Don't do any operations?
     53           'save-temps'        => \$save_temps, # Save temporary files?
    5354           ) or pod2usage( 2 );
    5455
     
    7576
    7677# 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
    7879my $CHIPSTATS =
    7980    [   
     
    150151
    151152### 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 
     153my ($list1File, $list1Name) = tempfile( "$exp_tag.cm.$cam_id.b1.list.XXXX", UNLINK => !$save_temps ); # For binning 1
     154my ($list2File, $list2Name) = tempfile( "$exp_tag.cm.$cam_id.b2.list.XXXX", UNLINK => !$save_temps ); # For binning 2
     155my ($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
    156158my $chipObjects;
    157159my $chipObjectsExist = 0;
     
    200202    {
    201203        my $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run
     204        $command .= " -dbname $dbname" if defined $dbname;
     205
    202206        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    203207            run(command => $command, verbose => $verbose);
     
    212216    {
    213217        my $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run
     218        $command .= " -dbname $dbname" if defined $dbname;
     219
    214220        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    215221            run(command => $command, verbose => $verbose);
     
    221227    }
    222228
    223     # check recipe for PSASTRO.MOSAIC.MODE; run mosaic astrometry if
    224     # requested by the camera's PSASTRO recipe
    225     my $mosaicAstrom;           # run mosaic-level astrometry?
    226     {
    227         my $command = "$ppConfigDump -camera $camera -dump-recipe PSASTRO -";
    228         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    229             run(command => $command, verbose => $verbose);
    230         unless ($success) {
    231             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    232             &my_die("Unable to perform ppConfigDump: $error_code", $cam_id, $error_code);
    233         }
    234         my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
    235             &my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_PROG_ERROR);
    236         $mosaicAstrom = metadataLookupBool($metadata, 'PSASTRO.MOSAIC.MODE');
    237     }
    238 
    239229    # only run psastro / addstar if any of the output chip astrometry files exist (should we test for successful astrometry?)
    240230    if ($chipObjectsExist) {
    241         if ($mosaicAstrom) {
    242             # run psastro +mosastro on the set of chips or copy the chipObjects to fpaObjects
    243             # XXX note that this is wrong if imfiles are cells
    244             # XXX add a ppStats call which will collect the astrometry stats
    245             my $command;
    246             $command  = "$psastro -list $list3Name $outroot";
    247             $command .= " +mosastro -chipastro";
    248             $command .= " -F PSASTRO.OUTPUT PSASTRO.OUTPUT.MEF";
    249             $command .= " -tracedest $traceDest -log $logDest";
    250             my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    251                 run(command => $command, verbose => $verbose);
    252             unless ($success) {
    253                 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    254                 &my_die("Unable to perform psastro: $error_code", $cam_id, $error_code);
    255             }
    256             # XXX do we want to give an error if astrometry fails here?
    257             &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);
    258243        }
     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);
    259246       
    260         # do we supply chipObjects or fpaObjects to addstar?
    261         # 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)
    262248        if (defined $dvodbReal) {
    263249            # XXX this construct requires the user to have a valid .ptolemyrc
     
    271257            $command .= " -D CATDIR $dvodbReal";
    272258
    273             if ($mosaicAstrom) {
    274                 my $realFile = $ipprc->file_resolve($fpaObjects);
    275                 $command .= " $realFile";
    276             } else {
    277                 $command .= " -list $list3Name";
    278             }
     259            my $realFile = $ipprc->file_resolve($fpaObjects);
     260            $command .= " $realFile";
    279261
    280262            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
Note: See TracChangeset for help on using the changeset viewer.