Changeset 2550 for branches/hpc33/src/STMath.cpp
- Timestamp:
- 05/29/12 11:24:15 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/hpc33/src/STMath.cpp
r2546 r2550 184 184 tout.addRow(); 185 185 // t4 = mathutil::gettimeofday_sec() ; 186 //TableCopy::copyRows(tout, subt, outrowCount, 0, 1);187 //TableCopy::copyRows(tout, baset, outrowCount, rows[0], 1);188 186 // skip to copy SPECTRA, FLAGTRA, and TSYS since those heavy columns are 189 187 // overwritten in the following process … … 235 233 // outrowCount += rowNum ; 236 234 237 // merge loop235 // merge loop 238 236 uInt i = outrowCount ; 239 // for (uInt i=0; i < tout.nrow(); ++i) { 240 241 // in[0] is already selected by TableItertor 237 // in[0] is already selected by iterator 242 238 specCol.attach(baset,"SPECTRA"); 243 239 flagCol.attach(baset,"FLAGTRA"); … … 248 244 Vector<uChar> flag; 249 245 Double inter,time; 250 // for (uInt k = 0; k < subt.nrow(); ++k ) { 246 251 247 for (uInt l = 0; l < rows.nelements(); ++l ) { 252 248 uInt k = rows[l] ; … … 273 269 // in[0] is already selected by TableIterator so that index is 274 270 // started from 1 275 //for ( int j=0; j < int(in.size()); ++j ) {276 271 for ( int j=1; j < int(in.size()); ++j ) { 277 272 const Table& tin = in[j]->table(); … … 362 357 const Vector<Bool>& msk = acc.getMask(); 363 358 if ( allEQ(msk, False) ) { 364 //uint n = rowstodelete.nelements();365 //rowstodelete.resize(n+1, True);366 //rowstodelete[n] = i;367 359 rowstodelB[nrowdel] = i ; 368 360 nrowdel++ ; … … 408 400 } 409 401 410 //if (rowstodelete.nelements() > 0) {411 402 if ( nrowdel > 0 ) { 412 403 Vector<uInt> rowstodelete( IPosition(1,nrowdel), rowstodelB.storage(), SHARE ) ; … … 5315 5306 } 5316 5307 5317 void STMath::calibrateALMA( CountedPtr<Scantable>& on,5318 CountedPtr<Scantable>& off )5319 {5320 if ( on->nrow() == 0 )5321 return ;5322 // string reftime = on->getTime( index ) ;5323 ROScalarColumn<Double> timeCol( off->table(), "TIME" ) ;5324 Vector<Double> timeVec = timeCol.getColumn() ;5325 //ROTableColumn timeCol( on->table(), "TIME" ) ;5326 timeCol.attach( on->table(), "TIME" ) ;5327 ArrayColumn<Float> tsysCol( on->table(), "TSYS" ) ;5328 vector<float> sp( on->nchan( on->getIF(0) ) ) ;5329 unsigned int spsize = sp.size() ;5330 for ( int index = 0 ; index < on->nrow() ; index++ ) {5331 double reftime = timeCol.asdouble(index) ;5332 Vector<Float> spoff = getSpectrumFromTime( reftime, timeVec, off, "linear" ) ;5333 vector<float> spec = on->getSpectrum( index ) ;5334 Vector<Float> tsys = tsysCol( index ) ;5335 // ALMA Calibration5336 //5337 // Ta* = Tsys * ( ON - OFF ) / OFF5338 //5339 // 2010/01/07 Takeshi Nakazato5340 unsigned int tsyssize = tsys.nelements() ;5341 for ( unsigned int j = 0 ; j < sp.size() ; j++ ) {5342 float tscale = 0.0 ;5343 if ( tsyssize == spsize )5344 tscale = tsys[j] ;5345 else5346 tscale = tsys[0] ;5347 float v = tscale * ( spec[j] - spoff[j] ) / spoff[j] ;5348 sp[j] = v ;5349 }5350 on->setSpectrum( sp, index ) ;5351 }5352 }5353 5354 void STMath::calibrateALMA( CountedPtr<Scantable>& on,5355 CountedPtr<Scantable>& off,5356 Vector<uInt>& rows )5357 {5358 // if rows is empty, just return5359 if ( rows.nelements() == 0 )5360 return ;5361 // string reftime = on->getTime( index ) ;5362 ROScalarColumn<Double> timeCol( off->table(), "TIME" ) ;5363 Vector<Double> timeVec = timeCol.getColumn() ;5364 timeCol.attach( on->table(), "TIME" ) ;5365 ArrayColumn<Float> tsysCol( on->table(), "TSYS" ) ;5366 vector<float> sp( on->nchan( on->getIF(rows[0]) ) ) ;5367 unsigned int spsize = sp.size() ;5368 // I know that the data is contiguous5369 const uInt *p = rows.data() ;5370 for ( int irow = 0 ; irow < rows.nelements() ; irow++ ) {5371 double reftime = timeCol.asdouble(*p) ;5372 Vector<Float> spoff = getSpectrumFromTime( reftime, timeVec, off, "linear" ) ;5373 vector<float> spec = on->getSpectrum( *p ) ;5374 Vector<Float> tsys = tsysCol( *p ) ;5375 // ALMA Calibration5376 //5377 // Ta* = Tsys * ( ON - OFF ) / OFF5378 //5379 // 2010/01/07 Takeshi Nakazato5380 unsigned int tsyssize = tsys.nelements() ;5381 for ( unsigned int j = 0 ; j < sp.size() ; j++ ) {5382 float tscale = 0.0 ;5383 if ( tsyssize == spsize )5384 tscale = tsys[j] ;5385 else5386 tscale = tsys[0] ;5387 float v = tscale * ( spec[j] - spoff[j] ) / spoff[j] ;5388 sp[j] = v ;5389 }5390 on->setSpectrum( sp, *p ) ;5391 p++ ;5392 }5393 }5394 5395 5308 void STMath::calibrateALMA( CountedPtr<Scantable>& out, 5396 5309 const CountedPtr<Scantable>& on, … … 5409 5322 ROArrayColumn<Float> tsysCol( on->table(), "TSYS" ) ; 5410 5323 unsigned int spsize = on->nchan( on->getIF(rows[0]) ) ; 5411 //Vector<Float> spoff( spsize ) ;5412 //Vector<Float> spec( spsize ) ;5413 5324 // I know that the data is contiguous 5414 5325 const uInt *p = rows.data() ; … … 5417 5328 Vector<Float> spoff = getSpectrumFromTime( reftime, timeVec, off, "linear" ) ; 5418 5329 Vector<Float> spec = on->specCol_( *p ) ; 5419 //getSpectrumFromTime2( spoff, reftime, timeVec, off, "linear" ) ;5420 //on->specCol_.get( *p, spec ) ;5421 5330 Vector<Float> tsys = tsysCol( *p ) ; 5422 5331 // ALMA Calibration
Note: See TracChangeset
for help on using the changeset viewer.