Changeset 1804


Ignore:
Timestamp:
08/02/10 11:27:25 (14 years ago)
Author:
Malte Marquarding
Message:

set FLAGROW column default value to 0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/newfiller/src/Scantable.cpp

    r1778 r1804  
    224224  td.addColumn(ScalarColumnDesc<uInt>("FREQ_ID"));
    225225  td.addColumn(ScalarColumnDesc<uInt>("MOLECULE_ID"));
     226
    226227  ScalarColumnDesc<Int> refbeamnoColumn("REFBEAMNO");
    227228  refbeamnoColumn.setDefault(Int(-1));
    228229  td.addColumn(refbeamnoColumn);
    229230
    230   td.addColumn(ScalarColumnDesc<uInt>("FLAGROW"));
     231  ScalarColumnDesc<uInt> flagrowColumn("FLAGROW");
     232  flagrowColumn.setDefault(uInt(0));
     233  td.addColumn(flagrowColumn);
    231234
    232235  td.addColumn(ScalarColumnDesc<Double>("TIME"));
     
    363366      for (int i = 0; i < size; ++i)
    364367        arr[i] = static_cast<T>(defValue[i]);
    365      
     368
    366369      col.fillColumn(arr);
    367370    } else {
     
    951954          Vector<Double> vec(moleculeTable_.getRestFrequency(i));
    952955          if (vec.nelements() > 0) {
    953                if (firstline) { 
     956               if (firstline) {
    954957                   oss << setprecision(10) << vec << " [Hz]" << endl;
    955958                   firstline=False;
    956959               }
    957                else{ 
     960               else{
    958961                   oss << setw(15)<<" " << setprecision(10) << vec << " [Hz]" << endl;
    959                } 
     962               }
    960963          } else {
    961964              oss << "none" << endl;
     
    11691172  //Quantum<Double> urf(rf, u);
    11701173  Quantum<Vector<Double> >urf(rf, u);
    1171   Vector<String> formattedname(0); 
     1174  Vector<String> formattedname(0);
    11721175  //cerr<<"Scantable::setRestFrequnecies="<<urf<<endl;
    1173  
     1176
    11741177  //uInt id = moleculeTable_.addEntry(urf.getValue("Hz"), name, "");
    11751178  uInt id = moleculeTable_.addEntry(urf.getValue("Hz"), mathutil::toVectorString(name), formattedname);
     
    13491352  Vector<Float> arr = specCol_( 0 ) ;
    13501353  int nChan = arr.nelements() ;
    1351  
     1354
    13521355  // if nmin < 0 or nmax < 0, nothing to do
    13531356  if (  nmin < 0 ) {
     
    13571360    throw( casa::indexError<int>( nmax, "asap::Scantable::reshapeSpectrum: Invalid range. Negative index is specified." ) ) ;
    13581361  }
    1359  
     1362
    13601363  // if nmin > nmax, exchange values
    13611364  if ( nmin > nmax ) {
     
    13641367    nmin = tmp ;
    13651368    LogIO os( LogOrigin( "Scantable", "reshapeSpectrum()", WHERE ) ) ;
    1366     os << "Swap values. Applied range is [" 
     1369    os << "Swap values. Applied range is ["
    13671370       << nmin << ", " << nmax << "]" << LogIO::POST ;
    13681371  }
    1369  
     1372
    13701373  // if nmin exceeds nChan, nothing to do
    13711374  if ( nmin >= nChan ) {
    13721375    throw( casa::indexError<int>( nmin, "asap::Scantable::reshapeSpectrum: Invalid range. Specified minimum exceeds nChan." ) ) ;
    13731376  }
    1374  
     1377
    13751378  // if nmax exceeds nChan, reset nmax to nChan
    13761379  if ( nmax >= nChan ) {
     
    13881391    }
    13891392  }
    1390  
     1393
    13911394  // reshape specCol_ and flagCol_
    13921395  for ( int irow = 0 ; irow < nrow() ; irow++ ) {
     
    14081411     ***/
    14091412    refval = refval - ( refpix - nmin ) * increment ;
    1410     refpix = 0 ; 
     1413    refpix = 0 ;
    14111414    freqTable_.setEntry( refpix, refval, increment, irow ) ;
    14121415  }
    1413  
     1416
    14141417  // update nchan
    14151418  int newsize = nmax - nmin + 1 ;
    14161419  table_.rwKeywordSet().define( "nChan", newsize ) ;
    1417  
     1420
    14181421  // update bandwidth
    14191422  // assumed all spectra in the scantable have same bandwidth
    14201423  table_.rwKeywordSet().define( "Bandwidth", increment * newsize ) ;
    1421  
     1424
    14221425  return ;
    14231426}
    14241427
    1425 void asap::Scantable::reshapeSpectrum( int nmin, int nmax, int irow ) 
     1428void asap::Scantable::reshapeSpectrum( int nmin, int nmax, int irow )
    14261429{
    14271430  // reshape specCol_ and flagCol_
     
    14641467  for ( int irow = 0 ; irow < nrow() ; irow++ ) {
    14651468    regridChannel( nChan, dnu, irow ) ;
    1466   } 
     1469  }
    14671470  coordinfo[0] = oldinfo ;
    14681471  setCoordInfo( coordinfo ) ;
    14691472
    14701473
    1471   // NOTE: this method does not update metadata such as 
     1474  // NOTE: this method does not update metadata such as
    14721475  //       FREQUENCIES subtable, nChan, Bandwidth, etc.
    14731476
    1474   return ; 
    1475 }
    1476 
    1477 void asap::Scantable::regridChannel( int nChan, double dnu, int irow ) 
     1477  return ;
     1478}
     1479
     1480void asap::Scantable::regridChannel( int nChan, double dnu, int irow )
    14781481{
    14791482  // logging
     
    14851488  Vector<Float> newspec( nChan, 0 ) ;
    14861489  Vector<uChar> newflag( nChan, false ) ;
    1487  
     1490
    14881491  // regrid
    14891492  vector<double> abcissa = getAbcissa( irow ) ;
     
    15041507  zi[0] = z[0] - 0.5 * dnu ;
    15051508  zi[1] = z[0] + 0.5 * dnu ;
    1506   for ( int ii = 2 ; ii < nChan ; ii++ ) 
     1509  for ( int ii = 2 ; ii < nChan ; ii++ )
    15071510    zi[ii] = zi[ii-1] + dnu ;
    15081511  zi[nChan] = z[nChan-1] + 0.5 * dnu ;
     
    15111514  for ( int ii = 2 ; ii < oldsize ; ii++ )
    15121515    yi[ii] = abcissa[ii-1] + olddnu ;
    1513   yi[oldsize] = abcissa[oldsize-1] + 0.5 * olddnu ; 
     1516  yi[oldsize] = abcissa[oldsize-1] + 0.5 * olddnu ;
    15141517  if ( dnu > 0.0 ) {
    15151518    for ( int ii = 0 ; ii < nChan ; ii++ ) {
     
    16661669//    ***/
    16671670//   // NOTE: Assumed that all spectra have the same bandwidth
    1668 //   pile += dnu ; 
     1671//   pile += dnu ;
    16691672//   newspec[nChan-1] += frac * olddnu * oldspec[refChan] ;
    16701673//   newflag[nChan-1] = newflag[nChan-1] || oldflag[refChan] ;
     
    16851688//   newspec[nChan-1] /= wsum ;
    16861689//   //ofs << "newspec[" << nChan - 1 << "] = " << newspec[nChan-1] << endl ;
    1687  
     1690
    16881691//   specCol_.put( irow, newspec ) ;
    16891692//   flagsCol_.put( irow, newflag ) ;
Note: See TracChangeset for help on using the changeset viewer.