Changeset 31033
- Timestamp:
- Mar 24, 2011, 11:03:32 AM (15 years ago)
- Location:
- trunk/ippToPsps/src
- Files:
-
- 7 edited
-
Batch.c (modified) (4 diffs)
-
DetectionBatch.c (modified) (9 diffs)
-
Fits.c (modified) (16 diffs)
-
FitsGenerator.c (modified) (11 diffs)
-
InitBatch.c (modified) (2 diffs)
-
InitData.c (modified) (4 diffs)
-
StackBatch.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/src/Batch.c
r31030 r31033 63 63 if (this->exitCode != PS_EXIT_SUCCESS) { 64 64 65 this->logger->print(this->logger, MSG_ERROR, "Batch :Failed, so deleting fits file\n");65 this->logger->print(this->logger, MSG_ERROR, "Batch", "Failed, so deleting fits file\n"); 66 66 this->fitsOut->delete(this->fitsOut); 67 67 } … … 105 105 if (file == NULL) { 106 106 107 this->logger->print(this->logger, MSG_ERROR, "Batch :Unable to open file at %s\n", this->fitsInPath);107 this->logger->print(this->logger, MSG_ERROR, "Batch", "Unable to open file at %s\n", this->fitsInPath); 108 108 return false; 109 109 } … … 113 113 while (fgets(line, 1000, file) != NULL) this->numOfInputFiles++; 114 114 115 this->logger->print(this->logger, MSG_INFO, "Batch :%d input files found\n", this->numOfInputFiles);115 this->logger->print(this->logger, MSG_INFO, "Batch", "%d input files found\n", this->numOfInputFiles); 116 116 117 117 if (this->numOfInputFiles < 1) return false; … … 156 156 if (!this->pmconfig) { 157 157 158 this->logger->print(this->logger, MSG_ERROR, "Batch :Unable to read configuration\n");158 this->logger->print(this->logger, MSG_ERROR, "Batch", "Unable to read configuration\n"); 159 159 this->exitCode = PS_EXIT_CONFIG_ERROR; 160 160 return false; -
trunk/ippToPsps/src/DetectionBatch.c
r31030 r31033 157 157 } 158 158 159 this->base.logger->print(this->base.logger, MSG_INFO, 159 this->base.logger->print(this->base.logger, MSG_INFO, "DetectionBatch", 160 160 "+-----------+---------+----------+----------------+--------------+--------------+\n"); 161 this->base.logger->print(this->base.logger, MSG_INFO, 161 this->base.logger->print(this->base.logger, MSG_INFO, "DetectionBatch", 162 162 "| Extension | Rows in | Rows out | Duplicate IDs | Invalid Flux | Bogus det ID |\n"); 163 163 … … 195 195 skylist = dvoSkyListByExternID(this->base.dvoConfig, sourceId, imageId, &image); 196 196 if (skylist == NULL) { 197 this->base.logger->print(this->base.logger, MSG_ERROR, 197 this->base.logger->print(this->base.logger, MSG_ERROR, "DetectionBatch", 198 198 "DVO: can't find SkyList for sourceId='%d' imageId='%d' (CCD = XY%s): skipping this chip\n", 199 199 sourceId, imageId, ccdNumber); … … 210 210 if (numDvoDetections > this->MAXDETECT ) { 211 211 212 this->base.logger->print(this->base.logger, MSG_ERROR, "Number of detections (%d) exceeds max limit (%ld)\n",212 this->base.logger->print(this->base.logger, MSG_ERROR, "DetectionBatch", "Number of detections (%d) exceeds max limit (%ld)\n", 213 213 numDvoDetections, this->MAXDETECT); 214 214 error = true; … … 375 375 } 376 376 377 this->base.logger->print(this->base.logger, MSG_INFO, 377 this->base.logger->print(this->base.logger, MSG_INFO, "DetectionBatch", 378 378 "| %s | %5ld | %5d | %5d | %5d | %5d |\n", 379 379 extensionName, nChipDetectionsIn, nChipDetectionsOut, numOfDuplicates, numInvalidFlux, numOfInvalidIppIDet); … … 388 388 } 389 389 390 this->base.logger->print(this->base.logger, MSG_INFO, 390 this->base.logger->print(this->base.logger, MSG_INFO, "DetectionBatch", 391 391 "+-----------+---------+----------+----------------+--------------+--------------+\n"); 392 392 393 this->base.logger->print(this->base.logger, MSG_INFO, " Total detections for this exposure = %ld\n", totalDetectionsOut);393 this->base.logger->print(this->base.logger, MSG_INFO, "DetectionBatch", "Total detections for this exposure = %ld\n", totalDetectionsOut); 394 394 395 395 // free-up memory … … 425 425 writeResults(this, minObjID, maxObjID, totalDetectionsOut); 426 426 427 this->base.logger->print(this->base.logger, MSG_INFO, "D ata written for a total of %d chips/OTAs", nOta);427 this->base.logger->print(this->base.logger, MSG_INFO, "DetectionBatch", "Data written for a total of %d chips/OTAs\n", nOta); 428 428 429 429 if (error || nOta < 1) this->base.exitCode = PS_EXIT_DATA_ERROR; … … 487 487 !haveExpName) { 488 488 489 this->base.logger->print(this->base.logger, MSG_ERROR, " Problem with supplied arguments\n");489 this->base.logger->print(this->base.logger, MSG_ERROR, "DetectionBatch", "Problem with supplied arguments\n"); 490 490 this->print(this); 491 491 this->base.exitCode = PS_EXIT_CONFIG_ERROR; … … 501 501 DetectionBatch* new_DetectionBatch(Logger* logger, int *argc, char **argv) { 502 502 503 logger->print(logger, MSG_DEBUG, "DetectionBatch :Constructor\n");503 logger->print(logger, MSG_DEBUG, "DetectionBatch", "Constructor\n"); 504 504 DetectionBatch *this = (DetectionBatch*)calloc(1, sizeof(DetectionBatch)); 505 505 … … 526 526 int main(int argc, char **argv) { 527 527 528 psTimerStart("detectionbatch");529 530 528 // ippToPsps_VersionPrint(); 531 529 532 int exitCode;533 534 530 Logger* logger = new_Logger(NULL); 531 logger->print(logger, MSG_INFO, "main", "Creating new detection batch\n"); 535 532 536 533 DetectionBatch* detectionBatch = new_DetectionBatch(logger, &argc, argv); 537 534 detectionBatch->base.run(detectionBatch); 538 exitCode = detectionBatch->base.exitCode;535 int exitCode = detectionBatch->base.exitCode; 539 536 540 537 detectionBatch->destroy(detectionBatch); 541 538 542 double secs = psTimerMark("detectionbatch");543 544 logger->print(logger, MSG_INFO, "detectionbatch completed %ssuccessfully, with exit code %d, in %.1f %s\n",545 (exitCode == PS_EXIT_SUCCESS) ? "" : "un",546 exitCode,547 (secs<60.0) ? secs : (secs/60.0),548 (secs<60.0) ? "sec(s)" : "min(s)");549 550 539 // tidy up 551 psTimerStop();552 540 psLibFinalize(); 553 541 logger->destroy(logger); -
trunk/ippToPsps/src/Fits.c
r31030 r31033 26 26 if (!strncmp(typename, "TSTRING", 7)) return TSTRING; 27 27 28 // this->logger->print(this->logger, MSG_ERROR, "Fits :Don't understand data type '%s'", typename);28 // this->logger->print(this->logger, MSG_ERROR, "Fits", "Don't understand data type '%s'", typename); 29 29 30 30 return 0; … … 36 36 static void destroy(Fits* this) { 37 37 38 this->logger->print(this->logger, MSG_DEBUG, "Fits :Destructor\n");38 this->logger->print(this->logger, MSG_DEBUG, "Fits", "Destructor\n"); 39 39 40 40 int status = 0; 41 41 if (fits_close_file(this->file, &status)) { 42 42 43 this->logger->print(this->logger, MSG_ERROR, "Fits :Unable to close FITS file '%s'\n", this->path);43 this->logger->print(this->logger, MSG_ERROR, "Fits", "Unable to close FITS file '%s'\n", this->path); 44 44 fits_report_error(stderr, status); 45 45 } 46 46 else 47 this->logger->print(this->logger, MSG_INFO, "Fits :Closed FITS file '%s'\n", this->path);47 this->logger->print(this->logger, MSG_INFO, "Fits", "Closed FITS file '%s'\n", this->path); 48 48 49 49 free(this); … … 60 60 if (status) { 61 61 62 this->logger->print(this->logger, MSG_ERROR, "Fits :Could not get value for header key '%s' from file at '%s'\n", name, this->path);62 this->logger->print(this->logger, MSG_ERROR, "Fits", "Could not get value for header key '%s' from file at '%s'\n", name, this->path); 63 63 return false; 64 64 } … … 86 86 if (status) { 87 87 88 this->logger->print(this->logger, MSG_ERROR, "Fits :Failed to read vector column %d row %ld\n", col, row);88 this->logger->print(this->logger, MSG_ERROR, "Fits", "Failed to read vector column %d row %ld\n", col, row); 89 89 return false; 90 90 } … … 102 102 if (status) { 103 103 104 this->logger->print(this->logger, MSG_ERROR, "Fits :Could not get column number for '%s'\n", name);104 this->logger->print(this->logger, MSG_ERROR, "Fits", "Could not get column number for '%s'\n", name); 105 105 return false; 106 106 } … … 123 123 if (status) { 124 124 125 this->logger->print(this->logger, MSG_ERROR, "Fits :Unable to read col '%s'\n", name);125 this->logger->print(this->logger, MSG_ERROR, "Fits", "Unable to read col '%s'\n", name); 126 126 return false; 127 127 } … … 131 131 if (status) { 132 132 133 this->logger->print(this->logger, MSG_ERROR, "Fits :Unable to read type info for '%s'\n", name);133 this->logger->print(this->logger, MSG_ERROR, "Fits", "Unable to read type info for '%s'\n", name); 134 134 return false; 135 135 } … … 147 147 if (fits_movnam_hdu(this->file, type, name, 0, &status)) { 148 148 149 this->logger->print(this->logger, MSG_ERROR, "Fits :Can't move to table extension named '%s'\n", name);149 this->logger->print(this->logger, MSG_ERROR, "Fits", "Can't move to table extension named '%s'\n", name); 150 150 return false; 151 151 } … … 178 178 if (fits_get_num_rows(this->file, count, &status)) { 179 179 180 this->logger->print(this->logger, MSG_ERROR, "Fits :Count not count rows in this table\n");180 this->logger->print(this->logger, MSG_ERROR, "Fits", "Count not count rows in this table\n"); 181 181 return false; 182 182 } … … 201 201 if (remove(this->path) == -1) { 202 202 203 this->logger->print(this->logger, MSG_ERROR, "Fits :Unable to delete '%s'\n", this->path);204 return false; 205 } 206 207 this->logger->print(this->logger, MSG_INFO, "Fits :Deleted FITS file at '%s'\n", this->path);203 this->logger->print(this->logger, MSG_ERROR, "Fits", "Unable to delete '%s'\n", this->path); 204 return false; 205 } 206 207 this->logger->print(this->logger, MSG_INFO, "Fits", "Deleted FITS file at '%s'\n", this->path); 208 208 209 209 return true; … … 235 235 if (status) { 236 236 237 this->logger->print(this->logger, MSG_ERROR, "Fits :Unable to delete rows using rowlist\n");237 this->logger->print(this->logger, MSG_ERROR, "Fits", "Unable to delete rows using rowlist\n"); 238 238 return false; 239 239 } … … 290 290 else { 291 291 292 this->logger->print(this->logger, MSG_ERROR, "Fits :Don't understand datatype '%d'\n", datatype);293 return false; 294 } 295 296 if (status) { 297 298 this->logger->print(this->logger, MSG_ERROR, "Fits :Unable to read column data from column %d\n", colnum);292 this->logger->print(this->logger, MSG_ERROR, "Fits", "Don't understand datatype '%d'\n", datatype); 293 return false; 294 } 295 296 if (status) { 297 298 this->logger->print(this->logger, MSG_ERROR, "Fits", "Unable to read column data from column %d\n", colnum); 299 299 return false; 300 300 … … 338 338 if (status) { 339 339 340 this->logger->print(this->logger, MSG_ERROR, "Fits :Unable to write column data for column %d\n", colnum);340 this->logger->print(this->logger, MSG_ERROR, "Fits", "Unable to write column data for column %d\n", colnum); 341 341 return false; 342 342 … … 362 362 if (status) { 363 363 364 this->logger->print(this->logger, MSG_ERROR, "Fits :Unable to create table: '%s'\n", name);364 this->logger->print(this->logger, MSG_ERROR, "Fits", "Unable to create table: '%s'\n", name); 365 365 return false; 366 366 } … … 415 415 416 416 Fits* this = init(path, logger); 417 this->logger->print(this->logger, MSG_DEBUG, "Fits :Constructor for existing file at '%s'\n", path);417 this->logger->print(this->logger, MSG_DEBUG, "Fits", "Constructor for existing file at '%s'\n", path); 418 418 419 419 int status = 0; 420 420 if (fits_open_file(&this->file, path, READONLY, &status)) { 421 421 422 this->logger->print(this->logger, MSG_ERROR, "Fits :Unable to open FITS file here %s\n", path);422 this->logger->print(this->logger, MSG_ERROR, "Fits", "Unable to open FITS file here %s\n", path); 423 423 this->file = NULL; 424 424 } … … 436 436 437 437 Fits* this = init(path, logger); 438 this->logger->print(this->logger, MSG_DEBUG, "Fits :Constructor for new file at '%s'\n", path);438 this->logger->print(this->logger, MSG_DEBUG, "Fits", "Constructor for new file at '%s'\n", path); 439 439 440 440 int status = 0; 441 441 if (fits_create_file(&this->file, path, &status)) { 442 442 443 this->logger->print(this->logger, MSG_ERROR, "Fits :Unable to create FITS file here '%s'\n", path);443 this->logger->print(this->logger, MSG_ERROR, "Fits", "Unable to create FITS file here '%s'\n", path); 444 444 this->file = NULL; 445 445 } -
trunk/ippToPsps/src/FitsGenerator.c
r31030 r31033 29 29 } 30 30 31 if (!column) this->logger->print(this->logger, MSG_ERROR, "Could not find column '%s' in table '%s'\n", name, table->name); 31 if (!column) this->logger->print(this->logger, MSG_ERROR, "FitsGenerator", 32 "Could not find column '%s' in table '%s'\n", name, table->name); 32 33 33 34 return column; … … 49 50 } 50 51 51 if (!table) this->logger->print(this->logger, MSG_ERROR, "Could not find table '%s'\n", name); 52 if (!table) this->logger->print(this->logger, MSG_ERROR, "FitsGenerator", 53 "Could not find table '%s'\n", name); 52 54 53 55 return table; … … 217 219 218 220 xmlDoc* doc = xmlReadFile(path, NULL, 0); 219 if (doc == NULL) this->logger->print(this->logger, MSG_ERROR, "Unable to open XML file at %s\n", path); 221 if (doc == NULL) this->logger->print(this->logger, MSG_ERROR, "FitsGenerator", 222 "Unable to open XML file at %s\n", path); 220 223 return doc; 221 224 } … … 253 256 if(!tableNode) { 254 257 255 this->logger->print(this->logger, MSG_ERROR, "Could not find table: %s\n", table->name); 258 this->logger->print(this->logger, MSG_ERROR, "FitsGenerator", 259 "Could not find table: %s\n", table->name); 256 260 return false; 257 261 } … … 320 324 321 325 } 322 if (status) this->logger->print(this->logger, MSG_ERROR, "Unable to write value of %s to column %s in table %s\n", 326 if (status) this->logger->print(this->logger, MSG_ERROR, "FitsGenerator", 327 "Unable to write value of %s to column %s in table %s\n", 323 328 tempStr, table->columns[i].pspsName, table->name); 324 329 } … … 391 396 if (columnNum < 1) { 392 397 393 this->logger->print(this->logger, MSG_ERROR, "Found no columns for table '%s'\n", tableName); 398 this->logger->print(this->logger, MSG_ERROR, "FitsGenerator", 399 "Found no columns for table '%s'\n", tableName); 394 400 ret = false; 395 401 } 396 402 397 403 if (columnNum != table->numOfColumns) 398 this->logger->print(this->logger, MSG_ERROR, "Mismatch between number of columns expected (%d) and those found (%d)\n", table->numOfColumns, columnNum); 404 this->logger->print(this->logger, MSG_ERROR, "FitsGenerator", 405 "Mismatch between number of columns expected (%d) and those found (%d)\n", 406 table->numOfColumns, columnNum); 399 407 400 408 return ret; … … 424 432 if (strcmp((const char*)rootElement->name, "tableDescriptions")!=0) { 425 433 426 this->logger->print(this->logger, MSG_ERROR, "Root node of XML is not 'tableDescriptions', as it should be\n"); 434 this->logger->print(this->logger, MSG_ERROR, "FitsGenerator", 435 "Root node of XML is not 'tableDescriptions', as it should be\n"); 427 436 return false; 428 437 } … … 452 461 453 462 if (tableNum != this->numOfTables) 454 this->logger->print(this->logger, MSG_ERROR, "Mismatch between number of tables expected (%d) and those found (%d)\n", this->numOfTables, tableNum); 463 this->logger->print(this->logger, MSG_ERROR, "FitsGenerator", 464 "Mismatch between number of tables expected (%d) and those found (%d)\n", 465 this->numOfTables, tableNum); 455 466 456 467 closeXmlFile(doc); … … 515 526 bool ret = true; 516 527 528 char path[1000]; 529 sprintf(path, "%s/map.xml", this->configsPath); 530 531 struct stat sts; 532 if ((stat(path, &sts)) == -1) { 533 this->logger->print(this->logger, MSG_INFO, "FitsGenerator", 534 "No map file found at '%s'\n", path); 535 return false; 536 } 537 538 xmlDoc* doc = openXmlFile(this, path); 539 540 if (doc == NULL) { 541 542 this->logger->print(this->logger, MSG_ERROR,"FitsGenerator", 543 "Could not create XML document from '%s'\n", path); 544 return false; 545 } 546 547 this->logger->print(this->logger, MSG_INFO, "FitsGenerator", 548 "Using map file at '%s'\n", path); 549 xmlNode* rootElement = xmlDocGetRootElement(doc); 550 551 if (strcmp((const char*)rootElement->name, "tabledata")!=0) { 552 this->logger->print(this->logger, MSG_ERROR,"FitsGenerator", 553 "Root node of XML is not 'tabledata', as it should be\n"); 554 return false; 555 } 556 557 xmlNode* node = NULL; 558 559 // loop round all available tables 560 for (node = rootElement->children; node; node = node->next) { 561 if (node->type == XML_ELEMENT_NODE) { 562 563 if (strcmp((const char*)node->name, "table")==0) { 564 565 if (!loadTableMappings(this, node)) ret = false; 566 } 567 } 568 } 569 570 closeXmlFile(doc); 571 572 return ret; 573 } 574 575 /** 576 Populate the provided table with data from XML 577 */ 578 static bool populateFromFile(FitsGenerator* this, Fits *fitsOut) { 579 580 bool ret = true; 517 581 psString path = NULL; 518 psStringAppend(&path, "%s/ map.xml", this->configsPath);582 psStringAppend(&path, "%s/data.xml", this->configsPath); 519 583 520 584 xmlDoc* doc = openXmlFile(this, path); … … 529 593 530 594 if (strcmp((const char*)rootElement->name, "tabledata")!=0) { 531 this->logger->print(this->logger, MSG_ERROR, "Root node of XML is not 'tabledata', as it should be\n"); 532 return false; 533 } 534 535 xmlNode* node = NULL; 536 537 // loop round all available tables 538 for (node = rootElement->children; node; node = node->next) { 539 if (node->type == XML_ELEMENT_NODE) { 540 541 if (strcmp((const char*)node->name, "table")==0) { 542 543 if (!loadTableMappings(this, node)) ret = false; 544 } 545 } 546 } 547 548 closeXmlFile(doc); 549 550 return ret; 551 } 552 553 /** 554 Populate the provided table with data from XML 555 */ 556 static bool populateFromFile(FitsGenerator* this, Fits *fitsOut) { 557 558 bool ret = true; 559 psString path = NULL; 560 psStringAppend(&path, "%s/data.xml", this->configsPath); 561 562 xmlDoc* doc = openXmlFile(this, path); 563 564 if (doc == NULL) { 565 psFree(path); 566 return false; 567 } 568 psFree(path); 569 570 xmlNode* rootElement = xmlDocGetRootElement(doc); 571 572 if (strcmp((const char*)rootElement->name, "tabledata")!=0) { 573 this->logger->print(this->logger, MSG_ERROR, "Root node of XML is not 'tabledata', as it should be\n"); 595 this->logger->print(this->logger, MSG_ERROR, "FitsGenerator", 596 "Root node of XML is not 'tabledata', as it should be\n"); 574 597 return false; 575 598 } … … 679 702 680 703 default: 681 this->logger->print(this->logger, MSG_ERROR, " Don't know IPP type (%d) for mapping from '%d' '%s' to '%s'\n", table->columns[i].ippType,704 this->logger->print(this->logger, MSG_ERROR, "FitsGenerator", "Don't know IPP type (%d) for mapping from '%d' '%s' to '%s'\n", table->columns[i].ippType, 682 705 table->columns[i].ippColNum, table->columns[i].ippName, table->columns[i].pspsName); 683 706 break; -
trunk/ippToPsps/src/InitBatch.c
r31030 r31033 59 59 InitBatch* new_InitBatch(Logger* logger, int *argc, char **argv) { 60 60 61 logger->print(logger, MSG_DEBUG, "InitBatch :Constructor\n");61 logger->print(logger, MSG_DEBUG, "InitBatch", "Constructor\n"); 62 62 InitBatch *this = (InitBatch*)calloc(1, sizeof(InitBatch)); 63 63 … … 80 80 int main(int argc, char **argv) { 81 81 82 psTimerStart("initbatch");83 84 82 // ippToPsps_VersionPrint(); 85 83 86 int exitCode;87 88 84 Logger* logger = new_Logger(NULL); 85 logger->print(logger, MSG_INFO, "main", "Creating new initialization batch\n"); 89 86 90 87 InitBatch* initBatch = new_InitBatch(logger, &argc, argv); 91 88 initBatch->base.run(initBatch); 92 exitCode = initBatch->base.exitCode;89 int exitCode = initBatch->base.exitCode; 93 90 94 91 initBatch->destroy(initBatch); 95 92 96 double secs = psTimerMark("initbatch");97 98 logger->print(logger, MSG_INFO, "initbatch completed %ssuccessfully, with exit code %d, in %.1f %s\n",99 (exitCode == PS_EXIT_SUCCESS) ? "" : "un",100 exitCode,101 (secs<60.0) ? secs : (secs/60.0),102 (secs<60.0) ? "sec(s)" : "min(s)");103 93 104 94 // tidy up 105 psTimerStop();106 95 psLibFinalize(); 107 96 logger->destroy(logger); -
trunk/ippToPsps/src/InitData.c
r31030 r31033 60 60 61 61 this->logger->print(this->logger, MSG_ERROR, 62 "InitData :Could not find value for '%s' for '%s' with value '%s'\n",62 "InitData", "Could not find value for '%s' for '%s' with value '%s'\n", 63 63 attName, keyName, keyValue); 64 64 … … 84 84 if (strcmp((const char*)rootElement->name, "tabledata")!=0) { 85 85 this->logger->print(this->logger, MSG_ERROR, 86 "InitData :Root node of XML is not 'tabledata', as it should be\n");86 "InitData", "Root node of XML is not 'tabledata', as it should be\n"); 87 87 return false; 88 88 } … … 156 156 } 157 157 158 this->logger->print(this->logger, MSG_DEBUG, "InitData : destructor\n");158 this->logger->print(this->logger, MSG_DEBUG, "InitData", "Destructor\n"); 159 159 160 160 free(this); … … 166 166 InitData* new_InitData(const char* path, Logger* logger) { 167 167 168 169 170 168 InitData* this = (InitData*)calloc(1, sizeof(InitData)); 171 169 this->logger = logger; 172 170 173 this->logger->print(this->logger, MSG_DEBUG, "InitData :Constructor\n");171 this->logger->print(this->logger, MSG_DEBUG, "InitData", "Constructor\n"); 174 172 175 173 sprintf(this->path, "%s/init/data.xml", path); 176 174 177 175 this->doc = xmlReadFile(this->path, NULL, 0); 178 this->logger->print(this->logger, MSG_ERROR, 179 "InitData: Unable to open XML file at %s\n", this->path); 176 177 if (this->doc == NULL) 178 this->logger->print(this->logger, MSG_ERROR, 179 "InitData", "Unable to open init data file at '%s'\n", this->path); 180 else 181 this->logger->print(this->logger, MSG_INFO, 182 "InitData", "Using init data file at '%s'\n", this->path); 183 180 184 181 185 // method pointers -
trunk/ippToPsps/src/StackBatch.c
r31030 r31033 58 58 fitsIn->readColumnUsingName(fitsIn, TLONG, "FLAGS2", 1, 1, nDet, flags2); 59 59 60 printf("Looping through %ld psf detections\n", nDet); 60 this->base.logger->print(this->base.logger, MSG_INFO, "StackBatch", 61 "Looping through %ld psf detection rows from '%s'\n", nDet, extensionName); 61 62 float mag; 62 63 long unmatched = 0, totalDetections = 0, numOfDuplicates = 0, numInvalidFlux = 0, numDetectionsOut = 0; 63 64 64 this->base.logger->print(this->base.logger, MSG_INFO, 65 this->base.logger->print(this->base.logger, MSG_INFO, "StackBatch", 65 66 "+---------------+---------+----------+------------------+---------------+--------------+\n"); 66 this->base.logger->print(this->base.logger, MSG_INFO, 67 this->base.logger->print(this->base.logger, MSG_INFO, "StackBatch", 67 68 "| Extension | Rows in | Rows out | Missing from DVO | Duplicate IDs | Invalid Flux |\n"); 68 69 … … 108 109 } 109 110 110 this->base.logger->print(this->base.logger, MSG_INFO, 111 this->base.logger->print(this->base.logger, MSG_INFO, "StackBatch", 111 112 "| %12s | %5ld | %5ld | %5ld | %5ld | %5ld |\n", 112 113 extensionName, nDet, numDetectionsOut, unmatched, numOfDuplicates, numInvalidFlux); 113 this->base.logger->print(this->base.logger, MSG_INFO, 114 this->base.logger->print(this->base.logger, MSG_INFO, "StackBatch", 114 115 "+---------------+---------+----------+------------------+---------------+--------------+\n"); 115 116 … … 149 150 150 151 long nDet = 0; 151 if (!fitsIn->moveToBinaryTableAndCountRows(fitsIn, "SkyChip.xrad", &nDet)) return false; 152 char extensionName[15]; 153 sprintf(extensionName, "SkyChip.xrad"); 154 if (!fitsIn->moveToBinaryTableAndCountRows(fitsIn, extensionName, &nDet)) return false; 152 155 153 156 … … 172 175 } 173 176 174 printf("Looping through %ld extended source detections\n", nDet); 177 this->base.logger->print(this->base.logger, MSG_INFO, "StackBatch", 178 "Looping through %ld extended source detections from extension '%s'\n", nDet, extensionName); 175 179 for (long s=0; s<nDet; s++) { 176 180 … … 271 275 272 276 long nDet = 0; 273 if (!fitsIn->moveToBinaryTableAndCountRows(fitsIn, "SkyChip.xfit", &nDet)) return false; 277 char extensionName[40]; 278 sprintf(extensionName, "SkyChip.xfit"); 279 if (!fitsIn->moveToBinaryTableAndCountRows(fitsIn, extensionName, &nDet)) return false; 274 280 275 281 long* ippIdets = (long*)calloc(this->MAXDETECT, sizeof(long)); … … 281 287 fitsIn->readColumnUsingName(fitsIn, TSTRING, "MODEL_TYPE", 1, 1, nDet, modelTypes); 282 288 283 printf("Looping through %ld model fit rows\n", nDet); 289 this->base.logger->print(this->base.logger, MSG_INFO, "StackBatch", 290 "Looping through %ld model fit rows from '%s'\n", nDet, extensionName); 284 291 for (long i = 0; i<nDet; i++) { 285 292 … … 360 367 createStackDetectionTable(this, fitsIn, filterIDs, surveyIDs, skycellIDs, exposureTime); 361 368 createStackApFlxTable(this, fitsIn, filterIDs, surveyIDs); 362 printf("dsdsdddds\n\n");363 369 createStackModelFitTable(this, fitsIn, filterIDs, surveyIDs); 364 370 createStackToImageTable(this, fitsIn); … … 433 439 StackBatch* new_StackBatch(Logger* logger, int *argc, char **argv) { 434 440 435 logger->print(logger, MSG_DEBUG, "StackBatch :Constructor\n");441 logger->print(logger, MSG_DEBUG, "StackBatch", "Constructor\n"); 436 442 StackBatch *this = (StackBatch*)calloc(1, sizeof(StackBatch)); 437 443 … … 456 462 int main(int argc, char **argv) { 457 463 458 psTimerStart("stackbatch");459 460 464 // ippToPsps_VersionPrint(); 461 465 … … 463 467 464 468 Logger* logger = new_Logger(NULL); 469 logger->print(logger, MSG_INFO, "main", "Creating new stack batch\n"); 465 470 466 471 StackBatch* stackBatch = new_StackBatch(logger, &argc, argv); … … 470 475 stackBatch->destroy(stackBatch); 471 476 472 double secs = psTimerMark("stackbatch");473 474 logger->print(logger, MSG_INFO, "stackbatch completed %ssuccessfully, with exit code %d, in %.1f %s\n",475 (exitCode == PS_EXIT_SUCCESS) ? "" : "un",476 exitCode,477 (secs<60.0) ? secs : (secs/60.0),478 (secs<60.0) ? "sec(s)" : "min(s)");479 480 477 // tidy up 481 psTimerStop();478 logger->destroy(logger); 482 479 psLibFinalize(); 483 logger->destroy(logger);484 480 485 481 return exitCode;
Note:
See TracChangeset
for help on using the changeset viewer.
