Ignore:
Timestamp:
08/02/10 16:10:43 (14 years ago)
Author:
Kana Sugimoto
Message:

New Development: Yes

JIRA Issue: No (merge)

Ready for Test: Yes

Interface Changes: No

Description:

Merged changes -r1774:1817 in newfiller branch to alma branch


Location:
branches/alma
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/alma

  • branches/alma/src/Scantable.cpp

    r1757 r1818  
    224224  td.addColumn(ScalarColumnDesc<uInt>("FREQ_ID"));
    225225  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);
    229234
    230235  td.addColumn(ScalarColumnDesc<Double>("TIME"));
     
    361366      for (int i = 0; i < size; ++i)
    362367        arr[i] = static_cast<T>(defValue[i]);
    363      
     368
    364369      col.fillColumn(arr);
    365370    } else {
     
    949954          Vector<Double> vec(moleculeTable_.getRestFrequency(i));
    950955          if (vec.nelements() > 0) {
    951                if (firstline) { 
     956               if (firstline) {
    952957                   oss << setprecision(10) << vec << " [Hz]" << endl;
    953958                   firstline=False;
    954959               }
    955                else{ 
     960               else{
    956961                   oss << setw(15)<<" " << setprecision(10) << vec << " [Hz]" << endl;
    957                } 
     962               }
    958963          } else {
    959964              oss << "none" << endl;
     
    11671172  //Quantum<Double> urf(rf, u);
    11681173  Quantum<Vector<Double> >urf(rf, u);
    1169   Vector<String> formattedname(0); 
     1174  Vector<String> formattedname(0);
    11701175  //cerr<<"Scantable::setRestFrequnecies="<<urf<<endl;
    1171  
     1176
    11721177  //uInt id = moleculeTable_.addEntry(urf.getValue("Hz"), name, "");
    11731178  uInt id = moleculeTable_.addEntry(urf.getValue("Hz"), mathutil::toVectorString(name), formattedname);
     
    12411246}
    12421247
    1243 std::string Scantable::getAntennaName() const
     1248String Scantable::getAntennaName() const
    12441249{
    12451250  String out;
     
    13471352  Vector<Float> arr = specCol_( 0 ) ;
    13481353  int nChan = arr.nelements() ;
    1349  
     1354
    13501355  // if nmin < 0 or nmax < 0, nothing to do
    13511356  if (  nmin < 0 ) {
     
    13551360    throw( casa::indexError<int>( nmax, "asap::Scantable::reshapeSpectrum: Invalid range. Negative index is specified." ) ) ;
    13561361  }
    1357  
     1362
    13581363  // if nmin > nmax, exchange values
    13591364  if ( nmin > nmax ) {
     
    13621367    nmin = tmp ;
    13631368    LogIO os( LogOrigin( "Scantable", "reshapeSpectrum()", WHERE ) ) ;
    1364     os << "Swap values. Applied range is [" 
     1369    os << "Swap values. Applied range is ["
    13651370       << nmin << ", " << nmax << "]" << LogIO::POST ;
    13661371  }
    1367  
     1372
    13681373  // if nmin exceeds nChan, nothing to do
    13691374  if ( nmin >= nChan ) {
    13701375    throw( casa::indexError<int>( nmin, "asap::Scantable::reshapeSpectrum: Invalid range. Specified minimum exceeds nChan." ) ) ;
    13711376  }
    1372  
     1377
    13731378  // if nmax exceeds nChan, reset nmax to nChan
    13741379  if ( nmax >= nChan ) {
     
    13861391    }
    13871392  }
    1388  
     1393
    13891394  // reshape specCol_ and flagCol_
    13901395  for ( int irow = 0 ; irow < nrow() ; irow++ ) {
     
    14061411     ***/
    14071412    refval = refval - ( refpix - nmin ) * increment ;
    1408     refpix = 0 ; 
     1413    refpix = 0 ;
    14091414    freqTable_.setEntry( refpix, refval, increment, irow ) ;
    14101415  }
    1411  
     1416
    14121417  // update nchan
    14131418  int newsize = nmax - nmin + 1 ;
    14141419  table_.rwKeywordSet().define( "nChan", newsize ) ;
    1415  
     1420
    14161421  // update bandwidth
    14171422  // assumed all spectra in the scantable have same bandwidth
    14181423  table_.rwKeywordSet().define( "Bandwidth", increment * newsize ) ;
    1419  
     1424
    14201425  return ;
    14211426}
    14221427
    1423 void asap::Scantable::reshapeSpectrum( int nmin, int nmax, int irow ) 
     1428void asap::Scantable::reshapeSpectrum( int nmin, int nmax, int irow )
    14241429{
    14251430  // reshape specCol_ and flagCol_
     
    14621467  for ( int irow = 0 ; irow < nrow() ; irow++ ) {
    14631468    regridChannel( nChan, dnu, irow ) ;
    1464   } 
     1469  }
    14651470  coordinfo[0] = oldinfo ;
    14661471  setCoordInfo( coordinfo ) ;
    14671472
    14681473
    1469   // NOTE: this method does not update metadata such as 
     1474  // NOTE: this method does not update metadata such as
    14701475  //       FREQUENCIES subtable, nChan, Bandwidth, etc.
    14711476
    1472   return ; 
    1473 }
    1474 
    1475 void asap::Scantable::regridChannel( int nChan, double dnu, int irow ) 
     1477  return ;
     1478}
     1479
     1480void asap::Scantable::regridChannel( int nChan, double dnu, int irow )
    14761481{
    14771482  // logging
     
    14831488  Vector<Float> newspec( nChan, 0 ) ;
    14841489  Vector<uChar> newflag( nChan, false ) ;
    1485  
     1490
    14861491  // regrid
    14871492  vector<double> abcissa = getAbcissa( irow ) ;
     
    15021507  zi[0] = z[0] - 0.5 * dnu ;
    15031508  zi[1] = z[0] + 0.5 * dnu ;
    1504   for ( int ii = 2 ; ii < nChan ; ii++ ) 
     1509  for ( int ii = 2 ; ii < nChan ; ii++ )
    15051510    zi[ii] = zi[ii-1] + dnu ;
    15061511  zi[nChan] = z[nChan-1] + 0.5 * dnu ;
     
    15091514  for ( int ii = 2 ; ii < oldsize ; ii++ )
    15101515    yi[ii] = abcissa[ii-1] + olddnu ;
    1511   yi[oldsize] = abcissa[oldsize-1] + 0.5 * olddnu ; 
     1516  yi[oldsize] = abcissa[oldsize-1] + 0.5 * olddnu ;
    15121517  if ( dnu > 0.0 ) {
    15131518    for ( int ii = 0 ; ii < nChan ; ii++ ) {
     
    16641669//    ***/
    16651670//   // NOTE: Assumed that all spectra have the same bandwidth
    1666 //   pile += dnu ; 
     1671//   pile += dnu ;
    16671672//   newspec[nChan-1] += frac * olddnu * oldspec[refChan] ;
    16681673//   newflag[nChan-1] = newflag[nChan-1] || oldflag[refChan] ;
     
    16831688//   newspec[nChan-1] /= wsum ;
    16841689//   //ofs << "newspec[" << nChan - 1 << "] = " << newspec[nChan-1] << endl ;
    1685  
     1690
    16861691//   specCol_.put( irow, newspec ) ;
    16871692//   flagsCol_.put( irow, newflag ) ;
Note: See TracChangeset for help on using the changeset viewer.