IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28205


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

Location:
trunk/ippToPsps
Files:
4 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";
  • trunk/ippToPsps/src/ippToPsps.c

    r27871 r28205  
    144144    psMetadata *arguments = psMetadataAlloc();
    145145    psMetadataAddStr(arguments, PS_LIST_TAIL, "-expid", 0, "Exposure ID", NULL);
     146    psMetadataAddStr(arguments, PS_LIST_TAIL, "-expname", 0, "Exposure name", NULL);
    146147    psMetadataAddStr(arguments, PS_LIST_TAIL, "-input", 0, "Path to FITS inout", NULL);
    147148    psMetadataAddStr(arguments, PS_LIST_TAIL, "-output", 0, "Path to FITS output", NULL);
     
    161162        if (tmp) this->expId = atoi(tmp);
    162163        //free(tmp); tmp = NULL;
     164        this->expName = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-expname"));
    163165        this->fitsInPath = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-input"));
    164166        this->resultsPath = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-results"));
     
    176178
    177179        if (
     180                (this->batchType != BATCH_INIT && !this->expName) ||
    178181                (this->batchType != BATCH_INIT && !this->fitsInPath) ||
    179182                (this->batchType != BATCH_INIT && !this->resultsPath) ||
     
    237240
    238241    this->expId = -1;
     242    this->expName = NULL;
    239243    this->fitsInPath = NULL;
    240244    this->resultsPath = NULL;
  • trunk/ippToPsps/src/ippToPsps.h

    r27871 r28205  
    2121
    2222    uint32_t expId;            // the exposure ID to be used
     23    psString expName;          // the exposure name
    2324    uint8_t batchType;         // PSPS batch type
    2425    psString fitsInPath;       // path to FITS input
  • trunk/ippToPsps/src/ippToPspsBatchDetection.c

    r28105 r28205  
    6363    // FrameMeta values
    6464    fits_write_col(this->fitsOut, TLONG, FRAMEMETA_FRAMEID, 1, 1, 1, &this->expId, &status);
     65    fits_write_col(this->fitsOut, TSTRING, FRAMEMETA_FRAMENAME, 1, 1, 1, &this->expName, &status);
    6566
    6667    int8_t surveyID = 0; // TODO
     
    199200            skylist = dvoSkyListByExternID(this->dvoConfig, sourceId, imageId, &pImage);
    200201            if (skylist == NULL) {
    201                 psError(PS_ERR_IO, false, "DVO: can't find SkyList for sourceId='%d' imageId='%d' (CCD = XY%s): skipping\n", sourceId, imageId, ccdNumber);
     202                psError(PS_ERR_IO, false,
     203                        "DVO: can't find SkyList for sourceId='%d' imageId='%d' (CCD = XY%s): skipping\n",
     204                        sourceId, imageId, ccdNumber);
    202205                continue;
    203206            }
Note: See TracChangeset for help on using the changeset viewer.