Changeset 28205
- Timestamp:
- Jun 3, 2010, 3:33:37 PM (16 years ago)
- Location:
- trunk/ippToPsps
- Files:
-
- 4 edited
-
scripts/ippToPsps_run.pl (modified) (19 diffs)
-
src/ippToPsps.c (modified) (4 diffs)
-
src/ippToPsps.h (modified) (1 diff)
-
src/ippToPspsBatchDetection.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/scripts/ippToPsps_run.pl
r28120 r28205 12 12 13 13 # globals 14 my ($verbose, $save_temps, $no_op, $no_update, $camera, $batchType, $output, $dvodb, $datastoreProduct, $ label, $singleExpId, $no_publish, $force);14 my ($verbose, $save_temps, $no_op, $no_update, $camera, $batchType, $output, $dvodb, $datastoreProduct, $survey, $singleExpId, $no_publish, $force); 15 15 16 16 # default values for certain globals … … 31 31 'batch|b=s' => \$batchType, 32 32 'dvodb|d=s' => \$dvodb, 33 ' label|l=s' => \$label,33 'survey|s=s' => \$survey, 34 34 'expid|e=s' => \$singleExpId, 35 35 'product|p=s' => \$datastoreProduct, … … 49 49 "--batch <init|det|diff|stack>\n". 50 50 "--output <path>\n". 51 "-- label <label> or --expid <expid>\n" .51 "--survey <ThreePi|MD01,2 etc|STS|SAS|SweetSpot> or --expid <expid>\n" . 52 52 "--dvodb <path>\n". 53 53 "\n Optional:\n\n". … … 62 62 defined $output and 63 63 defined $dvodb and 64 ( defined $ labelor defined $singleExpId );64 ( defined $survey or defined $singleExpId ); 65 65 66 66 # check we can run programs and get camera config … … 118 118 ####################################################################################### 119 119 # 120 # Finds all exposures for the provided labeland generates PSPS FITS data for them120 # Finds all exposures for the provided TODO and generates PSPS FITS data for them 121 121 # 122 122 ####################################################################################### … … 132 132 if (!$singleExpId) { 133 133 134 # query to retrieve all exposures with the provided label135 134 $query = $gpc1Db->prepare(<<SQL); 136 135 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; 144 145 SQL 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 145 157 #AND rawExp.exp_id > $lastExpId 146 158 #AND camRun.label LIKE '%$label%' … … 153 165 $query = $gpc1Db->prepare(<<SQL); 154 166 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 156 171 SQL 157 172 } … … 168 183 # loop round exposures 169 184 while (my @row = $query->fetchrow_array()) { 170 my ($expId, $ distGroup) = @row;185 my ($expId, $expName, $distGroup) = @row; 171 186 172 187 if (isExposureAlreadyProcessed($ippToPspsDb, $expId)) { … … 174 189 if ($force) {print "* Forcing....\n";} 175 190 else {next}; 176 }191 } 177 192 178 193 my $surveyType = getSurveyTypeFromDistGroup($distGroup); … … 181 196 $jobId = getNewBatchId($ippToPspsDb, $expId, $surveyType); 182 197 183 # TODO quit here if no sensible job ID198 # TODO quit here if no sensible job ID 184 199 185 200 # generate batch and job paths from job and batch IDs … … 188 203 my $batchDir = sprintf("B%03d", $batchId); 189 204 my $batchOutputPath = sprintf("$jobOutputPath/%s", $batchDir); 190 191 205 print "* Preparing exposure $expId as job '$job'...\n"; 192 206 … … 196 210 197 211 # run IppToPsps program 198 if (runIppToPsps($gpc1Db, $expId, $ batchOutputPath, $batchType)) {212 if (runIppToPsps($gpc1Db, $expId, $expName, $surveyType, $batchOutputPath, $batchType)) { 199 213 200 214 # write batch manifest and tar and zip up … … 358 372 ####################################################################################### 359 373 sub runIppToPsps { 360 my ($gpc1Db, $expId, $ batchOutputPath, $batchType) = @_;374 my ($gpc1Db, $expId, $expName, $surveyType, $batchOutputPath, $batchType) = @_; 361 375 362 376 my $success = 0; 363 377 364 # before anything else, we can publish the init batch365 378 if ($batchType =~ /init/) { 366 379 $success = produceInit($batchOutputPath); 367 380 } 368 381 elsif ($batchType =~ /det/) { 369 $success = produceDetections($gpc1Db, $expId, $ batchOutputPath);382 $success = produceDetections($gpc1Db, $expId, $expName, $surveyType, $batchOutputPath); 370 383 } 371 384 elsif ($batchType =~ /diff/) { 372 $success = produceDiffs($gpc1Db, $expId, $ batchOutputPath);385 $success = produceDiffs($gpc1Db, $expId, $expName, $surveyType, $batchOutputPath); 373 386 } 374 387 … … 673 686 ####################################################################################### 674 687 sub produceDetections { 675 my ($gpc1Db, $expId,$outputPath) = @_;688 my ($gpc1Db, $expId, $expName, $surveyType, $outputPath) = @_; 676 689 677 690 # query to retrieve nebulous key of camera smf file for this exposure … … 709 722 close $tempFile; 710 723 711 $success = runProgram($tempName, $outputPath, $expId, $ batchType);724 $success = runProgram($tempName, $outputPath, $expId, $expName, $surveyType, $batchType); 712 725 return $success; 713 726 } … … 720 733 ####################################################################################### 721 734 sub produceDiffs { 722 my ($gpc1Db, $expId,$outputPath) = @_;735 my ($gpc1Db, $expId, $expName, $surveyType, $outputPath) = @_; 723 736 724 737 my $query = … … 758 771 } 759 772 760 my $ret = runProgram($tempName, $outputPath, $expId, $ batchType);773 my $ret = runProgram($tempName, $outputPath, $expId, $expName, $surveyType, $batchType); 761 774 762 775 close $tempFile; … … 771 784 ####################################################################################### 772 785 sub runProgram { 773 my ($input, $output, $expid, $ batchType) = @_;786 my ($input, $output, $expid, $expName, $surveyType, $batchType) = @_; 774 787 775 788 # build command … … 780 793 $command .= " -config config"; # TODO 781 794 $command .= " -expid $expid"; 795 $command .= " -expname $expName"; 782 796 $command .= " -batch $batchType"; 783 797 $command .= " -results $resultsFileName"; -
trunk/ippToPsps/src/ippToPsps.c
r27871 r28205 144 144 psMetadata *arguments = psMetadataAlloc(); 145 145 psMetadataAddStr(arguments, PS_LIST_TAIL, "-expid", 0, "Exposure ID", NULL); 146 psMetadataAddStr(arguments, PS_LIST_TAIL, "-expname", 0, "Exposure name", NULL); 146 147 psMetadataAddStr(arguments, PS_LIST_TAIL, "-input", 0, "Path to FITS inout", NULL); 147 148 psMetadataAddStr(arguments, PS_LIST_TAIL, "-output", 0, "Path to FITS output", NULL); … … 161 162 if (tmp) this->expId = atoi(tmp); 162 163 //free(tmp); tmp = NULL; 164 this->expName = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-expname")); 163 165 this->fitsInPath = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-input")); 164 166 this->resultsPath = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-results")); … … 176 178 177 179 if ( 180 (this->batchType != BATCH_INIT && !this->expName) || 178 181 (this->batchType != BATCH_INIT && !this->fitsInPath) || 179 182 (this->batchType != BATCH_INIT && !this->resultsPath) || … … 237 240 238 241 this->expId = -1; 242 this->expName = NULL; 239 243 this->fitsInPath = NULL; 240 244 this->resultsPath = NULL; -
trunk/ippToPsps/src/ippToPsps.h
r27871 r28205 21 21 22 22 uint32_t expId; // the exposure ID to be used 23 psString expName; // the exposure name 23 24 uint8_t batchType; // PSPS batch type 24 25 psString fitsInPath; // path to FITS input -
trunk/ippToPsps/src/ippToPspsBatchDetection.c
r28105 r28205 63 63 // FrameMeta values 64 64 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); 65 66 66 67 int8_t surveyID = 0; // TODO … … 199 200 skylist = dvoSkyListByExternID(this->dvoConfig, sourceId, imageId, &pImage); 200 201 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); 202 205 continue; 203 206 }
Note:
See TracChangeset
for help on using the changeset viewer.
