Changeset 1804 for branches/newfiller/src
- Timestamp:
- 08/02/10 11:27:25 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/newfiller/src/Scantable.cpp
r1778 r1804 224 224 td.addColumn(ScalarColumnDesc<uInt>("FREQ_ID")); 225 225 td.addColumn(ScalarColumnDesc<uInt>("MOLECULE_ID")); 226 226 227 ScalarColumnDesc<Int> refbeamnoColumn("REFBEAMNO"); 227 228 refbeamnoColumn.setDefault(Int(-1)); 228 229 td.addColumn(refbeamnoColumn); 229 230 230 td.addColumn(ScalarColumnDesc<uInt>("FLAGROW")); 231 ScalarColumnDesc<uInt> flagrowColumn("FLAGROW"); 232 flagrowColumn.setDefault(uInt(0)); 233 td.addColumn(flagrowColumn); 231 234 232 235 td.addColumn(ScalarColumnDesc<Double>("TIME")); … … 363 366 for (int i = 0; i < size; ++i) 364 367 arr[i] = static_cast<T>(defValue[i]); 365 368 366 369 col.fillColumn(arr); 367 370 } else { … … 951 954 Vector<Double> vec(moleculeTable_.getRestFrequency(i)); 952 955 if (vec.nelements() > 0) { 953 if (firstline) { 956 if (firstline) { 954 957 oss << setprecision(10) << vec << " [Hz]" << endl; 955 958 firstline=False; 956 959 } 957 else{ 960 else{ 958 961 oss << setw(15)<<" " << setprecision(10) << vec << " [Hz]" << endl; 959 } 962 } 960 963 } else { 961 964 oss << "none" << endl; … … 1169 1172 //Quantum<Double> urf(rf, u); 1170 1173 Quantum<Vector<Double> >urf(rf, u); 1171 Vector<String> formattedname(0); 1174 Vector<String> formattedname(0); 1172 1175 //cerr<<"Scantable::setRestFrequnecies="<<urf<<endl; 1173 1176 1174 1177 //uInt id = moleculeTable_.addEntry(urf.getValue("Hz"), name, ""); 1175 1178 uInt id = moleculeTable_.addEntry(urf.getValue("Hz"), mathutil::toVectorString(name), formattedname); … … 1349 1352 Vector<Float> arr = specCol_( 0 ) ; 1350 1353 int nChan = arr.nelements() ; 1351 1354 1352 1355 // if nmin < 0 or nmax < 0, nothing to do 1353 1356 if ( nmin < 0 ) { … … 1357 1360 throw( casa::indexError<int>( nmax, "asap::Scantable::reshapeSpectrum: Invalid range. Negative index is specified." ) ) ; 1358 1361 } 1359 1362 1360 1363 // if nmin > nmax, exchange values 1361 1364 if ( nmin > nmax ) { … … 1364 1367 nmin = tmp ; 1365 1368 LogIO os( LogOrigin( "Scantable", "reshapeSpectrum()", WHERE ) ) ; 1366 os << "Swap values. Applied range is [" 1369 os << "Swap values. Applied range is [" 1367 1370 << nmin << ", " << nmax << "]" << LogIO::POST ; 1368 1371 } 1369 1372 1370 1373 // if nmin exceeds nChan, nothing to do 1371 1374 if ( nmin >= nChan ) { 1372 1375 throw( casa::indexError<int>( nmin, "asap::Scantable::reshapeSpectrum: Invalid range. Specified minimum exceeds nChan." ) ) ; 1373 1376 } 1374 1377 1375 1378 // if nmax exceeds nChan, reset nmax to nChan 1376 1379 if ( nmax >= nChan ) { … … 1388 1391 } 1389 1392 } 1390 1393 1391 1394 // reshape specCol_ and flagCol_ 1392 1395 for ( int irow = 0 ; irow < nrow() ; irow++ ) { … … 1408 1411 ***/ 1409 1412 refval = refval - ( refpix - nmin ) * increment ; 1410 refpix = 0 ; 1413 refpix = 0 ; 1411 1414 freqTable_.setEntry( refpix, refval, increment, irow ) ; 1412 1415 } 1413 1416 1414 1417 // update nchan 1415 1418 int newsize = nmax - nmin + 1 ; 1416 1419 table_.rwKeywordSet().define( "nChan", newsize ) ; 1417 1420 1418 1421 // update bandwidth 1419 1422 // assumed all spectra in the scantable have same bandwidth 1420 1423 table_.rwKeywordSet().define( "Bandwidth", increment * newsize ) ; 1421 1424 1422 1425 return ; 1423 1426 } 1424 1427 1425 void asap::Scantable::reshapeSpectrum( int nmin, int nmax, int irow ) 1428 void asap::Scantable::reshapeSpectrum( int nmin, int nmax, int irow ) 1426 1429 { 1427 1430 // reshape specCol_ and flagCol_ … … 1464 1467 for ( int irow = 0 ; irow < nrow() ; irow++ ) { 1465 1468 regridChannel( nChan, dnu, irow ) ; 1466 } 1469 } 1467 1470 coordinfo[0] = oldinfo ; 1468 1471 setCoordInfo( coordinfo ) ; 1469 1472 1470 1473 1471 // NOTE: this method does not update metadata such as 1474 // NOTE: this method does not update metadata such as 1472 1475 // FREQUENCIES subtable, nChan, Bandwidth, etc. 1473 1476 1474 return ; 1475 } 1476 1477 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 ) 1478 1481 { 1479 1482 // logging … … 1485 1488 Vector<Float> newspec( nChan, 0 ) ; 1486 1489 Vector<uChar> newflag( nChan, false ) ; 1487 1490 1488 1491 // regrid 1489 1492 vector<double> abcissa = getAbcissa( irow ) ; … … 1504 1507 zi[0] = z[0] - 0.5 * dnu ; 1505 1508 zi[1] = z[0] + 0.5 * dnu ; 1506 for ( int ii = 2 ; ii < nChan ; ii++ ) 1509 for ( int ii = 2 ; ii < nChan ; ii++ ) 1507 1510 zi[ii] = zi[ii-1] + dnu ; 1508 1511 zi[nChan] = z[nChan-1] + 0.5 * dnu ; … … 1511 1514 for ( int ii = 2 ; ii < oldsize ; ii++ ) 1512 1515 yi[ii] = abcissa[ii-1] + olddnu ; 1513 yi[oldsize] = abcissa[oldsize-1] + 0.5 * olddnu ; 1516 yi[oldsize] = abcissa[oldsize-1] + 0.5 * olddnu ; 1514 1517 if ( dnu > 0.0 ) { 1515 1518 for ( int ii = 0 ; ii < nChan ; ii++ ) { … … 1666 1669 // ***/ 1667 1670 // // NOTE: Assumed that all spectra have the same bandwidth 1668 // pile += dnu ; 1671 // pile += dnu ; 1669 1672 // newspec[nChan-1] += frac * olddnu * oldspec[refChan] ; 1670 1673 // newflag[nChan-1] = newflag[nChan-1] || oldflag[refChan] ; … … 1685 1688 // newspec[nChan-1] /= wsum ; 1686 1689 // //ofs << "newspec[" << nChan - 1 << "] = " << newspec[nChan-1] << endl ; 1687 1690 1688 1691 // specCol_.put( irow, newspec ) ; 1689 1692 // flagsCol_.put( irow, newflag ) ;
Note:
See TracChangeset
for help on using the changeset viewer.