IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 6, 2008, 1:59:05 PM (18 years ago)
Author:
eugene
Message:

several options to make processing more flexible (eg, different astrometry cases)

File:
1 edited

Legend:

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

    r15387 r16018  
    2828                       $PS_EXIT_DATA_ERROR
    2929                       $PS_EXIT_TIMEOUT_ERROR
     30                       metadataLookupStr
     31                       metadataLookupBool
    3032                       caturi
    3133                       );
     
    5153pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    5254pod2usage(
    53     -msg => "Required options: --exp_tag --cam_id --camera",
    54     -exitval => 3,
    55 ) unless defined $exp_tag
     55          -msg => "Required options: --exp_tag --cam_id --camera",
     56          -exitval => 3,
     57          ) unless defined $exp_tag
    5658    and defined $cam_id
    5759    and defined $camera;
     
    7072# values to extract from output metadata and the stats to calculate
    7173my $CHIPSTATS =
    72    [   
    73        #          PPSTATS KEYWORD         STATISTIC          CHIPTOOL FLAG
     74    [   
     75        #          PPSTATS KEYWORD         STATISTIC          CHIPTOOL FLAG
    7476        { name => "bg",             type => "mean",  flag => "-bg",             dtype => "float" },
    7577        { name => "bg_mean_stdev",  type => "stdev", flag => "-bg_mean_stdev",  dtype => "float" },
     
    9092#       { name => "fringe_1",       type => "rms",   flag => "-fringe_1",       dtype => "float" }, 
    9193#       { name => "fringe_0",       type => "stdev", flag => "-fringe_2",       dtype => "float" }, 
    92    ];
     94        ];
    9395my $chipStats = PS::IPP::Metadata::Stats->new($CHIPSTATS); # Stats parser
    9496
     
    9799my $camtool = can_run('camtool') or (warn "Can't find camtool" and $missing_tools = 1);
    98100my $ppImage = can_run('ppImage') or (warn "Can't find ppImage" and $missing_tools = 1);
     101my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1);
    99102
    100103# test for addstar and psastro:
     
    149152    print $list3File ($chipObjects . "\n");
    150153
    151      # if any of the output chip astrometry files exist, we can run psastro / addstar below
     154    # if any of the output chip astrometry files exist, we can run psastro / addstar below
    152155    if ($ipprc->file_exists($chipObjects)) {
    153156        $chipObjectsExist = 1;
     
    203206    }
    204207
    205     # only run psastro / addstar if any of the output chip astrometry files exist
     208    # check recipe for PSASTRO.MOSAIC.MODE; run mosaic astrometry if
     209    # requested by the camera's PSASTRO recipe
     210    my $mosaicAstrom;           # run mosaic-level astrometry?
     211    {
     212        my $command = "$ppConfigDump -camera $camera -dump-recipe PSASTRO -";
     213        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     214            run(command => $command, verbose => 1);
     215        unless ($success) {
     216            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     217            &my_die("Unable to perform ppConfigDump: $error_code", $cam_id, $error_code);
     218        }
     219        my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
     220            &my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_PROG_ERROR);
     221        $mosaicAstrom = metadataLookupBool($metadata, 'PSASTRO.MOSAIC.MODE');
     222    }
     223
     224    # only run psastro / addstar if any of the output chip astrometry files exist (should we test for successful astrometry?)
    206225    if ($chipObjectsExist) {
    207         # run psastro +mosastro on the set of chips or copy the chipObjects to fpaObjects
    208         # XXX note that this is wrong if imfiles are cells
    209         # XXX add a ppStats call which will collect the astrometry stats
    210         if (scalar @$files > 1) {
    211             my $command = "$psastro -list $list3Name $outputRoot +mosastro -chipastro " .
    212                 "-F PSASTRO.OUTPUT PSASTRO.OUTPUT.MEF";
     226        if ($mosaicAstrom) {
     227            # run psastro +mosastro on the set of chips or copy the chipObjects to fpaObjects
     228            # XXX note that this is wrong if imfiles are cells
     229            # XXX add a ppStats call which will collect the astrometry stats
     230            my $command;
     231            $command  = "$psastro -list $list3Name $outputRoot";
     232            $command .= " +mosastro -chipastro";
     233            $command .= " -F PSASTRO.OUTPUT PSASTRO.OUTPUT.MEF";
    213234            $command .= " -tracedest $traceDest -log $logDest";
    214235            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    218239                &my_die("Unable to perform psastro: $error_code", $cam_id, $error_code);
    219240            }
    220         } else {
    221             $ipprc->file_copy($chipObjects, $fpaObjects) unless $chipObjects eq $fpaObjects;
     241            # XXX do we want to give an error if astrometry fails here?
     242            &my_die("Unable to find expected output file: $fpaObjects", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($fpaObjects);
    222243        }
    223         &my_die("Unable to find expected output file: $fpaObjects", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($fpaObjects);
    224 
     244       
     245        # do we supply chipObjects or fpaObjects to addstar?
    225246        # run addstar on either the single chip output or the single fpa output
    226         # XXX this construct requires the user to have a valid .ptolemyrc
    227         # XXX which in turn points at ippconfig/dvo.site
    228        
    229         # require a defined output dvo database to run addstar (ie, refuse to use the .ptolemyrc default)
    230         # XXX this needs to be converted to addstar_client...
    231247        if (defined $dvodbReal) {
     248            # XXX this construct requires the user to have a valid .ptolemyrc
     249            # XXX which in turn points at ippconfig/dvo.site
     250            # require a defined output dvo database to run addstar (ie, refuse to use the .ptolemyrc default)
     251            # XXX this needs to be converted to addstar_client...
     252
    232253            my $camdir = $ipprc->dvo_cameradir(); # Camera directory for addstar
    233             my $command = "$addstar -D CAMERA $camdir " . $ipprc->file_resolve($fpaObjects);
     254            my $command;
     255            $command  = "$addstar -D CAMERA $camdir ";
    234256            $command .= " -D CATDIR $dvodbReal";
     257
     258            if ($mosaicAstrom) {
     259                $command .= " $ipprc->file_resolve($fpaObjects)";
     260            } else {
     261                print STDERR "ERROR: addstar needs to be update to support the -list input structure\n";
     262                $command .= " -list $list3File";
     263            }
    235264
    236265            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    242271        }
    243272    }
    244    
    245273}
    246274
Note: See TracChangeset for help on using the changeset viewer.