IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17521


Ignore:
Timestamp:
May 4, 2008, 2:15:23 PM (18 years ago)
Author:
eugene
Message:

astrometry is not only run at the camera level, and is always MEF out

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/camera_exp.pl

    r17224 r17521  
    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;
     
    161163
    162164    # 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);
    164167    print $list1File ($ipprc->filename("PPIMAGE.BIN1", $file->{path_base}, $class_id) . "\n");
    165168    print $list2File ($ipprc->filename("PPIMAGE.BIN2", $file->{path_base}, $class_id) . "\n");
    166169    print $list3File ($ipprc->convert_filename_absolute($chipObjects) . "\n");
    167170
    168     # if any of the output chip astrometry files exist, we can run psastro / addstar below
     171    # if any of the output chip photometry files exist, we can run psastro / addstar below
    169172    if ($ipprc->file_exists($chipObjects)) {
    170173        $chipObjectsExist = 1;
     
    178181$ipprc->outroot_prepare($outroot);
    179182
     183# the camera configurations should define the psastro output to be a single file (MEF), regardless of the inputs
    180184my $jpeg1      = $ipprc->filename("PPIMAGE.JPEG1",      $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
    181185my $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);
     186my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT",    $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
    183187my $traceDest  = $ipprc->filename("TRACE.EXP",          $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
    184188my $logDest    = $ipprc->filename("LOG.EXP",            $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
     
    198202    {
    199203        my $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run
     204        $command .= " -dbname $dbname" if defined $dbname;
     205
    200206        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    201207            run(command => $command, verbose => $verbose);
     
    210216    {
    211217        my $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run
     218        $command .= " -dbname $dbname" if defined $dbname;
     219
    212220        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    213221            run(command => $command, verbose => $verbose);
     
    219227    }
    220228
    221     # check recipe for PSASTRO.MOSAIC.MODE; run mosaic astrometry if
    222     # requested by the camera's PSASTRO recipe
    223     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) or
    233             &my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_PROG_ERROR);
    234         $mosaicAstrom = metadataLookupBool($metadata, 'PSASTRO.MOSAIC.MODE');
    235     }
    236 
    237229    # only run psastro / addstar if any of the output chip astrometry files exist (should we test for successful astrometry?)
    238230    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);
    256243        }
     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);
    257246       
    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)
    260248        if (defined $dvodbReal) {
    261249            # XXX this construct requires the user to have a valid .ptolemyrc
     
    269257            $command .= " -D CATDIR $dvodbReal";
    270258
    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";
    277261
    278262            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
Note: See TracChangeset for help on using the changeset viewer.