Changeset 1818 for branches/alma/src
- Timestamp:
- 08/02/10 16:10:43 (14 years ago)
- Location:
- branches/alma
- Files:
-
- 8 edited
- 11 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/alma
- Property svn:mergeinfo changed
/branches/newfiller (added) merged: 1774,1778,1780,1786-1788,1791-1817
- Property svn:mergeinfo changed
-
branches/alma/src/Makefile
r1762 r1818 130 130 STAtmosphere.o \ 131 131 Scantable.o \ 132 FillerBase.o \ 133 NROFiller.o \ 134 PKSFiller.o \ 135 AsapLogSink.o \ 132 136 Templates.o 137 133 138 PYOBJECTS := python_Scantable.o \ 134 139 python_STFiller.o \ … … 144 149 python_STAtmosphere.o \ 145 150 python_STCoordinate.o \ 151 python_Filler.o \ 152 python_LogSink.o \ 146 153 python_asap.o 147 154 … … 149 156 150 157 HEADERS := MathUtils.h \ 158 LineCatalog.h \ 151 159 Lorentzian1D.h \ 152 160 Lorentzian1DParam.h \ … … 183 191 IndexedCompare.h \ 184 192 STAtmosphere.h \ 185 STCoordinate.h 193 STCoordinate.h \ 194 FillerBase.h \ 195 NROFiller.h \ 196 PKSFiller.h \ 197 AsapLogSink.h 186 198 187 199 STATICCCLIB := libasap.a -
branches/alma/src/SConscript
- Property svn:mergeinfo changed
/branches/newfiller/src/SConscript (added) merged: 1798
- Property svn:mergeinfo changed
-
branches/alma/src/STFiller.cpp
r1757 r1818 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] ; -
branches/alma/src/Scantable.cpp
r1757 r1818 224 224 td.addColumn(ScalarColumnDesc<uInt>("FREQ_ID")); 225 225 td.addColumn(ScalarColumnDesc<uInt>("MOLECULE_ID")); 226 td.addColumn(ScalarColumnDesc<Int>("REFBEAMNO")); 227 228 td.addColumn(ScalarColumnDesc<uInt>("FLAGROW")); 226 227 ScalarColumnDesc<Int> refbeamnoColumn("REFBEAMNO"); 228 refbeamnoColumn.setDefault(Int(-1)); 229 td.addColumn(refbeamnoColumn); 230 231 ScalarColumnDesc<uInt> flagrowColumn("FLAGROW"); 232 flagrowColumn.setDefault(uInt(0)); 233 td.addColumn(flagrowColumn); 229 234 230 235 td.addColumn(ScalarColumnDesc<Double>("TIME")); … … 361 366 for (int i = 0; i < size; ++i) 362 367 arr[i] = static_cast<T>(defValue[i]); 363 368 364 369 col.fillColumn(arr); 365 370 } else { … … 949 954 Vector<Double> vec(moleculeTable_.getRestFrequency(i)); 950 955 if (vec.nelements() > 0) { 951 if (firstline) { 956 if (firstline) { 952 957 oss << setprecision(10) << vec << " [Hz]" << endl; 953 958 firstline=False; 954 959 } 955 else{ 960 else{ 956 961 oss << setw(15)<<" " << setprecision(10) << vec << " [Hz]" << endl; 957 } 962 } 958 963 } else { 959 964 oss << "none" << endl; … … 1167 1172 //Quantum<Double> urf(rf, u); 1168 1173 Quantum<Vector<Double> >urf(rf, u); 1169 Vector<String> formattedname(0); 1174 Vector<String> formattedname(0); 1170 1175 //cerr<<"Scantable::setRestFrequnecies="<<urf<<endl; 1171 1176 1172 1177 //uInt id = moleculeTable_.addEntry(urf.getValue("Hz"), name, ""); 1173 1178 uInt id = moleculeTable_.addEntry(urf.getValue("Hz"), mathutil::toVectorString(name), formattedname); … … 1241 1246 } 1242 1247 1243 std::string Scantable::getAntennaName() const1248 String Scantable::getAntennaName() const 1244 1249 { 1245 1250 String out; … … 1347 1352 Vector<Float> arr = specCol_( 0 ) ; 1348 1353 int nChan = arr.nelements() ; 1349 1354 1350 1355 // if nmin < 0 or nmax < 0, nothing to do 1351 1356 if ( nmin < 0 ) { … … 1355 1360 throw( casa::indexError<int>( nmax, "asap::Scantable::reshapeSpectrum: Invalid range. Negative index is specified." ) ) ; 1356 1361 } 1357 1362 1358 1363 // if nmin > nmax, exchange values 1359 1364 if ( nmin > nmax ) { … … 1362 1367 nmin = tmp ; 1363 1368 LogIO os( LogOrigin( "Scantable", "reshapeSpectrum()", WHERE ) ) ; 1364 os << "Swap values. Applied range is [" 1369 os << "Swap values. Applied range is [" 1365 1370 << nmin << ", " << nmax << "]" << LogIO::POST ; 1366 1371 } 1367 1372 1368 1373 // if nmin exceeds nChan, nothing to do 1369 1374 if ( nmin >= nChan ) { 1370 1375 throw( casa::indexError<int>( nmin, "asap::Scantable::reshapeSpectrum: Invalid range. Specified minimum exceeds nChan." ) ) ; 1371 1376 } 1372 1377 1373 1378 // if nmax exceeds nChan, reset nmax to nChan 1374 1379 if ( nmax >= nChan ) { … … 1386 1391 } 1387 1392 } 1388 1393 1389 1394 // reshape specCol_ and flagCol_ 1390 1395 for ( int irow = 0 ; irow < nrow() ; irow++ ) { … … 1406 1411 ***/ 1407 1412 refval = refval - ( refpix - nmin ) * increment ; 1408 refpix = 0 ; 1413 refpix = 0 ; 1409 1414 freqTable_.setEntry( refpix, refval, increment, irow ) ; 1410 1415 } 1411 1416 1412 1417 // update nchan 1413 1418 int newsize = nmax - nmin + 1 ; 1414 1419 table_.rwKeywordSet().define( "nChan", newsize ) ; 1415 1420 1416 1421 // update bandwidth 1417 1422 // assumed all spectra in the scantable have same bandwidth 1418 1423 table_.rwKeywordSet().define( "Bandwidth", increment * newsize ) ; 1419 1424 1420 1425 return ; 1421 1426 } 1422 1427 1423 void asap::Scantable::reshapeSpectrum( int nmin, int nmax, int irow ) 1428 void asap::Scantable::reshapeSpectrum( int nmin, int nmax, int irow ) 1424 1429 { 1425 1430 // reshape specCol_ and flagCol_ … … 1462 1467 for ( int irow = 0 ; irow < nrow() ; irow++ ) { 1463 1468 regridChannel( nChan, dnu, irow ) ; 1464 } 1469 } 1465 1470 coordinfo[0] = oldinfo ; 1466 1471 setCoordInfo( coordinfo ) ; 1467 1472 1468 1473 1469 // NOTE: this method does not update metadata such as 1474 // NOTE: this method does not update metadata such as 1470 1475 // FREQUENCIES subtable, nChan, Bandwidth, etc. 1471 1476 1472 return ; 1473 } 1474 1475 void asap::Scantable::regridChannel( int nChan, double dnu, int irow ) 1477 return ; 1478 } 1479 1480 void asap::Scantable::regridChannel( int nChan, double dnu, int irow ) 1476 1481 { 1477 1482 // logging … … 1483 1488 Vector<Float> newspec( nChan, 0 ) ; 1484 1489 Vector<uChar> newflag( nChan, false ) ; 1485 1490 1486 1491 // regrid 1487 1492 vector<double> abcissa = getAbcissa( irow ) ; … … 1502 1507 zi[0] = z[0] - 0.5 * dnu ; 1503 1508 zi[1] = z[0] + 0.5 * dnu ; 1504 for ( int ii = 2 ; ii < nChan ; ii++ ) 1509 for ( int ii = 2 ; ii < nChan ; ii++ ) 1505 1510 zi[ii] = zi[ii-1] + dnu ; 1506 1511 zi[nChan] = z[nChan-1] + 0.5 * dnu ; … … 1509 1514 for ( int ii = 2 ; ii < oldsize ; ii++ ) 1510 1515 yi[ii] = abcissa[ii-1] + olddnu ; 1511 yi[oldsize] = abcissa[oldsize-1] + 0.5 * olddnu ; 1516 yi[oldsize] = abcissa[oldsize-1] + 0.5 * olddnu ; 1512 1517 if ( dnu > 0.0 ) { 1513 1518 for ( int ii = 0 ; ii < nChan ; ii++ ) { … … 1664 1669 // ***/ 1665 1670 // // NOTE: Assumed that all spectra have the same bandwidth 1666 // pile += dnu ; 1671 // pile += dnu ; 1667 1672 // newspec[nChan-1] += frac * olddnu * oldspec[refChan] ; 1668 1673 // newflag[nChan-1] = newflag[nChan-1] || oldflag[refChan] ; … … 1683 1688 // newspec[nChan-1] /= wsum ; 1684 1689 // //ofs << "newspec[" << nChan - 1 << "] = " << newspec[nChan-1] << endl ; 1685 1690 1686 1691 // specCol_.put( irow, newspec ) ; 1687 1692 // flagsCol_.put( irow, newflag ) ; -
branches/alma/src/Scantable.h
r1757 r1818 237 237 238 238 /** 239 * Get flagRow info at the specified row. If true, the whole data 239 * Get flagRow info at the specified row. If true, the whole data 240 240 * at the row should be flagged. 241 241 */ … … 250 250 251 251 /** 252 * Return a list of booleans with the size of nchan for a specified row, to get info 252 * Return a list of booleans with the size of nchan for a specified row, to get info 253 253 * about which channel is clipped. 254 254 */ 255 255 std::vector<bool> getClipMask(int whichrow, const casa::Float uthres, const casa::Float dthres, bool clipoutside, bool unflag); 256 void srchChannelsToClip(casa::uInt whichrow, const casa::Float uthres, const casa::Float dthres, bool clipoutside, bool unflag, 256 void srchChannelsToClip(casa::uInt whichrow, const casa::Float uthres, const casa::Float dthres, bool clipoutside, bool unflag, 257 257 casa::Vector<casa::uChar> flgs); 258 258 … … 441 441 * @return antenna name string 442 442 */ 443 std::string getAntennaName() const;443 casa::String getAntennaName() const; 444 444 445 445 /** … … 470 470 * @param[in] nmin, nmax minimum and maximum channel 471 471 * @param[in] irow row number 472 * 473 * 30/07/2008 Takeshi Nakazato 472 * 473 * 30/07/2008 Takeshi Nakazato 474 474 **/ 475 475 void reshapeSpectrum( int nmin, int nmax ) throw( casa::AipsError ); … … 486 486 void regridChannel( int nchan, double dnu, int irow ) ; 487 487 488 488 489 489 private: 490 490 … … 583 583 584 584 /** 585 * Add an auxiliary column to the main table and attach it to a 585 * Add an auxiliary column to the main table and attach it to a 586 586 * cached column. Use for adding new columns that the original asap2 587 * tables do not have. 587 * tables do not have. 588 588 * @param[in] col reference to the cached column to be attached 589 589 * @param[in] colName column name in asap table -
branches/alma/src/python_asap.cpp
r1757 r1818 67 67 asap::python::python_Scantable(); 68 68 asap::python::python_STFiller(); 69 asap::python::python_Filler(); 69 70 asap::python::python_STSelector(); 70 71 asap::python::python_STMath(); … … 75 76 asap::python::python_LineCatalog(); 76 77 asap::python::python_Logger(); 78 asap::python::python_LogSink(); 77 79 asap::python::python_STCoordinate(); 78 80 asap::python::python_STAtmosphere(); -
branches/alma/src/python_asap.h
r1757 r1818 39 39 void python_Scantable(); 40 40 void python_STFiller(); 41 void python_Filler(); 41 42 void python_STSelector(); 42 43 void python_STMath(); … … 47 48 void python_LineCatalog(); 48 49 void python_Logger(); 50 void python_LogSink(); 49 51 void python_STCoordinate(); 50 52 void python_STAtmosphere();
Note:
See TracChangeset
for help on using the changeset viewer.