IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 25, 2006, 4:50:36 PM (20 years ago)
Author:
Paul Price
Message:

Adding statistics input to database.

File:
1 edited

Legend:

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

    r8617 r8621  
    5656# Stack the files
    5757my $output = $detType . '_' . $classId . '_' . $detId . '_' . $iter . '.fit'; # Output name
     58my $outputStats = $detType . '_' . $classId . '_' . $detId . '_' . $iter . '.stats'; # Statistics name
    5859{
    5960    my $command = "$ppMerge $output"; # Command to run
     
    6465    $command .= " -recipe PPMERGE $recipe";
    6566    $command .= ' -type ' . uc($detType); # Type of stacking to perform
     67    $command .= " -stats $outputStats"; # Statistics output filename
    6668
    6769    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    6971    die "Unable to perform ppMerge: $error_code\n" if not $success;
    7072    die "Unable to find expected output file: $output\n" if not -f $output;
     73    die "Unable to find expected output file: $outputStats\n" if not -f $outputStats;
    7174}
    7275
    73 ### XXX: Need to add statistics
    74 my $bg_mean = 0;
    75 my $bg_stdev = 0;
    76 my $bg_mean_stdev = 0;
     76### Could do some sort of JPEG generation here.
    7777
     78# Get the statistics on the stacked image
     79my $stats;                      # Statistics from ppImage
     80{
     81    my $statsFile;              # File handle
     82    open $statsFile, "$outputStats" or die "Can't open statistics file $outputStats: $!\n";
     83    my @contents = <$statsFile>; # Contents of file
     84    close $statsFile;
     85    my $mdcParser = PS::IPP::Metadata::Config->new;     # Parser for metadata config files
     86    my $metadata = $mdcParser->parse(join "", @contents); # Metadata from the stats
     87    $stats = PS::IPP::Metadata::Stats->new(); # Stats parser
     88    $stats->parse($metadata) or die "Unable to find all values in statistics output.\n";
     89}
    7890
    7991# Add the resultant into the database
     
    8193    my $command = "$dettool -addstacked -det_id $detId -iteration $iter -class_id $classId" .
    8294        " -uri $output -recip $recipe"; # Command to run
    83     $command .= ' -bg ' . $bg_mean;
    84     $command .= ' -bg_stdev ' . $bg_stdev;
    85     $command .= ' -bg_mean_stdev ' . $bg_mean_stdev;
     95    $command .= ' -bg ' . $stats->bg_mean();
     96    $command .= ' -bg_stdev ' . $stats->bg_stdev();
     97    $command .= ' -bg_mean_stdev ' . $stats->bg_mean_stdev();
    8698    $command .= ' -pleasenormalize' if NORMALISE()->{$detType};
    8799    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
Note: See TracChangeset for help on using the changeset viewer.