Changeset 2544
- Timestamp:
- 05/22/12 13:07:47 (13 years ago)
- Location:
- branches/hpc33/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/hpc33/src/STMath.cpp
r2543 r2544 3940 3940 } 3941 3941 else { 3942 //double t0, t1 ;3942 // double t0, t1 ; 3943 3943 // t0 = mathutil::gettimeofday_sec() ; 3944 3944 vector<bool> masks = s->getMask( 0 ) ; … … 4010 4010 4011 4011 // on scan 4012 //t0 = mathutil::gettimeofday_sec() ;4012 // t0 = mathutil::gettimeofday_sec() ; 4013 4013 bool insitu = insitu_ ; 4014 4014 insitu_ = false ; … … 4018 4018 sel.setTypes( types ) ; 4019 4019 s->setSelection( sel ) ; 4020 TableCopy::copyRows( out->table(), s->table() ) ; 4021 s->unsetSelection() ; 4020 //TableCopy::copyRows( out->table(), s->table() ) ; 4021 out->table().addRow( s->nrow() ) ; 4022 copyRows( out->table(), s->table(), 0, 0, s->nrow(), False ) ; 4023 //s->unsetSelection() ; 4022 4024 sel.reset() ; 4023 //t1 = mathutil::gettimeofday_sec() ;4024 //cout << "elapsed time for preparing output table: " << t1-t0 << " sec" << endl ;4025 // t1 = mathutil::gettimeofday_sec() ; 4026 // cout << "elapsed time for preparing output table: " << t1-t0 << " sec" << endl ; 4025 4027 4026 4028 // process each on scan … … 4044 4046 << "POLNO==" << ids[1] << "&&" 4045 4047 << "IFNO==" << ids[2] ; 4048 //cout << "TaQL string: " << ss.str() << endl ; 4046 4049 sel.setTaQL( ss.str() ) ; 4047 4050 aoff->setSelection( sel ) ; 4048 4051 Vector<uInt> rows = iter->getRows( SHARE ) ; 4049 calibrateALMA( out, aoff, rows ) ; 4052 // out should be an exact copy of s except that SPECTRA column is empty 4053 calibrateALMA( out, s, aoff, rows ) ; 4050 4054 aoff->unsetSelection() ; 4051 4055 sel.reset() ; … … 4053 4057 } 4054 4058 delete iter ; 4059 s->unsetSelection() ; 4055 4060 4056 4061 // t1 = mathutil::gettimeofday_sec() ; … … 4592 4597 vector<float> STMath::getSpectrumFromTime( double reftime, 4593 4598 Vector<Double> &timeVec, 4594 CountedPtr<Scantable>& s,4599 const CountedPtr<Scantable>& s, 4595 4600 string mode ) 4596 4601 { … … 5273 5278 } 5274 5279 5280 void STMath::calibrateALMA( CountedPtr<Scantable>& out, 5281 const CountedPtr<Scantable>& on, 5282 const CountedPtr<Scantable>& off, 5283 Vector<uInt>& rows ) 5284 { 5285 // 2012/05/22 TN 5286 // Assume that out has empty SPECTRA column 5287 5288 // if rows is empty, just return 5289 if ( rows.nelements() == 0 ) 5290 return ; 5291 // string reftime = on->getTime( index ) ; 5292 ROScalarColumn<Double> timeCol( off->table(), "TIME" ) ; 5293 Vector<Double> timeVec = timeCol.getColumn() ; 5294 //ROTableColumn timeCol( on->table(), "TIME" ) ; 5295 timeCol.attach( on->table(), "TIME" ) ; 5296 ROArrayColumn<Float> tsysCol( on->table(), "TSYS" ) ; 5297 //vector<float> sp( on->nchan( on->getIF(rows[0]) ) ) ; 5298 Vector<Float> sp( on->nchan( on->getIF(rows[0]) ) ) ; 5299 unsigned int spsize = sp.size() ; 5300 // I know that the data is contiguous 5301 const uInt *p = rows.data() ; 5302 for ( int irow = 0 ; irow < rows.nelements() ; irow++ ) { 5303 //int index = rows[irow] ; 5304 //double reftime = timeCol.asdouble(index) ; 5305 double reftime = timeCol.asdouble(*p) ; 5306 vector<float> spoff = getSpectrumFromTime( reftime, timeVec, off, "linear" ) ; 5307 //vector<float> spec = on->getSpectrum( index ) ; 5308 //Vector<Float> tsys = tsysCol( index ) ; 5309 vector<float> spec = on->getSpectrum( *p ) ; 5310 Vector<Float> tsys = tsysCol( *p ) ; 5311 // ALMA Calibration 5312 // 5313 // Ta* = Tsys * ( ON - OFF ) / OFF 5314 // 5315 // 2010/01/07 Takeshi Nakazato 5316 unsigned int tsyssize = tsys.nelements() ; 5317 for ( unsigned int j = 0 ; j < sp.size() ; j++ ) { 5318 float tscale = 0.0 ; 5319 if ( tsyssize == spsize ) 5320 tscale = tsys[j] ; 5321 else 5322 tscale = tsys[0] ; 5323 float v = tscale * ( spec[j] - spoff[j] ) / spoff[j] ; 5324 sp[j] = v ; 5325 } 5326 //on->setSpectrum( sp, index ) ; 5327 //on->setSpectrum( sp, *p ) ; 5328 // no check for nchan 5329 //Vector<Float> spv( sp ) ; 5330 out->specCol_.put( *p, sp ) ; 5331 p++ ; 5332 } 5333 } 5334 5275 5335 vector<float> STMath::getFSCalibratedSpectra( CountedPtr<Scantable>& sig, 5276 5336 CountedPtr<Scantable>& ref, -
branches/hpc33/src/STMath.h
r2543 r2544 403 403 404 404 vector<float> getSpectrumFromTime( string reftime, casa::CountedPtr<Scantable>& s, string mode = "before" ) ; 405 vector<float> getSpectrumFromTime( double reftime, casa::Vector<casa::Double> &v, c asa::CountedPtr<Scantable>& s, string mode = "before" ) ;405 vector<float> getSpectrumFromTime( double reftime, casa::Vector<casa::Double> &v, const casa::CountedPtr<Scantable>& s, string mode = "before" ) ; 406 406 vector<float> getTcalFromTime( string reftime, casa::CountedPtr<Scantable>& s, string mode="before" ) ; 407 407 vector<float> getTsysFromTime( string reftime, casa::CountedPtr<Scantable>& s, string mode="before" ) ; … … 425 425 void calibrateALMA( casa::CountedPtr<Scantable>& on, 426 426 casa::CountedPtr<Scantable>& off, 427 casa::Vector<casa::uInt>& rows ) ; 428 void calibrateALMA( casa::CountedPtr<Scantable>& out, 429 const casa::CountedPtr<Scantable>& on, 430 const casa::CountedPtr<Scantable>& off, 427 431 casa::Vector<casa::uInt>& rows ) ; 428 432 vector<float> getFSCalibratedSpectra( casa::CountedPtr<Scantable>& sig,
Note:
See TracChangeset
for help on using the changeset viewer.