Changeset 1616
- Timestamp:
- 08/07/09 15:49:27 (15 years ago)
- Location:
- branches/alma/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/alma/src/STFiller.cpp
r1603 r1616 35 35 #include <casa/System/ProgressMeter.h> 36 36 #include <atnf/PKSIO/NROReader.h> 37 #include <casa/Logging/LogIO.h> 37 38 38 39 #include <time.h> … … 470 471 time( &t0 ) ; 471 472 tm *ttm = localtime( &t0 ) ; 472 473 cout << "STFiller::openNRO() Start time = " << t0 474 << " (" 475 << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 476 << " " 477 << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 478 << ")" << endl ; 473 LogIO os( LogOrigin( "STFiller", "openNRO()", WHERE ) ) ; 474 // cout << "STFiller::openNRO() Start time = " << t0 475 // << " (" 476 // << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 477 // << " " 478 // << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 479 // << ")" << endl ; 480 os << "Start time = " << t0 481 << " (" 482 << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 483 << " " 484 << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 485 << ")" << LogIO::POST ; 479 486 480 487 // fill STHeader … … 498 505 header_->epoch, 499 506 header_->poltype ) ) { 500 cout << "STFiller::openNRO() Failed to get header information." << endl ; 501 return ; 507 // cout << "STFiller::openNRO() Failed to get header information." << endl ; 508 // return ; 509 throw( AipsError("Failed to get header information.") ) ; 502 510 } 503 511 … … 526 534 } 527 535 528 // DEBUG529 //cout << "STFiller::openNRO() nIF " << endl ;530 //531 532 536 beamOffset_ = 0; 533 537 vector<Bool> beams = nreader_->getBeams() ; … … 549 553 } 550 554 551 // DEBUG552 //cout << "STFiller::openNRO() nBeam " << endl ;553 //554 555 555 header_->nbeam = nBeam_ ; 556 556 header_->nif = nIF_ ; … … 558 558 // set header 559 559 table_->setHeader( *header_ ) ; 560 561 // DEBUG562 //cout << "STFiller::openNRO() Velocity Definition = " << nheader->getVDEF() << endl ;563 560 564 561 // DEBUG … … 566 563 time( &t1 ) ; 567 564 ttm = localtime( &t1 ) ; 568 cout << "STFiller::openNRO() End time = " << t1 569 << " (" 570 << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 571 << " " 572 << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 573 << ")" << endl ; 574 cout << "STFiller::openNRO() Elapsed time = " << t1 - t0 << " sec" << endl ; 565 // cout << "STFiller::openNRO() End time = " << t1 566 // << " (" 567 // << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 568 // << " " 569 // << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 570 // << ")" << endl ; 571 // cout << "STFiller::openNRO() Elapsed time = " << t1 - t0 << " sec" << endl ; 572 os << "End time = " << t1 573 << " (" 574 << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 575 << " " 576 << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 577 << ")" << endl ; 578 os << "Elapsed time = " << t1 - t0 << " sec" << endl ; 579 os.post() ; 575 580 // 576 581 … … 584 589 time( &t0 ) ; 585 590 tm *ttm = localtime( &t0 ) ; 586 cout << "STFiller::readNRO() Start time = " << t0 587 << " (" 588 << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 589 << " " 590 << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 591 << ")" << endl ; 591 LogIO os( LogOrigin( "STFiller", "readNRO()", WHERE ) ) ; 592 // cout << "STFiller::readNRO() Start time = " << t0 593 // << " (" 594 // << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 595 // << " " 596 // << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 597 // << ")" << endl ; 598 os << "Start time = " << t0 599 << " (" 600 << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 601 << " " 602 << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 603 << ")" << LogIO::POST ; 592 604 // 593 605 … … 630 642 Array<Double> scanrate ; 631 643 for ( i = 0 ; i < imax ; i++ ) { 632 // if( nreader_->getDataset()->getRecord( i ) == NULL ) {633 // cerr << "STFiller::readNRO() error while reading row " << i << endl ;634 // return -1 ;635 // }636 637 644 string scanType = nreader_->getScanType( i ) ; 638 645 Int srcType = -1 ; 639 646 if ( scanType.compare( 0, 2, "ON") == 0 ) { 640 // cout << "ON srcType: " << i << endl;647 // os << "ON srcType: " << i << LogIO::POST ; 641 648 srcType = 0 ; 642 649 } 643 650 else if ( scanType.compare( 0, 3, "OFF" ) == 0 ) { 644 // cout << "OFF srcType: " << i << endl;651 //os << "OFF srcType: " << i << LogIO::POST ; 645 652 srcType = 1 ; 646 653 } 647 654 else if ( scanType.compare( 0, 4, "ZERO" ) == 0 ) { 648 // cout << "ZERO srcType: " << i << endl;655 //os << "ZERO srcType: " << i << LogIO::POST ; 649 656 srcType = 2 ; 650 657 } 651 658 else { 652 // cout << "Undefined srcType: " << i << endl;659 //os << "Undefined srcType: " << i << LogIO::POST ; 653 660 srcType = 3 ; 654 661 } … … 691 698 srcdir, 692 699 scanrate ) ) { 693 cerr << "STFiller::readNRO() Failed to get scan information." << endl ; 694 return 1 ; 700 // cerr << "STFiller::readNRO() Failed to get scan information." << endl ; 701 // return 1 ; 702 throw( AipsError("Failed to get scan information.") ) ; 695 703 } 696 704 … … 716 724 int iadd = -1 ; 717 725 for ( uInt iif = 0 ; iif < freqs.size() ; iif++ ) { 718 // cout << "STFiller::readNRO() freqs[" << iif << "][1] = " << freqs[iif][1] << endl;726 //os << "freqs[" << iif << "][1] = " << freqs[iif][1] << LogIO::POST ; 719 727 double fdiff = abs( freqs[iif][1] - fqs[1] ) / freqs[iif][1] ; 720 // cout << "STFiller::readNRO() fdiff = " << fdiff << endl;728 //os << "fdiff = " << fdiff << LogIO::POST ; 721 729 if ( fdiff < 1.0e-8 ) { 722 730 iadd = iif ; … … 798 806 // DEBUG 799 807 //int rownum = nreader_->getRowNum() ; 800 // cout << "STFiller::readNRO() Finished row " << i << "/" << rownum << endl;808 //os << "Finished row " << i << "/" << rownum << LogIO::POST ; 801 809 // 802 810 } … … 806 814 time( &t1 ) ; 807 815 ttm = localtime( &t1 ) ; 808 cout << "STFiller::readNRO() Processed " << i << " rows" << endl ; 809 cout << "STFiller::readNRO() Added " << i - count << " rows (ignored " 810 << count << " \"ZERO\" scans)" << endl ; 811 cout << "STFiller::readNRO() End time = " << t1 812 << " (" 813 << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 814 << " " 815 << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 816 << ")" << endl ; 817 cout << "STFiller::readNRO() Elapsed time = " << t1 - t0 << " sec" << endl ; 816 // cout << "STFiller::readNRO() Processed " << i << " rows" << endl ; 817 // cout << "STFiller::readNRO() Added " << i - count << " rows (ignored " 818 // << count << " \"ZERO\" scans)" << endl ; 819 // cout << "STFiller::readNRO() End time = " << t1 820 // << " (" 821 // << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 822 // << " " 823 // << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 824 // << ")" << endl ; 825 // cout << "STFiller::readNRO() Elapsed time = " << t1 - t0 << " sec" << endl ; 826 os << "Processed " << i << " rows" << endl ; 827 os << "Added " << i - count << " rows (ignored " 828 << count << " \"ZERO\" scans)" << endl ; 829 os.post() ; 830 os << "End time = " << t1 831 << " (" 832 << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday 833 << " " 834 << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec 835 << ")" << endl ; 836 os << "Elapsed time = " << t1 - t0 << " sec" << endl ; 837 os.post() ; 818 838 // 819 839 -
branches/alma/src/STFitter.cpp
r1387 r1616 32 32 #include <casa/Arrays/ArrayMath.h> 33 33 #include <casa/Arrays/ArrayLogical.h> 34 #include <casa/Logging/LogIO.h> 34 35 #include <scimath/Fitting.h> 35 36 #include <scimath/Fitting/LinearFit.h> … … 147 148 funcs_[0] = new Polynomial<Float>(ncomp); 148 149 } else { 149 cerr << " compiled functions not yet implemented" << endl; 150 //cerr << " compiled functions not yet implemented" << endl; 151 LogIO os( LogOrigin( "Fitter", "setExpression()", WHERE ) ) ; 152 os << LogIO::WARN << " compiled functions not yet implemented" << LogIO::POST; 150 153 //funcs_.resize(1); 151 154 //funcs_[0] = new CompiledFunction<Float>(); -
branches/alma/src/STHeader.cpp
r1603 r1616 37 37 #include <casa/Arrays/IPosition.h> 38 38 #include <casa/Quanta/MVTime.h> 39 #include <casa/Logging/LogIO.h> 39 40 40 41 #include <sstream> 41 42 42 43 #include "STDefs.h" … … 79 80 MVTime mvt(this->utc); 80 81 mvt.setFormat(MVTime::YMD); 81 cout << "Observer: " << this->observer << endl 82 << "Project: " << this->project << endl 83 << "Obstype: " << this->obstype << endl 84 << "Antenna: " << this->antennaname << endl 85 << "Ant. Position: " << this->antennaposition << endl 86 << "Equinox: " << this->equinox << endl 87 << "Freq. ref.: " << this->freqref << endl 88 << "Ref. frequency: " << this->reffreq << endl 89 << "Bandwidth: " << this->bandwidth << endl 90 << "Time (utc): " 91 << mvt 92 << endl; 82 // cout << "Observer: " << this->observer << endl 83 // << "Project: " << this->project << endl 84 // << "Obstype: " << this->obstype << endl 85 // << "Antenna: " << this->antennaname << endl 86 // << "Ant. Position: " << this->antennaposition << endl 87 // << "Equinox: " << this->equinox << endl 88 // << "Freq. ref.: " << this->freqref << endl 89 // << "Ref. frequency: " << this->reffreq << endl 90 // << "Bandwidth: " << this->bandwidth << endl 91 // << "Time (utc): " 92 // << mvt 93 // << endl; 94 LogIO os( LogOrigin( "STHeader", "print()", WHERE ) ) ; 95 os << "Observer: " << this->observer << endl 96 << "Project: " << this->project << endl 97 << "Obstype: " << this->obstype << endl 98 << "Antenna: " << this->antennaname << endl 99 << "Ant. Position: " << this->antennaposition << endl 100 << "Equinox: " << this->equinox << endl 101 << "Freq. ref.: " << this->freqref << endl 102 << "Ref. frequency: " << this->reffreq << endl 103 << "Bandwidth: " << this->bandwidth << endl 104 << "Time (utc): " 105 << mvt 106 << LogIO::POST ; 93 107 //setprecision(10) << this->utc << endl; 94 108 } … … 129 143 { 130 144 if (n_>0) { 131 cerr << "Source ID" << endl; 132 for (uInt i=0; i<n_; i++) { 133 cout << setw(11) << source_(i) << ID_(i) << endl; 134 } 145 // cerr << "Source ID" << endl; 146 // for (uInt i=0; i<n_; i++) { 147 // cout << setw(11) << source_(i) << ID_(i) << endl; 148 LogIO os( LogOrigin( "SDDataDesc", "summary()", WHERE ) ) ; 149 ostringstream oss ; 150 oss << "Source ID" << endl; 151 for (uInt i=0; i<n_; i++) { 152 oss << setw(11) << source_(i) << ID_(i) << endl; 153 } 154 os << oss.str() << LogIO::POST ; 135 155 } 136 156 } -
branches/alma/src/STMath.cpp
r1611 r1616 44 44 #include <scimath/Functionals/Polynomial.h> 45 45 46 #include <casa/Logging/LogIO.h> 47 #include <sstream> 48 46 49 #include "MathUtils.h" 47 50 #include "RowAccumulator.h" … … 74 77 const std::string& avmode) 75 78 { 79 LogIO os( LogOrigin( "STMath", "average()", WHERE ) ) ; 76 80 if ( avmode == "SCAN" && in.size() != 1 ) 77 81 throw(AipsError("Can't perform 'SCAN' averaging on multiple tables.\n" … … 81 85 // check if OTF observation 82 86 String obstype = in[0]->getHeader().obstype ; 83 //bool otfscan = false ;84 87 Double tol = 0.0 ; 85 88 if ( obstype.find( "OTF" ) != String::npos ) { 86 //cout << "OTF scan" << endl ;87 //otfscan = true ;88 89 tol = TOL_OTF ; 89 90 } … … 156 157 for ( Int i = 0 ; i < length ; i++ ) { 157 158 Vector<Double> t = dircol(i).getAngle(Unit(String("rad"))).getValue() ; 158 // cout << setw( 3 )<< count++ << ": " ;159 // cout << "[" << t[0] << "," << t[1] << "]" << endl;159 //os << << count++ << ": " ; 160 //os << "[" << t[0] << "," << t[1] << "]" << LogIO::POST ; 160 161 bool adddir = true ; 161 162 for ( uInt j = 0 ; j < dirs.size() ; j++ ) { … … 176 177 } 177 178 uInt rowNum = dirs.size() ; 178 //cout << "dirs.size()=" << dirs.size() << endl ;179 179 tout.addRow( rowNum ) ; 180 180 for ( uInt i = 0 ; i < rowNum ; i++ ) { … … 233 233 } 234 234 } 235 //cout << "removeRows.size()=" << removeRows.size() << endl ;236 235 if ( removeRows.size() != 0 ) { 237 //cout << "[" ;238 //for ( uInt irow=0 ; irow<removeRows.size()-1 ; irow++ )239 //cout << removeRows[irow] << "," ;240 //cout << removeRows[removeRows.size()-1] << "]" << endl ;241 236 subt.removeRow( removeRows ) ; 242 237 } … … 298 293 } 299 294 if (rowstodelete.nelements() > 0) { 300 cout << rowstodelete << endl; 295 //cout << rowstodelete << endl; 296 os << rowstodelete << LogIO::POST ; 301 297 tout.removeRow(rowstodelete); 302 298 if (tout.nrow() == 0) { … … 314 310 // check if OTF observation 315 311 String obstype = in->getHeader().obstype ; 316 //bool otfscan = false ;317 312 Double tol = 0.0 ; 318 313 if ( obstype.find( "OTF" ) != String::npos ) { 319 //cout << "OTF scan" << endl ;320 //otfscan = true ;321 314 tol = TOL_OTF ; 322 315 } … … 428 421 Vector<uChar> flags = flagCol.getColumn(Slicer(Slice(0))); 429 422 // mask spectra for different DIRECTION 430 //cout << "irow=" << outrowCount+irow << ": flagged [" ;431 423 for ( uInt jrow = 0 ; jrow < subt.nrow() ; jrow++ ) { 432 424 Vector<Double> direction = dircol(jrow).getAngle(Unit(String("rad"))).getValue() ; … … 437 429 //if ( !allNearAbs( t, direction, tol ) ) { 438 430 if ( dd > tol ) { 439 //cout << jrow << " " ;440 431 flags[jrow] = userflag ; 441 432 } 442 433 } 443 //cout << "]" << endl ;444 //cout << "flags=" << flags << endl ;445 434 Vector<Float> outspec(nchan); 446 435 Vector<uChar> outflag(nchan,0); … … 835 824 //Debug 836 825 //if(noff!=ndiff) cerr<<"noff and ndiff is not equal"<<endl; 826 //LogIO os( LogOrigin( "STMath", "dototalpower()", WHERE ) ) ; 827 //if(noff!=ndiff) os<<"noff and ndiff is not equal"<<LogIO::POST; 837 828 meanoff = sum(spoff)/noff; 838 829 meandiff = sum(spdiff)/ndiff; … … 954 945 //Debug 955 946 //cerr<<"Tsys used="<<tsysrefscalar<<endl; 947 //LogIO os( LogOrigin( "STMath", "dosigref", WHERE ) ) ; 948 //os<<"Tsys used="<<tsysrefscalar<<LogIO::POST; 956 949 // fill the result, replay signal tsys by reference tsys 957 950 outintCol.put(i, resint); … … 1120 1113 //Array<Float> avtsys = Float(0.5) * (tsys1 + tsys2); 1121 1114 // cerr<< "Tsys1="<<tsys1<<" Tsys2="<<tsys2<<endl; 1115 // LogIO os( LogOrigin( "STMath", "donod", WHERE ) ) ; 1116 // os<< "Tsys1="<<tsys1<<" Tsys2="<<tsys2<<LogIO::POST; 1122 1117 tsys1[0] = sqrt(tsyssq1 + tsyssq2); 1123 1118 Array<Float> avtsys = tsys1; … … 1185 1180 out2->frequencies().getEntry(rp2, rv2, inc2, freqid2); 1186 1181 //cerr << out1->frequencies().table().nrow() << " " << out2->frequencies().table().nrow() << endl ; 1182 //LogIO os( LogOrigin( "STMath", "dofs()", WHERE ) ) ; 1183 //os << out1->frequencies().table().nrow() << " " << out2->frequencies().table().nrow() << LogIO::POST ; 1187 1184 if (rp1==rp2) { 1188 1185 Double foffset = rv1 - rv2; 1189 1186 uInt choffset = static_cast<uInt>(foffset/abs(inc2)); 1190 1187 if (choffset >= nchan) { 1191 cerr<<"out-band frequency switching, no folding"<<endl; 1188 //cerr<<"out-band frequency switching, no folding"<<endl; 1189 LogIO os( LogOrigin( "STMath", "dofs()", WHERE ) ) ; 1190 os<<"out-band frequency switching, no folding"<<LogIO::POST; 1192 1191 nofold = True; 1193 1192 } … … 1230 1229 // check 1231 1230 if ( choffset == 0 ) { 1232 cerr << "channel offset is zero, no folding" << endl ; 1231 LogIO os( LogOrigin( "STMath", "dofold()", WHERE ) ) ; 1232 os << "channel offset is zero, no folding" << LogIO::POST ; 1233 1233 return out ; 1234 1234 } 1235 1235 int nchan = ref->nchan() ; 1236 1236 if ( abs(choffset) >= nchan ) { 1237 cerr << "out-band frequency switching, no folding" << endl ; 1237 LogIO os( LogOrigin( "STMath", "dofold()", WHERE ) ) ; 1238 os << "out-band frequency switching, no folding" << LogIO::POST ; 1238 1239 return out ; 1239 1240 } … … 2384 2385 throw ( casa::AipsError ) 2385 2386 { 2387 LogIO os( LogOrigin( "STMath", "new_average()", WHERE ) ) ; 2386 2388 if ( avmode == "SCAN" && in.size() != 1 ) 2387 2389 throw(AipsError("Can't perform 'SCAN' averaging on multiple tables.\n" … … 2390 2392 // check if OTF observation 2391 2393 String obstype = in[0]->getHeader().obstype ; 2392 //bool otfscan = false ;2393 2394 Double tol = 0.0 ; 2394 2395 if ( obstype.find( "OTF" ) != String::npos ) { 2395 //cout << "OTF scan" << endl ;2396 //otfscan = true ;2397 2396 tol = TOL_OTF ; 2398 2397 } … … 2407 2406 2408 2407 // TEST: do normal average in each table before IF grouping 2409 cout << "Do preliminary averaging" << endl;2408 os << "Do preliminary averaging" << LogIO::POST ; 2410 2409 vector< CountedPtr<Scantable> > tmpin( insize ) ; 2411 2410 for ( uInt itable = 0 ; itable < insize ; itable++ ) { … … 2415 2414 2416 2415 // warning 2417 cout << "Average spectra with different spectral resolution" << endl ; 2418 cout << endl ; 2416 os << "Average spectra with different spectral resolution" << LogIO::POST ; 2419 2417 2420 2418 // temporarily set coordinfo … … 2447 2445 // ... 2448 2446 // [min_idn0, max_idn0, min_idn1, max_idn1, ...]] 2449 // cout << "Check IF settings in each table" << endl;2447 //os << "Check IF settings in each table" << LogIO::POST ; 2450 2448 vector< vector<uInt> > freqid( insize ); 2451 2449 vector< vector<double> > iffreq( insize ) ; … … 2462 2460 uInt id = freqIDCol( irow ) ; 2463 2461 if ( freqid[itable].size() == 0 || count( freqid[itable].begin(), freqid[itable].end(), id ) == 0 ) { 2464 // cout << "itable = " << itable << ": IF " << id << " is included in the list" << endl;2462 //os << "itable = " << itable << ": IF " << id << " is included in the list" << LogIO::POST ; 2465 2463 vector<double> abcissa = tmpin[itable]->getAbcissa( irow ) ; 2466 2464 freqid[itable].push_back( id ) ; … … 2473 2471 2474 2472 // debug 2475 // cout<< "IF settings summary:" << endl ;2473 //os << "IF settings summary:" << endl ; 2476 2474 //for ( uInt i = 0 ; i < freqid.size() ; i++ ) { 2477 // cout<< " Table" << i << endl ;2475 //os << " Table" << i << endl ; 2478 2476 //for ( uInt j = 0 ; j < freqid[i].size() ; j++ ) { 2479 // cout<< " id = " << freqid[i][j] << " (min,max) = (" << iffreq[i][2*j] << "," << iffreq[i][2*j+1] << ")" << endl ;2477 //os << " id = " << freqid[i][j] << " (min,max) = (" << iffreq[i][2*j] << "," << iffreq[i][2*j+1] << ")" << endl ; 2480 2478 //} 2481 2479 //} 2482 //cout << endl ; 2480 //os << endl ; 2481 //os.post() ; 2483 2482 2484 2483 // IF grouping based on their frequency coverage … … 2492 2491 // ifgfreq[numgrp*2] 2493 2492 // ifgfreq: [min0_grp0, max0_grp0, min1_grp1, max1_grp1, ...] 2494 // cout << "IF grouping based on their frequency coverage" << endl;2493 //os << "IF grouping based on their frequency coverage" << LogIO::POST ; 2495 2494 vector< vector<uInt> > ifgrp ; 2496 2495 vector<double> ifgfreq ; … … 2576 2575 2577 2576 // print IF groups 2578 cout << "IF Group summary: " << endl ; 2579 cout << " GROUP_ID [FREQ_MIN, FREQ_MAX]: (TABLE_ID, FREQ_ID)" << endl ; 2577 ostringstream oss ; 2578 oss << "IF Group summary: " << endl ; 2579 oss << " GROUP_ID [FREQ_MIN, FREQ_MAX]: (TABLE_ID, FREQ_ID)" << endl ; 2580 2580 for ( uInt i = 0 ; i < ifgrp.size() ; i++ ) { 2581 cout<< " GROUP " << setw( 2 ) << i << " [" << ifgfreq[2*i] << "," << ifgfreq[2*i+1] << "]: " ;2581 oss << " GROUP " << setw( 2 ) << i << " [" << ifgfreq[2*i] << "," << ifgfreq[2*i+1] << "]: " ; 2582 2582 for ( uInt j = 0 ; j < ifgrp[i].size()/2 ; j++ ) { 2583 cout << "(" << ifgrp[i][2*j] << "," << ifgrp[i][2*j+1] << ") " ; 2584 } 2585 cout << endl ; 2586 } 2587 cout << endl ; 2583 oss << "(" << ifgrp[i][2*j] << "," << ifgrp[i][2*j+1] << ") " ; 2584 } 2585 oss << endl ; 2586 } 2587 oss << endl ; 2588 os << oss.str() << LogIO::POST ; 2588 2589 2589 2590 // print frequency group 2590 cout << "Frequency Group summary: " << endl ; 2591 cout << " GROUP_ID [FREQ_MIN, FREQ_MAX]: IF_GROUP_ID" << endl ; 2591 oss.str("") ; 2592 oss << "Frequency Group summary: " << endl ; 2593 oss << " GROUP_ID [FREQ_MIN, FREQ_MAX]: IF_GROUP_ID" << endl ; 2592 2594 for ( uInt i = 0 ; i < freqgrp.size() ; i++ ) { 2593 cout<< " GROUP " << setw( 2 ) << i << " [" << ifgfreq[2*freqgrp[i][0]] << "," << ifgfreq[2*freqgrp[i][freqgrp[i].size()-1]+1] << "]: " ;2595 oss << " GROUP " << setw( 2 ) << i << " [" << ifgfreq[2*freqgrp[i][0]] << "," << ifgfreq[2*freqgrp[i][freqgrp[i].size()-1]+1] << "]: " ; 2594 2596 for ( uInt j = 0 ; j < freqgrp[i].size() ; j++ ) { 2595 cout << freqgrp[i][j] << " " ; 2596 } 2597 cout << endl ; 2598 } 2599 cout << endl ; 2597 oss << freqgrp[i][j] << " " ; 2598 } 2599 oss << endl ; 2600 } 2601 oss << endl ; 2602 os << oss.str() << LogIO::POST ; 2600 2603 2601 2604 // membership check … … 2623 2626 2624 2627 // print membership 2628 //oss.str("") ; 2625 2629 //for ( uInt i = 0 ; i < insize ; i++ ) { 2626 // cout<< "Table " << i << endl ;2630 //oss << "Table " << i << endl ; 2627 2631 //for ( uInt j = 0 ; j < groups[i].size() ; j++ ) { 2628 // cout<< " FREQ_ID " << setw( 2 ) << freqid[i][j] << ": " ;2632 //oss << " FREQ_ID " << setw( 2 ) << freqid[i][j] << ": " ; 2629 2633 //for ( uInt k = 0 ; k < groups[i][j].size() ; k++ ) { 2630 // cout<< setw( 2 ) << groups[i][j][k] << " " ;2634 //oss << setw( 2 ) << groups[i][j][k] << " " ; 2631 2635 //} 2632 // cout<< endl ;2636 //oss << endl ; 2633 2637 //} 2634 2638 //} 2639 //os << oss.str() << LogIO::POST ; 2635 2640 2636 2641 // set back coordinfo … … 2649 2654 vector<uInt> newifids( insize, 0 ) ; 2650 2655 for ( uInt itable = 0 ; itable < insize ; itable++ ) { 2651 // cout << "Table " << setw(2)<< itable << ": " ;2656 //os << "Table " << itable << ": " ; 2652 2657 for ( uInt ifrow = 0 ; ifrow < groups[itable].size() ; ifrow++ ) { 2653 2658 addrow[itable].push_back( groups[itable][ifrow].size()-1 ) ; 2654 // cout<< addrow[itable][ifrow] << " " ;2659 //os << addrow[itable][ifrow] << " " ; 2655 2660 } 2656 2661 addtable[itable] = *max_element( addrow[itable].begin(), addrow[itable].end() ) ; 2657 // cout << "(" << addtable[itable] << ")" << endl;2662 //os << "(" << addtable[itable] << ")" << LogIO::POST ; 2658 2663 } 2659 2664 newin.resize( insize ) ; … … 2681 2686 } 2682 2687 string taql = taqlstream.str() ; 2683 // cout << "taql = " << taql << endl;2688 //os << "taql = " << taql << LogIO::POST ; 2684 2689 STSelector selector = STSelector() ; 2685 2690 selector.setTaQL( taql ) ; … … 2708 2713 2709 2714 // print IF groups again for debug 2710 //cout << "IF Group summary: " << endl ; 2711 //cout << " GROUP_ID [FREQ_MIN, FREQ_MAX]: (TABLE_ID, FREQ_ID)" << endl ; 2715 //oss.str( "" ) ; 2716 //oss << "IF Group summary: " << endl ; 2717 //oss << " GROUP_ID [FREQ_MIN, FREQ_MAX]: (TABLE_ID, FREQ_ID)" << endl ; 2712 2718 //for ( uInt i = 0 ; i < ifgrp.size() ; i++ ) { 2713 // cout<< " GROUP " << setw( 2 ) << i << " [" << ifgfreq[2*i] << "," << ifgfreq[2*i+1] << "]: " ;2719 //oss << " GROUP " << setw( 2 ) << i << " [" << ifgfreq[2*i] << "," << ifgfreq[2*i+1] << "]: " ; 2714 2720 //for ( uInt j = 0 ; j < ifgrp[i].size()/2 ; j++ ) { 2715 // cout<< "(" << ifgrp[i][2*j] << "," << ifgrp[i][2*j+1] << ") " ;2721 //oss << "(" << ifgrp[i][2*j] << "," << ifgrp[i][2*j+1] << ") " ; 2716 2722 //} 2717 // cout<< endl ;2723 //oss << endl ; 2718 2724 //} 2719 //cout << endl ; 2725 //oss << endl ; 2726 //os << oss.str() << LogIO::POST ; 2720 2727 2721 2728 // reset SCANNO and IFNO/FREQ_ID: IF is reset by the result of sortation 2722 cout << "All scan number is set to 0" << endl ; 2723 //cout << "All IF number is set to IF group index" << endl ; 2724 cout << endl ; 2729 os << "All scan number is set to 0" << LogIO::POST ; 2730 //os << "All IF number is set to IF group index" << LogIO::POST ; 2725 2731 insize = newin.size() ; 2726 2732 for ( uInt itable = 0 ; itable < insize ; itable++ ) { … … 2773 2779 2774 2780 // reset spectra and flagtra: pick up common part of frequency coverage 2775 // cout << "Pick common frequency range and align resolution" << endl;2781 //os << "Pick common frequency range and align resolution" << LogIO::POST ; 2776 2782 for ( uInt itable = 0 ; itable < insize ; itable++ ) { 2777 2783 uInt rows = newin[itable]->nrow() ; … … 2783 2789 double minfreq = ifgfreq[2*ifno] ; 2784 2790 double maxfreq = ifgfreq[2*ifno+1] ; 2785 // cout << "frequency range: [" << minfreq << "," << maxfreq << "]" << endl;2791 //os << "frequency range: [" << minfreq << "," << maxfreq << "]" << LogIO::POST ; 2786 2792 vector<double> abcissa = newin[itable]->getAbcissa( irow ) ; 2787 2793 int nchan = abcissa.size() ; 2788 2794 double resol = abcissa[1] - abcissa[0] ; 2789 // cout << "abcissa range : [" << abcissa[0] << "," << abcissa[nchan-1] << "]" << endl;2795 //os << "abcissa range : [" << abcissa[0] << "," << abcissa[nchan-1] << "]" << LogIO::POST ; 2790 2796 if ( minfreq <= abcissa[0] ) 2791 2797 nminchan = 0 ; … … 2802 2808 nmaxchan = abcissa.size() - 1 - int(cfreq) - ( ( cfreq - int(cfreq) >= 0.5 ) ? 1 : 0 ) ; 2803 2809 } 2804 // cout << "channel range (" << irow << "): [" << nminchan << "," << nmaxchan << "]" << endl;2810 //os << "channel range (" << irow << "): [" << nminchan << "," << nmaxchan << "]" << LogIO::POST ; 2805 2811 if ( nmaxchan > nminchan ) { 2806 2812 newin[itable]->reshapeSpectrum( nminchan, nmaxchan, irow ) ; … … 2829 2835 2830 2836 // reset spectra and flagtra: align spectral resolution 2831 // cout << "Align spectral resolution" << endl;2837 //os << "Align spectral resolution" << LogIO::POST ; 2832 2838 // gmaxdnu: the coarsest frequency resolution in the frequency group 2833 2839 // gmemid: member index that have a resolution equal to gmaxdnu … … 2858 2864 int nchan = abcissa.size() ; 2859 2865 double dnu = abcissa[1] - abcissa[0] ; 2860 // cout << "GROUP " << igrp << " (" << tableid << "," << rowid << "): nchan = " << nchan << " (minchan = " << minchan << ")" << endl;2866 //os << "GROUP " << igrp << " (" << tableid << "," << rowid << "): nchan = " << nchan << " (minchan = " << minchan << ")" << LogIO::POST ; 2861 2867 if ( nchan < minchan ) { 2862 2868 minchan = nchan ; … … 2869 2875 } 2870 2876 // regrid spectra in each group 2871 cout<< "GROUP " << igrp << endl ;2872 cout<< " Channel number is adjusted to " << minchan << endl ;2873 cout << " Corresponding frequency resolution is " << maxdnu << "Hz" << endl;2877 os << "GROUP " << igrp << endl ; 2878 os << " Channel number is adjusted to " << minchan << endl ; 2879 os << " Corresponding frequency resolution is " << maxdnu << "Hz" << LogIO::POST ; 2874 2880 for ( uInt imem = 0 ; imem < ifgrp[igrp].size()/2 ; imem++ ) { 2875 2881 uInt tableid = ifgrp[igrp][2*imem] ; 2876 2882 uInt rowid = ifgrp[igrp][2*imem+1] ; 2877 2883 freqIDCol.attach( newin[tableid]->table(), "FREQ_ID" ) ; 2878 // cout << "tableid = " << tableid << " rowid = " << rowid << ": " << endl;2879 // cout<< " regridChannel applied to " ;2884 //os << "tableid = " << tableid << " rowid = " << rowid << ": " << LogIO::POST ; 2885 //os << " regridChannel applied to " ; 2880 2886 if ( tableid != reftable ) 2881 2887 refreqid = newin[tableid]->frequencies().addEntry( refpixref, refvalref, refinc ) ; … … 2883 2889 uInt tfreqid = freqIdVec[tableid][irow] ; 2884 2890 if ( tfreqid == rowid ) { 2885 // cout<< irow << " " ;2891 //os << irow << " " ; 2886 2892 newin[tableid]->regridChannel( minchan, maxdnu, irow ) ; 2887 2893 freqIDCol.put( irow, refreqid ) ; … … 2889 2895 } 2890 2896 } 2891 // cout << endl;2897 //os << LogIO::POST ; 2892 2898 } 2893 2899 } … … 2913 2919 } 2914 2920 } 2915 cout << endl ;2916 2921 2917 2922 // set back coordinfo … … 2938 2943 2939 2944 // combine frequency group 2940 cout << "Combine spectra based on frequency grouping" << endl;2941 cout << "IFNO is renumbered as frequency group ID (see above)" << endl;2945 os << "Combine spectra based on frequency grouping" << LogIO::POST ; 2946 os << "IFNO is renumbered as frequency group ID (see above)" << LogIO::POST ; 2942 2947 vector<string> coordinfo = tmpout->getCoordInfo() ; 2943 2948 oldinfo[0] = coordinfo[0] ; … … 2955 2960 } 2956 2961 string taql = taqlstream.str() ; 2957 // cout << "taql = " << taql << endl;2962 //os << "taql = " << taql << LogIO::POST ; 2958 2963 STSelector selector = STSelector() ; 2959 2964 selector.setTaQL( taql ) ; … … 3009 3014 dircol.attach( iter.table(), "DIRECTION" ) ; 3010 3015 uInt polno = polnos( 0 ) ; 3011 // cout << "POLNO iteration: " << polno << endl;3016 //os << "POLNO iteration: " << polno << LogIO::POST ; 3012 3017 // for ( uInt igrp = 0 ; igrp < freqgrp.size() ; igrp++ ) { 3013 3018 // sizes[igrp].resize( freqgrp[igrp].size() ) ; … … 3022 3027 // vector<uChar> fvec ; 3023 3028 // flag.tovector( fvec ) ; 3024 // // cout << "spec.size() = " << svec.size() << " fvec.size() = " << fvec.size() << endl;3029 // //os << "spec.size() = " << svec.size() << " fvec.size() = " << fvec.size() << LogIO::POST ; 3025 3030 // specout[igrp].insert( specout[igrp].end(), svec.begin(), svec.end() ) ; 3026 3031 // flagout[igrp].insert( flagout[igrp].end(), fvec.begin(), fvec.end() ) ; 3027 // // cout << "specout[" << igrp << "].size() = " << specout[igrp].size() << endl;3032 // //os << "specout[" << igrp << "].size() = " << specout[igrp].size() << LogIO::POST ; 3028 3033 // sizes[igrp][imem] = spec.nelements() ; 3029 3034 // } … … 3090 3095 vector<uChar> fvec ; 3091 3096 flag.tovector( fvec ) ; 3092 // cout << "spec.size() = " << svec.size() << " fvec.size() = " << fvec.size() << endl;3097 //os << "spec.size() = " << svec.size() << " fvec.size() = " << fvec.size() << LogIO::POST ; 3093 3098 specout[igrp].insert( specout[igrp].end(), svec.begin(), svec.end() ) ; 3094 3099 flagout[igrp].insert( flagout[igrp].end(), fvec.begin(), fvec.end() ) ; 3095 // cout << "specout[" << igrp << "].size() = " << specout[igrp].size() << endl;3100 //os << "specout[" << igrp << "].size() = " << specout[igrp].size() << LogIO::POST ; 3096 3101 } 3097 3102 } … … 3119 3124 if ( ifnoColOut( irow ) == gmemid[igrp] && !updated[igrp] ) { 3120 3125 uInt freqidOut = freqidColOut( irow ) ; 3121 // cout << "freqgrp " << igrp << " freqidOut = " << freqidOut << endl;3126 //os << "freqgrp " << igrp << " freqidOut = " << freqidOut << LogIO::POST ; 3122 3127 double refpix ; 3123 3128 double refval ; -
branches/alma/src/Scantable.cpp
r1610 r1616 31 31 #include <casa/Containers/RecordField.h> 32 32 #include <casa/Utilities/GenSort.h> 33 #include <casa/Logging/LogIO.h> 33 34 34 35 #include <tables/Tables/TableParse.h> … … 1067 1068 void Scantable::addFit( const STFitEntry& fit, int row ) 1068 1069 { 1069 cout << mfitidCol_(uInt(row)) << endl; 1070 //cout << mfitidCol_(uInt(row)) << endl; 1071 LogIO os( LogOrigin( "Scantable", "addFit()", WHERE ) ) ; 1072 os << mfitidCol_(uInt(row)) << LogIO::POST ; 1070 1073 uInt id = fitTable_.addEntry(fit, mfitidCol_(uInt(row))); 1071 1074 mfitidCol_.put(uInt(row), id); … … 1101 1104 Table subt = t( t.col("SCAN") == scanlist[i]+1 ); 1102 1105 if (subt.nrow()==0) { 1103 cerr <<"Scan "<<scanlist[i]<<" cannot be found in the scantable."<<endl; 1106 //cerr <<"Scan "<<scanlist[i]<<" cannot be found in the scantable."<<endl; 1107 LogIO os( LogOrigin( "Scantable", "checkScanInfo()", WHERE ) ) ; 1108 os <<LogIO::WARN<<"Scan "<<scanlist[i]<<" cannot be found in the scantable."<<LogIO::POST; 1104 1109 ret = 1; 1105 1110 break; … … 1113 1118 Table subt2 = t( t.col("SCAN") == scanlist[i+1]+1 ); 1114 1119 if ( subt2.nrow() == 0) { 1115 cerr<<"Scan "<<scanlist[i+1]<<" cannot be found in the scantable."<<endl; 1120 LogIO os( LogOrigin( "Scantable", "checkScanInfo()", WHERE ) ) ; 1121 1122 //cerr<<"Scan "<<scanlist[i+1]<<" cannot be found in the scantable."<<endl; 1123 os<<LogIO::WARN<<"Scan "<<scanlist[i+1]<<" cannot be found in the scantable."<<LogIO::POST; 1116 1124 ret = 1; 1117 1125 break; … … 1123 1131 if (scan1seqn == 1 && scan2seqn == 2) { 1124 1132 if (laston1 == laston2) { 1125 cerr<<"A valid scan pair ["<<scanlist[i]<<","<<scanlist[i+1]<<"]"<<endl; 1133 LogIO os( LogOrigin( "Scantable", "checkScanInfo()", WHERE ) ) ; 1134 //cerr<<"A valid scan pair ["<<scanlist[i]<<","<<scanlist[i+1]<<"]"<<endl; 1135 os<<"A valid scan pair ["<<scanlist[i]<<","<<scanlist[i+1]<<"]"<<LogIO::POST; 1126 1136 i +=1; 1127 1137 } 1128 1138 else { 1129 cerr<<"Incorrect scan pair ["<<scanlist[i]<<","<<scanlist[i+1]<<"]"<<endl; 1139 LogIO os( LogOrigin( "Scantable", "checkScanInfo()", WHERE ) ) ; 1140 //cerr<<"Incorrect scan pair ["<<scanlist[i]<<","<<scanlist[i+1]<<"]"<<endl; 1141 os<<LogIO::WARN<<"Incorrect scan pair ["<<scanlist[i]<<","<<scanlist[i+1]<<"]"<<LogIO::POST; 1130 1142 } 1131 1143 } 1132 1144 else if (scan1seqn==2 && scan2seqn == 1) { 1133 1145 if (laston1 == laston2) { 1134 cerr<<"["<<scanlist[i]<<","<<scanlist[i+1]<<"] is a valid scan pair but in incorrect order."<<endl; 1146 LogIO os( LogOrigin( "Scantable", "checkScanInfo()", WHERE ) ) ; 1147 //cerr<<"["<<scanlist[i]<<","<<scanlist[i+1]<<"] is a valid scan pair but in incorrect order."<<endl; 1148 os<<LogIO::WARN<<"["<<scanlist[i]<<","<<scanlist[i+1]<<"] is a valid scan pair but in incorrect order."<<LogIO::POST; 1135 1149 ret = 1; 1136 1150 break; … … 1138 1152 } 1139 1153 else { 1140 cerr<<"The other scan for "<<scanlist[i]<<" appears to be missing. Check the input scan numbers."<<endl; 1154 LogIO os( LogOrigin( "Scantable", "checkScanInfo()", WHERE ) ) ; 1155 //cerr<<"The other scan for "<<scanlist[i]<<" appears to be missing. Check the input scan numbers."<<endl; 1156 os<<LogIO::WARN<<"The other scan for "<<scanlist[i]<<" appears to be missing. Check the input scan numbers."<<LogIO::POST; 1141 1157 ret = 1; 1142 1158 break; … … 1145 1161 } 1146 1162 else { 1147 cerr<<"The scan does not appear to be standard obsevation."<<endl; 1163 LogIO os( LogOrigin( "Scantable", "checkScanInfo()", WHERE ) ) ; 1164 //cerr<<"The scan does not appear to be standard obsevation."<<endl; 1165 os<<LogIO::WARN<<"The scan does not appear to be standard obsevation."<<LogIO::POST; 1148 1166 } 1149 1167 //if ( i >= nscan ) break; … … 1151 1169 } 1152 1170 else { 1153 cerr<<"No reference to GBT_GO table."<<endl; 1171 LogIO os( LogOrigin( "Scantable", "checkScanInfo()", WHERE ) ) ; 1172 //cerr<<"No reference to GBT_GO table."<<endl; 1173 os<<LogIO::WARN<<"No reference to GBT_GO table."<<LogIO::POST; 1154 1174 ret = 1; 1155 1175 } … … 1185 1205 nmax = nmin ; 1186 1206 nmin = tmp ; 1187 cout << "Swap values. Applied range is [" 1188 << nmin << ", " << nmax << "]" << endl ; 1207 LogIO os( LogOrigin( "Scantable", "reshapeSpectrum()", WHERE ) ) ; 1208 os << "Swap values. Applied range is [" 1209 << nmin << ", " << nmax << "]" << LogIO::POST ; 1189 1210 } 1190 1211 … … 1198 1219 if ( nmin == 0 ) { 1199 1220 // nothing to do 1200 cout << "Whole range is selected. Nothing to do." << endl ; 1221 LogIO os( LogOrigin( "Scantable", "reshapeSpectrum()", WHERE ) ) ; 1222 os << "Whole range is selected. Nothing to do." << LogIO::POST ; 1201 1223 return ; 1202 1224 } 1203 1225 else { 1204 cout << "Specified maximum exceeds nChan. Applied range is [" 1205 << nmin << ", " << nChan-1 << "]." << endl ; 1226 LogIO os( LogOrigin( "Scantable", "reshapeSpectrum()", WHERE ) ) ; 1227 os << "Specified maximum exceeds nChan. Applied range is [" 1228 << nmin << ", " << nChan-1 << "]." << LogIO::POST ; 1206 1229 nmax = nChan - 1 ; 1207 1230 } … … 1256 1279 void asap::Scantable::regridChannel( int nChan, double dnu ) 1257 1280 { 1258 cout << "Regrid abcissa with channel number " << nChan << " and spectral resoultion " << dnu << "Hz." << endl ; 1281 LogIO os( LogOrigin( "Scantable", "regridChannel()", WHERE ) ) ; 1282 os << "Regrid abcissa with channel number " << nChan << " and spectral resoultion " << dnu << "Hz." << LogIO::POST ; 1259 1283 // assumed that all rows have same nChan 1260 1284 Vector<Float> arr = specCol_( 0 ) ; … … 1263 1287 // if oldsize == nChan, nothing to do 1264 1288 if ( oldsize == nChan ) { 1265 cout << "Specified channel number is same as current one. Nothing to do." << endl;1289 os << "Specified channel number is same as current one. Nothing to do." << LogIO::POST ; 1266 1290 return ; 1267 1291 } … … 1269 1293 // if oldChan < nChan, unphysical operation 1270 1294 if ( oldsize < nChan ) { 1271 cout << "Unphysical operation. Nothing to do." << endl;1295 os << "Unphysical operation. Nothing to do." << LogIO::POST ; 1272 1296 return ; 1273 1297 }
Note:
See TracChangeset
for help on using the changeset viewer.