Changeset 1818 for branches/alma/src/Scantable.cpp
- Timestamp:
- 08/02/10 16:10:43 (14 years ago)
- Location:
- branches/alma
- Files:
-
- 2 edited
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/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 ) ;
Note: See TracChangeset
for help on using the changeset viewer.