IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 28, 2010, 4:26:47 PM (16 years ago)
Author:
rhenders
Message:

Now storing results in XML format

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/scripts/ippToPsps_run.pl

    r28260 r28529  
    1010use constant DB_SOCKET => '/var/run/mysqld/mysqld.sock';
    1111use File::Temp qw(tempfile);
     12use XML::LibXML;
    1213
    1314# globals
     
    7374
    7475# make a temporary file for saving results
    75 my ($resultsFile, $resultsFileName) = tempfile( "/tmp/ippToPsps_results.XXXX", UNLINK => !$save_temps);
     76my ($resultsFile, $resultsFilePath) = tempfile( "/tmp/ippToPsps_results.XXXX", UNLINK => !$save_temps);
    7677
    7778process();
     
    118119}
    119120
    120 
    121121#######################################################################################
    122122#
     
    160160            AND chipRun.exp_id = rawExp.exp_id
    161161            AND camRun.dist_group = '$survey'   
     162            AND rawExp.dateobs >= '2010-02-20'
    162163            GROUP BY  rawExp.exp_id
    163164            ORDER BY rawExp.exp_id ASC;
     
    457458
    458459    # read results
    459     open (MYFILE, $resultsFileName);
    460     my $i = 0;
    461 
    462     # detection results
    463     my $minObjId;
    464     my $maxObjId;
    465     my $filename;
    466     if($batchType eq 'det') {
    467 
    468         while (<MYFILE>) {
    469             chomp;
    470             if ($i == 0) { $filename = $_; }
    471             if ($i == 1) { $minObjId = $_; }
    472             if ($i == 2) { $maxObjId = $_; }
    473             $i++;
    474         }
    475     }
    476     close (MYFILE);
     460    my $parser = XML::LibXML->new;
     461    my $doc = $parser->parse_file($resultsFilePath);
     462    my $filename = $doc->findvalue('//filename');
     463    my $minObjId = $doc->findvalue('//minObjID');
     464    my $maxObjId = $doc->findvalue('//maxObjID');
    477465
    478466    # create XML file
     
    794782    $command .= " -survey $surveyType";
    795783    $command .= " -batch $batchType";
    796     $command .= " -results $resultsFileName";
     784    $command .= " -results $resultsFilePath";
    797785
    798786    # run command
Note: See TracChangeset for help on using the changeset viewer.