Changeset 1810 for branches/newfiller
- Timestamp:
- 08/02/10 11:49:42 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/newfiller/src/STFiller.cpp
r1757 r1810 82 82 close(); 83 83 } 84 84 85 85 void STFiller::open( const std::string& filename, const std::string& antenna, int whichIF, int whichBeam, casa::Bool getPt ) 86 86 { … … 230 230 //For MS, add the location of POINTING of the input MS so one get 231 231 //pointing data from there, if necessary. 232 //Also find nrow in MS 232 //Also find nrow in MS 233 233 nInDataRow = 0; 234 234 if (format == "MS2") { 235 Path datapath(inName); 235 Path datapath(inName); 236 236 String ptTabPath = datapath.absoluteName(); 237 237 Table inMS(ptTabPath); … … 246 246 } 247 247 String freqFrame = header_->freqref; 248 //translate frequency reference frame back to 249 //MS style (as PKSMS2reader converts the original frame 248 //translate frequency reference frame back to 249 //MS style (as PKSMS2reader converts the original frame 250 250 //in FITS standard style) 251 251 if (freqFrame == "TOPOCENT") { … … 282 282 int status = 0; 283 283 284 // 284 // 285 285 // for NRO data 286 286 // … … 326 326 } 327 327 fclose( fp ) ; 328 } 328 } 329 329 while ( status == 0 ) { 330 330 status = reader_->read(pksrec); … … 389 389 RecordFieldPtr<uInt> ifCol(rec, "IFNO"); 390 390 *ifCol = pksrec.IFno-ifOffset_- 1; 391 uInt id; 392 /// @todo this has to change when nchan isn't global anymore 393 //id = table_->frequencies().addEntry(Double(header_->nchan/2), 394 // pksrec.refFreq, pksrec.freqInc); 395 if ( pksrec.nchan == 1 ) { 396 id = table_->frequencies().addEntry(Double(0), 397 pksrec.refFreq, pksrec.freqInc); 398 } 399 else { 400 id = table_->frequencies().addEntry(Double(pksrec.nchan/2), 401 pksrec.refFreq, pksrec.freqInc); 402 } 391 uInt id = table_->frequencies().addEntry(Double(pksrec.spectra.nrow()/2), 392 pksrec.refFreq, pksrec.freqInc); 403 393 RecordFieldPtr<uInt> mfreqidCol(rec, "FREQ_ID"); 404 394 *mfreqidCol = id; … … 419 409 420 410 RecordFieldPtr<uInt> mfocusidCol(rec, "FOCUS_ID"); 421 id = table_->focus().addEntry(pksrec.parAngle, pksrec.focusAxi, 411 id = table_->focus().addEntry(pksrec.parAngle, pksrec.focusAxi, 422 412 pksrec.focusTan, pksrec.focusRot); 423 413 *mfocusidCol = id; … … 503 493 tm *ttm = localtime( &t0 ) ; 504 494 LogIO os( LogOrigin( "STFiller", "openNRO()", WHERE ) ) ; 505 // cout << "STFiller::openNRO() Start time = " << t0 506 // << " (" 507 // << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 508 // << " " 509 // << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 495 // cout << "STFiller::openNRO() Start time = " << t0 496 // << " (" 497 // << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 498 // << " " 499 // << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 510 500 // << ")" << endl ; 511 os << "Start time = " << t0 512 << " (" 513 << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 514 << " " 515 << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 501 os << "Start time = " << t0 502 << " (" 503 << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 504 << " " 505 << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 516 506 << ")" << LogIO::POST ; 517 507 … … 551 541 if ( whichIF >= 0 ) { 552 542 if ( whichIF >= 0 && whichIF < nIF_ ) { 553 for ( int i = 0 ; i < nIF_ ; i++ ) 543 for ( int i = 0 ; i < nIF_ ; i++ ) 554 544 ifs[i] = False ; 555 545 ifs[whichIF] = True ; … … 570 560 if (whichBeam>=0) { 571 561 if (whichBeam>=0 && whichBeam<nBeam_) { 572 for ( int i = 0 ; i < nBeam_ ; i++ ) 562 for ( int i = 0 ; i < nBeam_ ; i++ ) 573 563 beams[i] = False ; 574 564 beams[whichBeam] = True; … … 595 585 time( &t1 ) ; 596 586 ttm = localtime( &t1 ) ; 597 // cout << "STFiller::openNRO() End time = " << t1 598 // << " (" 599 // << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 600 // << " " 601 // << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 587 // cout << "STFiller::openNRO() End time = " << t1 588 // << " (" 589 // << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 590 // << " " 591 // << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 602 592 // << ")" << endl ; 603 593 // cout << "STFiller::openNRO() Elapsed time = " << t1 - t0 << " sec" << endl ; 604 os << "End time = " << t1 605 << " (" 606 << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 607 << " " 608 << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 594 os << "End time = " << t1 595 << " (" 596 << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 597 << " " 598 << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 609 599 << ")" << endl ; 610 600 os << "Elapsed time = " << t1 - t0 << " sec" << endl ; … … 622 612 tm *ttm = localtime( &t0 ) ; 623 613 LogIO os( LogOrigin( "STFiller", "readNRO()", WHERE ) ) ; 624 // cout << "STFiller::readNRO() Start time = " << t0 625 // << " (" 626 // << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 627 // << " " 628 // << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 614 // cout << "STFiller::readNRO() Start time = " << t0 615 // << " (" 616 // << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 617 // << " " 618 // << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 629 619 // << ")" << endl ; 630 os << "Start time = " << t0 631 << " (" 632 << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 633 << " " 634 << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 620 os << "Start time = " << t0 621 << " (" 622 << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 623 << " " 624 << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 635 625 << ")" << LogIO::POST ; 636 626 // … … 692 682 srcType = 3 ; 693 683 } 694 684 695 685 // if srcType is 2 (ZERO scan), ignore scan 696 if ( srcType != 2 && srcType != -1 && srcType != 3 ) { 686 if ( srcType != 2 && srcType != -1 && srcType != 3 ) { 697 687 TableRow row( table_->table() ) ; 698 688 TableRecord& rec = row.record(); … … 789 779 *srcnCol = srcname ; 790 780 RecordFieldPtr<Int> srctCol(rec, "SRCTYPE") ; 791 *srctCol = srcType ; 792 RecordFieldPtr<String> fieldnCol(rec, "FIELDNAME"); 781 *srctCol = srcType ; 782 RecordFieldPtr<String> fieldnCol(rec, "FIELDNAME"); 793 783 *fieldnCol = fieldname ; 794 784 RecordFieldPtr< Array<Float> > specCol(rec, "SPECTRA") ; … … 820 810 windvel, 821 811 winddir ) ; 822 *mweatheridCol = id ; 812 *mweatheridCol = id ; 823 813 RecordFieldPtr<Double> svelCol(rec, "SRCVELOCITY") ; 824 814 *svelCol = srcvel ; … … 847 837 ttm = localtime( &t1 ) ; 848 838 // cout << "STFiller::readNRO() Processed " << i << " rows" << endl ; 849 // cout << "STFiller::readNRO() Added " << i - count << " rows (ignored " 839 // cout << "STFiller::readNRO() Added " << i - count << " rows (ignored " 850 840 // << count << " \"ZERO\" scans)" << endl ; 851 // cout << "STFiller::readNRO() End time = " << t1 852 // << " (" 853 // << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 854 // << " " 855 // << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 841 // cout << "STFiller::readNRO() End time = " << t1 842 // << " (" 843 // << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 844 // << " " 845 // << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 856 846 // << ")" << endl ; 857 847 // cout << "STFiller::readNRO() Elapsed time = " << t1 - t0 << " sec" << endl ; 858 848 os << "Processed " << i << " rows" << endl ; 859 os << "Added " << i - count << " rows (ignored " 849 os << "Added " << i - count << " rows (ignored " 860 850 << count << " \"ZERO\" scans)" << endl ; 861 851 os.post() ; 862 os << "End time = " << t1 863 << " (" 864 << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 865 << " " 866 << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 852 os << "End time = " << t1 853 << " (" 854 << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 855 << " " 856 << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 867 857 << ")" << endl ; 868 858 os << "Elapsed time = " << t1 - t0 << " sec" << endl ; … … 871 861 872 862 return 0 ; 873 } 863 } 874 864 875 865 Bool STFiller::fileCheck() … … 881 871 if ( inFile.isDirectory() ) 882 872 return bval ; 883 873 884 874 // if beginning of header data is "RW", return true 885 // otherwise, return false ; 875 // otherwise, return false ; 886 876 FILE *fp = fopen( filename_.c_str(), "r" ) ; 887 877 char buf[9] ;
Note:
See TracChangeset
for help on using the changeset viewer.