IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18009


Ignore:
Timestamp:
Jun 8, 2008, 3:54:09 PM (18 years ago)
Author:
eugene
Message:

adding camera stats from psastro output

File:
1 edited

Legend:

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

    r17803 r18009  
    9191        { name => "n_extended",     type => "sum",   flag => "-n_extended",     dtype => "int"   },
    9292        { name => "n_cr",           type => "sum",   flag => "-n_cr",           dtype => "int"   },
    93         { name => "n_astrom",       type => "sum",   flag => "-n_astrom",       dtype => "int"   },
    94 
    95 
    96 # these are not defined for the database table camProcessedExp
    9793        ];
    9894my $chipStats = PS::IPP::Metadata::Stats->new($CHIPSTATS); # Stats parser
     95
     96# values to extract from camera-level output metadata and the stats to calculate
     97my $CAMSTATS =
     98   [
     99       #          PPSTATS KEYWORD         STATISTIC          CHIPTOOL FLAG
     100      { name => "CERROR",         type => "rms",   flag => "-sigma_ra",       dtype => "float" },
     101      { name => "CERROR",         type => "rms",   flag => "-sigma_dec",      dtype => "float" },
     102      { name => "DT_ASTR",        type => "sum",   flag => "-dtime_astrom",   dtype => "float" },
     103      { name => "NASTRO",         type => "sum",   flag => "-n_astrom",       dtype => "int"   },
     104#     { name => "ZP??",           type => "mean",  flag => "-zp_mean",        dtype => "float" },
     105#     { name => "ZP??",           type => "rms",   flag => "-zp_stdev",       dtype => "float" },
     106   ];
     107my $camStats = PS::IPP::Metadata::Stats->new($CAMSTATS); # Stats parser
    99108
    100109# Look for programs we need
     
    174183my $jpeg2      = $ipprc->filename("PPIMAGE.JPEG2",      $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
    175184my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT",     $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
     185my $fpaStats   = $ipprc->filename("PSASTRO.STATS",      $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
    176186my $traceDest  = $ipprc->filename("TRACE.EXP",          $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
    177187my $logDest    = $ipprc->filename("LOG.EXP",            $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
     
    223233        $command  = "$psastro -list $list3Name $outroot";
    224234        $command .= " -tracedest $traceDest -log $logDest";
     235        $command .= " -stats $fpaStats";
    225236        $command .= " -dbname $dbname" if defined $dbname;
    226237
     
    233244        # XXX do we want to give an error if astrometry fails here?
    234245        &my_die("Unable to find expected output file: $fpaObjects", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($fpaObjects);
     246        &my_die("Unable to find expected output file: $fpaStats",   $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($fpaObjects);
     247
     248        # Get the statistics on the processed image
     249        my $statsFile;              # File handle
     250        open $statsFile, $ipprc->file_resolve($fpaStats) or &my_die("Can't open statistics file $outputStats: $!", $cam_id, $PS_EXIT_SYS_ERROR);
     251        my @contents = <$statsFile>; # Contents of file
     252        close $statsFile;
     253
     254        # parse the statistics MDC file
     255        my $mdcParser = PS::IPP::Metadata::Config->new();   # Parser for metadata config files
     256        my $metadata = $mdcParser->parse(join "", @contents);
     257        unless ($metadata) {
     258            &my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_PROG_ERROR);
     259        }
     260
     261        # extract the stats from the metadata
     262        unless ($stats->parse($metadata)) {
     263            &my_die("Failure extracting metadata from the statistics output file.\n", $exp_id, $chip_id, $class_id, $PS_EXIT_PROG_ERROR);
     264        }
    235265
    236266        # run addstar on the output fpaObjects (if a DVO database is defined)
     
    266296$fpaCommand .= " -dbname $dbname" if defined $dbname;
    267297$fpaCommand .= $chipStats->cmdflags();
     298$fpaCommand .= $camStats->cmdflags();
    268299
    269300# Add the result into the database
Note: See TracChangeset for help on using the changeset viewer.