IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 3, 2010, 3:33:37 PM (16 years ago)
Author:
rhenders
Message:

Now pulling exposure name from the Db and passing it to ippToPsps to include in FITS files

File:
1 edited

Legend:

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

    r28120 r28205  
    1212
    1313# globals
    14 my ($verbose, $save_temps, $no_op, $no_update, $camera, $batchType, $output, $dvodb, $datastoreProduct, $label, $singleExpId, $no_publish, $force);
     14my ($verbose, $save_temps, $no_op, $no_update, $camera, $batchType, $output, $dvodb, $datastoreProduct, $survey, $singleExpId, $no_publish, $force);
    1515
    1616# default values for certain globals
     
    3131        'batch|b=s' => \$batchType,
    3232        'dvodb|d=s' => \$dvodb,
    33         'label|l=s' => \$label,
     33        'survey|s=s' => \$survey,
    3434        'expid|e=s' => \$singleExpId,
    3535        'product|p=s' => \$datastoreProduct,
     
    4949        "--batch <init|det|diff|stack>\n".
    5050        "--output <path>\n".
    51         "--label <label> or --expid <expid>\n" .
     51        "--survey <ThreePi|MD01,2 etc|STS|SAS|SweetSpot> or --expid <expid>\n" .
    5252        "--dvodb <path>\n".
    5353        "\n   Optional:\n\n".
     
    6262defined $output and
    6363defined $dvodb and
    64 ( defined $label or defined $singleExpId );
     64( defined $survey or defined $singleExpId );
    6565
    6666# check we can run programs and get camera config
     
    118118#######################################################################################
    119119#
    120 # Finds all exposures for the provided label and generates PSPS FITS data for them
     120# Finds all exposures for the provided TODO and generates PSPS FITS data for them
    121121#
    122122#######################################################################################
     
    132132    if (!$singleExpId) {
    133133
    134         # query to retrieve all exposures with the provided label
    135134        $query = $gpc1Db->prepare(<<SQL);
    136135
    137         SELECT DISTINCT rawExp.exp_id, camRun.dist_group
    138             FROM camRun, chipRun, rawExp
    139             WHERE camRun.chip_id = chipRun.chip_id
    140             AND chipRun.exp_id = rawExp.exp_id
    141             AND camRun.dist_group LIKE 'ThreePi'
    142             AND rawExp.exp_id > $lastExpId
    143             ORDER BY rawExp.exp_id ASC
     136        SELECT rawExp.exp_id, rawExp.exp_name, camRun.dist_group
     137            FROM camRun, chipRun, rawExp
     138            WHERE camRun.state = 'full'
     139            AND camRun.chip_id = chipRun.chip_id
     140            AND chipRun.exp_id = rawExp.exp_id
     141            AND camRun.dist_group = '$survey'   
     142            AND rawExp.exp_id > 145986
     143            GROUP BY  rawExp.exp_id
     144            ORDER BY rawExp.exp_id ASC;
    144145SQL
     146
     147            #AND rawExp.dateobs <= '2010-03-12'
     148
     149  #      SELECT DISTINCT rawExp.exp_id, camRun.dist_group
     150  #          FROM camRun, chipRun, rawExp
     151  #          WHERE camRun.chip_id = chipRun.chip_id
     152  #          AND chipRun.exp_id = rawExp.exp_id
     153  #          AND camRun.dist_group LIKE 'ThreePi'
     154  #          AND rawExp.exp_id > $lastExpId
     155  #          ORDER BY rawExp.exp_id ASC
     156#SQL
    145157            #AND rawExp.exp_id > $lastExpId
    146158            #AND camRun.label LIKE '%$label%'
     
    153165        $query = $gpc1Db->prepare(<<SQL);
    154166
    155         SELECT DISTINCT rawExp.exp_id, dist_group FROM rawExp, chipRun WHERE chipRun.exp_id = rawExp.exp_id AND rawExp.exp_id = $singleExpId
     167        SELECT DISTINCT rawExp.exp_id,  rawExp.exp_name, dist_group
     168            FROM rawExp, chipRun
     169            WHERE chipRun.exp_id = rawExp.exp_id
     170            AND rawExp.exp_id = $singleExpId
    156171SQL
    157172    }
     
    168183    # loop round exposures
    169184    while (my @row = $query->fetchrow_array()) {
    170         my ($expId, $distGroup) = @row;
     185        my ($expId, $expName, $distGroup) = @row;
    171186
    172187        if (isExposureAlreadyProcessed($ippToPspsDb, $expId)) {
     
    174189                if ($force) {print "* Forcing....\n";}
    175190                else {next};
    176                 }
     191        }
    177192
    178193        my $surveyType = getSurveyTypeFromDistGroup($distGroup);
     
    181196        $jobId = getNewBatchId($ippToPspsDb, $expId, $surveyType);
    182197
    183 # TODO quit here if no sensible job ID
     198        # TODO quit here if no sensible job ID
    184199
    185200        # generate batch and job paths from job and batch IDs
     
    188203        my $batchDir = sprintf("B%03d", $batchId);
    189204        my $batchOutputPath = sprintf("$jobOutputPath/%s", $batchDir);
    190 
    191205        print "* Preparing exposure $expId as job '$job'...\n";
    192206
     
    196210
    197211        # run IppToPsps program
    198         if (runIppToPsps($gpc1Db, $expId, $batchOutputPath, $batchType)) {
     212        if (runIppToPsps($gpc1Db, $expId, $expName, $surveyType, $batchOutputPath, $batchType)) {
    199213
    200214            # write batch manifest and tar and zip up
     
    358372#######################################################################################
    359373sub runIppToPsps {
    360     my ($gpc1Db, $expId, $batchOutputPath, $batchType) = @_;
     374    my ($gpc1Db, $expId, $expName, $surveyType, $batchOutputPath, $batchType) = @_;
    361375
    362376    my $success = 0;
    363377
    364     # before anything else, we can publish the init batch
    365378    if ($batchType =~ /init/) {
    366379        $success = produceInit($batchOutputPath);
    367380    }
    368381    elsif ($batchType =~ /det/) {
    369         $success = produceDetections($gpc1Db, $expId, $batchOutputPath);
     382        $success = produceDetections($gpc1Db, $expId, $expName, $surveyType, $batchOutputPath);
    370383    }
    371384    elsif ($batchType =~ /diff/) {
    372         $success = produceDiffs($gpc1Db, $expId, $batchOutputPath);
     385        $success = produceDiffs($gpc1Db, $expId, $expName, $surveyType, $batchOutputPath);
    373386    }
    374387
     
    673686#######################################################################################
    674687sub produceDetections {
    675     my ($gpc1Db,$expId,$outputPath) = @_;
     688    my ($gpc1Db, $expId, $expName, $surveyType, $outputPath) = @_;
    676689
    677690    # query to retrieve nebulous key of camera smf file for this exposure
     
    709722        close $tempFile;
    710723
    711         $success = runProgram($tempName, $outputPath, $expId, $batchType);
     724        $success = runProgram($tempName, $outputPath, $expId, $expName, $surveyType, $batchType);
    712725        return $success;
    713726    }
     
    720733#######################################################################################
    721734sub produceDiffs {
    722     my ($gpc1Db,$expId,$outputPath) = @_;
     735    my ($gpc1Db, $expId, $expName, $surveyType, $outputPath) = @_;
    723736
    724737    my $query =
     
    758771    }
    759772
    760     my $ret = runProgram($tempName, $outputPath, $expId, $batchType);
     773    my $ret = runProgram($tempName, $outputPath, $expId, $expName, $surveyType, $batchType);
    761774
    762775    close $tempFile;
     
    771784#######################################################################################
    772785sub runProgram {
    773     my ($input, $output, $expid, $batchType) = @_;
     786    my ($input, $output, $expid, $expName, $surveyType, $batchType) = @_;
    774787
    775788    # build command
     
    780793    $command .= " -config config"; # TODO
    781794    $command .= " -expid $expid";
     795    $command .= " -expname $expName";
    782796    $command .= " -batch $batchType";
    783797    $command .= " -results $resultsFileName";
Note: See TracChangeset for help on using the changeset viewer.