- Timestamp:
- 02/02/11 13:15:19 (14 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/MSFiller.cpp
r1978 r1987 17 17 #include <tables/Tables/ExprNode.h> 18 18 #include <tables/Tables/TableIter.h> 19 #include <tables/Tables/TableColumn.h> 19 20 #include <tables/Tables/ScalarColumn.h> 20 21 #include <tables/Tables/ArrayColumn.h> 22 #include <tables/Tables/RefRows.h> 23 #include <tables/Tables/TableParse.h> 21 24 #include <tables/Tables/RefRows.h> 22 25 … … 25 28 #include <casa/Arrays/Slicer.h> 26 29 #include <casa/Quanta/MVTime.h> 30 #include <casa/OS/Path.h> 27 31 28 32 #include <measures/Measures/Stokes.h> 29 33 #include <measures/Measures/MEpoch.h> 34 #include <measures/Measures/MCEpoch.h> 35 #include <measures/Measures/MFrequency.h> 36 #include <measures/Measures/MCFrequency.h> 37 #include <measures/Measures/MPosition.h> 38 #include <measures/Measures/MCPosition.h> 39 #include <measures/Measures/MDirection.h> 40 #include <measures/Measures/MCDirection.h> 41 #include <measures/Measures/MeasConvert.h> 30 42 #include <measures/TableMeasures/ScalarMeasColumn.h> 43 #include <measures/TableMeasures/ArrayMeasColumn.h> 44 #include <measures/TableMeasures/ScalarQuantColumn.h> 45 #include <measures/TableMeasures/ArrayQuantColumn.h> 31 46 32 47 #include <atnf/PKSIO/SrcType.h> … … 41 56 MSFiller::MSFiller( casa::CountedPtr<Scantable> stable ) 42 57 : table_( stable ), 58 tablename_( "" ), 43 59 antenna_( -1 ), 44 60 getPt_( False ), … … 65 81 { 66 82 os_.origin( LogOrigin( "MSFiller", "open()", WHERE ) ) ; 83 //os_ << "start MSFiller::open()" << LogIO::POST ; 67 84 //os_ << " filename = " << filename << endl ; 68 //rec.print( os_.output(), 25, " " ) ;69 //os_ << LogIO::POST ;70 85 71 86 // parsing MS options 72 //Int antenna = 0 ;73 //Bool getPt = False;74 75 87 if ( rec.isDefined( "ms" ) ) { 76 88 Record msrec = rec.asRecord( "ms" ) ; … … 95 107 os_ << " antenna = " << antenna_ << LogIO::POST ; 96 108 97 mstable_ = MeasurementSet( filename, Table::Old ) ; 109 MeasurementSet *tmpMS = new MeasurementSet( filename, Table::Old ) ; 110 //mstable_ = (*tmpMS)( tmpMS->col("ANTENNA1") == antenna_ 111 // && tmpMS->col("ANTENNA1") == tmpMS->col("ANTENNA2") ) ; 112 tablename_ = tmpMS->tableName() ; 113 mstable_ = MeasurementSet( (*tmpMS)( tmpMS->col("ANTENNA1") == antenna_ 114 && tmpMS->col("ANTENNA1") == tmpMS->col("ANTENNA2") ) ) ; 115 // stringstream ss ; 116 // ss << "SELECT FROM $1 WHERE ANTENNA1 == ANTENNA2 && ANTENNA1 == " << antenna_ ; 117 // String taql( ss.str() ) ; 118 // mstable_ = MeasurementSet( tableCommand( taql, *tmpMS ) ) ; 119 delete tmpMS ; 98 120 99 121 // check which data column exists 100 isFloatData_ = mstable_.isColumn( MSMainEnums::FLOAT_DATA ) ; 101 isData_ = mstable_.isColumn( MSMainEnums::DATA ) ; 102 122 isFloatData_ = mstable_.tableDesc().isColumn( "FLOAT_DATA" ) ; 123 isData_ = mstable_.tableDesc().isColumn( "DATA" ) ; 124 125 //os_ << "end MSFiller::open()" << LogIO::POST ; 103 126 return true ; 104 127 } … … 107 130 { 108 131 os_.origin( LogOrigin( "MSFiller", "fill()", WHERE ) ) ; 109 110 tablesel_ = mstable_( mstable_.col("ANTENNA1") == mstable_.col("ANTENNA2") 111 && mstable_.col("ANTENNA1") == antenna_ ) ; 132 //os_ << "start MSFiller::fill()" << LogIO::POST ; 112 133 113 134 // Initialize header … … 132 153 133 154 // check if optional table exists 134 const TableRecord msrec = tablesel_.keywordSet() ; 155 //const TableRecord msrec = tablesel_.keywordSet() ; 156 const TableRecord msrec = mstable_.keywordSet() ; 135 157 isDoppler_ = msrec.isDefined( "DOPPLER" ) ; 136 158 isFlagCmd_ = msrec.isDefined( "FLAG_CMD" ) ; … … 142 164 143 165 // Access to MS subtables 144 MSField fieldtab = tablesel_.field() ;145 MSPolarization poltab = tablesel_.polarization() ;146 MSDataDescription ddtab = tablesel_.dataDescription() ;147 MSObservation obstab = tablesel_.observation() ;148 MSSource srctab = tablesel_.source() ;149 MSSpectralWindow spwtab = tablesel_.spectralWindow() ;150 MSSysCal caltab = tablesel_.sysCal() ;166 MSField fieldtab = mstable_.field() ; 167 MSPolarization poltab = mstable_.polarization() ; 168 MSDataDescription ddtab = mstable_.dataDescription() ; 169 MSObservation obstab = mstable_.observation() ; 170 MSSource srctab = mstable_.source() ; 171 MSSpectralWindow spwtab = mstable_.spectralWindow() ; 172 MSSysCal caltab = mstable_.sysCal() ; 151 173 if ( caltab.nrow() == 0 ) 152 174 isSysCal_ = False ; 153 MSPointing pointtab = tablesel_.pointing() ; 154 MSWeather weathertab = tablesel_.weather() ; 155 if ( weathertab.nrow() == 0 ) 175 MSPointing pointtab = mstable_.pointing() ; 176 if ( mstable_.weather().nrow() == 0 ) 156 177 isWeather_ = False ; 157 158 // os_ << "isDoppler_ = " << isDoppler_ << endl 159 // << "isFlagCmd_ = " << isFlagCmd_ << endl 160 // << "isFreqOffset_ = " << isFreqOffset_ << endl 161 // << "isHistory_ = " << isHistory_ << endl 162 // << "isProcessor_ = " << isProcessor_ << endl 163 // << "isSysCal_ = " << isSysCal_ << endl 164 // << "isWeather_ = " << isWeather_ << LogIO::POST ; 165 166 // SUBTABLES: FREQUENCIES 167 //fillFrequencies() ; 178 MSState stattab = mstable_.state() ; 179 MSAntenna anttab = mstable_.antenna() ; 180 181 // TEST 182 // memory allocation by boost::object_pool 183 boost::object_pool<ROTableColumn> *tpoolr = new boost::object_pool<ROTableColumn> ; 184 boost::object_pool<TableColumn> *tpoolw = new boost::object_pool<TableColumn> ; 185 // 186 187 // SUBTABLES: FREQUENCIES 168 188 table_->frequencies().setFrame( "LSRK" ) ; 169 189 table_->frequencies().setFrame( "LSRK", True ) ; … … 178 198 // SUBTABLES: TCAL 179 199 if ( isSysCal_ ) 180 fillTcal() ; 181 182 // SUBTABLES: MOLECULES 183 //fillMolecules() ; 200 fillTcal( tpoolr ) ; 184 201 185 202 // SUBTABLES: FIT … … 189 206 //fillHistory() ; 190 207 208 // shared pointers 209 ROTableColumn *tcolr ; 210 TableColumn *tcolw ; 211 212 // Scantable columns 213 Table stab = table_->table() ; 214 TableColumn *scannoCol = tpoolw->construct( stab, "SCANNO" ) ; 215 TableColumn *cyclenoCol = tpoolw->construct( stab, "CYCLENO" ) ; 216 TableColumn *beamnoCol = tpoolw->construct( stab, "BEAMNO" ) ; 217 TableColumn *ifnoCol = tpoolw->construct( stab, "IFNO" ) ; 218 TableColumn *polnoCol = tpoolw->construct( stab, "POLNO" ) ; 219 TableColumn *freqidCol = tpoolw->construct( stab, "FREQ_ID" ) ; 220 TableColumn *molidCol = tpoolw->construct( stab, "MOLECULE_ID" ) ; 221 TableColumn *flagrowCol = tpoolw->construct( stab, "FLAGROW" ) ; 222 ScalarMeasColumn<MEpoch> *timeCol = new ScalarMeasColumn<MEpoch>( stab, "TIME" ) ; 223 TableColumn *intervalCol = tpoolw->construct( stab, "INTERVAL" ) ; 224 TableColumn *srcnameCol = tpoolw->construct( stab, "SRCNAME" ) ; 225 TableColumn *srctypeCol = tpoolw->construct( stab, "SRCTYPE" ) ; 226 TableColumn *fieldnameCol = tpoolw->construct( stab, "SRCNAME" ) ; 227 ArrayColumn<Float> *spCol = new ArrayColumn<Float>( stab, "SPECTRA" ) ; 228 ArrayColumn<uChar> *flCol = new ArrayColumn<uChar>( stab, "FLAGTRA" ) ; 229 ArrayColumn<Float> *tsysCol = new ArrayColumn<Float>( stab, "TSYS" ) ; 230 ArrayColumn<Double> *dirCol = new ArrayColumn<Double>( stab, "DIRECTION" ) ; 231 TableColumn *azCol = tpoolw->construct( stab, "AZIMUTH" ) ; 232 TableColumn *elCol = tpoolw->construct( stab, "ELEVATION" ) ; 233 TableColumn *tcalidCol = tpoolw->construct( stab, "TCAL_ID" ) ; 234 TableColumn *focusidCol = tpoolw->construct( stab, "FOCUS_ID" ) ; 235 TableColumn *weatheridCol = tpoolw->construct( stab, "WEATHER_ID" ) ; 236 ArrayColumn<Double> *srcpmCol = new ArrayColumn<Double>( stab, "SRCPROPERMOTION" ) ; 237 ArrayColumn<Double> *srcdirCol = new ArrayColumn<Double>( stab, "SRCDIRECTION" ) ; 238 TableColumn *srcvelCol = tpoolw->construct( stab, "SRCVELOCITY" ) ; 239 ArrayColumn<Double> *scanrateCol = new ArrayColumn<Double>( stab, "SCANRATE" ) ; 240 191 241 // MAIN 192 242 // Iterate over several ids 193 243 Int oldnr = table_->nrow() ; 194 244 map<Int, uInt> ifmap ; // (IFNO, FREQ_ID) pair 195 ROMSAntennaColumns antCols( mstable_.antenna() ) ; 196 Vector< Quantum<Double> > antpos = antCols.positionQuant()(antenna_) ; 245 ROArrayQuantColumn<Double> *sharedQDArrCol = new ROArrayQuantColumn<Double>( anttab, "POSITION" ) ; 246 Vector< Quantum<Double> > antpos = (*sharedQDArrCol)( antenna_ ) ; 247 delete sharedQDArrCol ; 197 248 MPosition mp( MVPosition( antpos ), MPosition::ITRF ) ; 198 MSPointing potabsel = pointtab( pointtab.col("ANTENNA_ID")==antenna_ ).sort("TIME") ; 199 String stationName = antCols.station()(antenna_) ; 200 ROMSPointingColumns pointCols( potabsel ) ; 201 String telescopeName ; 249 //pointtab = pointtab( pointtab.col("ANTENNA_ID")==antenna_ ).sort("TIME") ; 250 pointtab = MSPointing( pointtab( pointtab.col("ANTENNA_ID")==antenna_ ).sort("TIME") ) ; 251 tcolr = tpoolr->construct( anttab, "STATION" ) ; 252 String stationName = tcolr->asString( antenna_ ) ; 253 tpoolr->destroy( tcolr ) ; 254 tcolr = tpoolr->construct( anttab, "NAME" ) ; 255 String antennaName = tcolr->asString( antenna_ ) ; 256 tpoolr->destroy( tcolr ) ; 257 sdh.antennaposition.resize( 3 ) ; 258 for ( int i = 0 ; i < 3 ; i++ ) 259 sdh.antennaposition[i] = antpos[i].getValue( "m" ) ; 260 String telescopeName = "" ; 261 202 262 // 203 263 // ITERATION: OBSERVATION_ID … … 205 265 Int added0 = 0 ; 206 266 Int current0 = table_->nrow() ; 207 TableIterator iter0( tablesel_, "OBSERVATION_ID" ) ;267 TableIterator iter0( mstable_, "OBSERVATION_ID" ) ; 208 268 while( !iter0.pastEnd() ) { 209 MeasurementSet t0( iter0.table() ) ; 210 ROScalarColumn<Int> mObsIdCol( t0, "OBSERVATION_ID" ) ; 211 Int obsId = mObsIdCol( 0 ) ; 212 ROMSObservationColumns obsCols( obstab ) ; 213 if ( sdh.observer == "" ) sdh.observer = obsCols.observer()(obsId) ; 214 if ( sdh.project == "" ) sdh.project = obsCols.project()(obsId) ; 215 MEpoch me = obsCols.timeRangeMeas()(obsId)(IPosition(1,0)) ; 269 Table t0 = iter0.table() ; 270 tcolr = tpoolr->construct( t0, "OBSERVATION_ID" ) ; 271 Int obsId = tcolr->asInt( 0 ) ; 272 tpoolr->destroy( tcolr ) ; 273 if ( sdh.observer == "" ) { 274 tcolr = tpoolr->construct( obstab, "OBSERVER" ) ; 275 sdh.observer = tcolr->asString( obsId ) ; 276 tpoolr->destroy( tcolr ) ; 277 } 278 if ( sdh.project == "" ) { 279 tcolr = tpoolr->construct( obstab, "PROJECT" ) ; 280 sdh.observer = tcolr->asString( obsId ) ; 281 tpoolr->destroy( tcolr ) ; 282 } 283 ROArrayMeasColumn<MEpoch> *tmpMeasCol = new ROArrayMeasColumn<MEpoch>( obstab, "TIME_RANGE" ) ; 284 MEpoch me = (*tmpMeasCol)( obsId )( IPosition(1,0) ) ; 285 delete tmpMeasCol ; 216 286 if ( sdh.utc == 0.0 ) { 217 Quantum<Double> startTime = obsCols.timeRangeQuant()(obsId)(IPosition(1,0)) ; 218 sdh.utc = startTime.getValue( "s" ) ; 219 } 220 telescopeName = obsCols.telescopeName()(obsId) ; 287 sdh.utc = me.get( "s" ).getValue() ; 288 } 289 if ( telescopeName == "" ) { 290 tcolr = tpoolr->construct( obstab, "TELESCOPE_NAME" ) ; 291 sdh.observer = tcolr->asString( obsId ) ; 292 tpoolr->destroy( tcolr ) ; 293 } 221 294 Int nbeam = 0 ; 222 295 // … … 227 300 TableIterator iter1( t0, "FEED1" ) ; 228 301 while( !iter1.pastEnd() ) { 229 MeasurementSet t1( iter1.table() ) ; 230 ROScalarColumn<Int> mFeedCol( t1, "FEED1" ) ; 231 Int feedId = mFeedCol( 0 ) ; // assume FEED1 == FEED2 302 Table t1 = iter1.table() ; 303 // assume FEED1 == FEED2 304 tcolr = tpoolr->construct( t1, "FEED1" ) ; 305 Int feedId = tcolr->asInt( 0 ) ; 306 tpoolr->destroy( tcolr ) ; 232 307 nbeam++ ; 233 308 // … … 238 313 TableIterator iter2( t1, "FIELD_ID" ) ; 239 314 while( !iter2.pastEnd() ) { 240 MeasurementSet t2( iter2.table() ) ; 241 ROScalarColumn<Int> mFieldIdCol( t2, "FIELD_ID" ) ; 242 Int fieldId = mFieldIdCol( 0 ) ; 243 ROScalarColumn<String> mFieldNameCol( fieldtab, "NAME" ) ; 244 ROScalarColumn<Int> mSrcIdCol( fieldtab, "SOURCE_ID" ) ; 245 String fieldName = mFieldNameCol( fieldId ) + "__" + String::toString(fieldId) ; 246 Int srcId = mSrcIdCol( fieldId ) ; 315 Table t2 = iter2.table() ; 316 tcolr = tpoolr->construct( t2, "FIELD_ID" ) ; 317 Int fieldId = tcolr->asInt( 0 ) ; 318 tpoolr->destroy( tcolr ) ; 319 tcolr = tpoolr->construct( fieldtab, "SOURCE_ID" ) ; 320 Int srcId = tcolr->asInt( fieldId ) ; 321 tpoolr->destroy( tcolr ) ; 322 tcolr = tpoolr->construct( fieldtab, "NAME" ) ; 323 String fieldName = tcolr->asString( fieldId ) + "__" + String::toString(fieldId) ; 324 tpoolr->destroy( tcolr ) ; 247 325 // 248 326 // ITERATION: DATA_DESC_ID … … 252 330 TableIterator iter3( t2, "DATA_DESC_ID" ) ; 253 331 while( !iter3.pastEnd() ) { 254 MeasurementSet t3( iter3.table() ) ; 255 ROScalarColumn<Int> mDDIdCol( t3, "DATA_DESC_ID" ) ; 256 Int ddId = mDDIdCol( 0 ) ; 257 ROMSDataDescColumns ddCols( ddtab ) ; 258 Int polId = ddCols.polarizationId()(ddId) ; 259 Int spwId = ddCols.spectralWindowId()(ddId) ; 332 Table t3 = iter3.table() ; 333 tcolr = tpoolr->construct( t3, "DATA_DESC_ID" ) ; 334 Int ddId = tcolr->asInt( 0 ) ; 335 tpoolr->destroy( tcolr ) ; 336 tcolr = tpoolr->construct( ddtab, "POLARIZATION_ID" ) ; 337 Int polId = tcolr->asInt( ddId ) ; 338 tpoolr->destroy( tcolr ) ; 339 tcolr = tpoolr->construct( ddtab, "SPECTRAL_WINDOW_ID" ) ; 340 Int spwId = tcolr->asInt( ddId ) ; 341 tpoolr->destroy( tcolr ) ; 260 342 // polarization information 261 ROMSPolarizationColumns polCols( poltab ) ; 262 Int npol = polCols.numCorr()(polId) ; 263 Vector<Int> corrtype = polCols.corrType()(polId) ; 343 tcolr = tpoolr->construct( poltab, "NUM_CORR" ) ; 344 Int npol = tcolr->asInt( polId ) ; 345 tpoolr->destroy( tcolr ) ; 346 ROArrayColumn<Int> *roArrICol = new ROArrayColumn<Int>( poltab, "CORR_TYPE" ) ; 347 Vector<Int> corrtype = (*roArrICol)( polId ) ; 348 delete roArrICol ; 264 349 //os_ << "npol = " << npol << LogIO::POST ; 265 350 //os_ << "corrtype = " << corrtype << LogIO::POST ; … … 269 354 MSSource srctabSel( srctab( srctab.col("SOURCE_ID") == srcId && srctab.col("SPECTRAL_WINDOW_ID") == spwId ) ) ; 270 355 //os_ << "srcId = " << srcId << " spwId = " << spwId << " nrow = " << srctabSel.nrow() << LogIO::POST ; 271 ROMSSourceColumns srcCols( srctabSel ) ; 272 String srcName = srcCols.name()(0) ; 356 tcolr = tpoolr->construct( srctabSel, "NAME" ) ; 357 String srcName = tcolr->asString( 0 ) ; 358 tpoolr->destroy( tcolr ) ; 273 359 //os_ << "srcName = " << srcName << LogIO::POST ; 274 Array<Double> srcPM = srcCols.properMotion()(0) ; 360 ROArrayColumn<Double> *roArrDCol = new ROArrayColumn<Double>( srctabSel, "PROPER_MOTION" ) ; 361 Array<Double> srcPM = (*roArrDCol)( 0 ) ; 362 delete roArrDCol ; 275 363 //os_ << "srcPM = " << srcPM << LogIO::POST ; 276 Array<Double> srcDir = srcCols.direction()(0) ; 364 roArrDCol = new ROArrayColumn<Double>( srctabSel, "DIRECTION" ) ; 365 Array<Double> srcDir = (*roArrDCol)( 0 ) ; 366 delete roArrDCol ; 277 367 //os_ << "srcDir = " << srcDir << LogIO::POST ; 278 Array<Double> sysVels = srcCols.sysvel()(0);368 Array<Double> sysVels ; 279 369 Double sysVel = 0.0 ; 370 if ( srctabSel.tableDesc().isColumn( "SYSVEL" ) ) { 371 roArrDCol = new ROArrayColumn<Double>( srctabSel, "SYSVEL" ) ; 372 sysVels = (*roArrDCol)( 0 ) ; 373 delete roArrDCol ; 374 } 280 375 if ( !sysVels.empty() ) { 281 376 //os_ << "sysVels.shape() = " << sysVels.shape() << LogIO::POST ; 282 377 // NB: assume all SYSVEL values are the same 283 DoublesysVel = sysVels( IPosition(1,0) ) ;378 sysVel = sysVels( IPosition(1,0) ) ; 284 379 } 380 //delete tmpArrCol ; 285 381 //os_ << "sysVel = " << sysVel << LogIO::POST ; 286 MDirection md = srcCols.directionMeas()(0) ; 382 ROScalarMeasColumn<MDirection> *tmpMeasCol = new ROScalarMeasColumn<MDirection>( srctabSel, "DIRECTION" ) ; 383 MDirection md = (*tmpMeasCol)( 0 ) ; 384 delete tmpMeasCol ; 287 385 // for MOLECULES subtable 288 Int numLines = srcCols.numLines()(0) ; 386 tcolr = tpoolr->construct( srctabSel, "NUM_LINES" ) ; 387 Int numLines = tcolr->asInt( 0 ) ; 388 tpoolr->destroy( tcolr ) ; 289 389 //os_ << "numLines = " << numLines << LogIO::POST ; 290 390 Vector<Double> restFreqs( numLines, 0.0 ) ; 291 391 Vector<String> transitionName( numLines, "" ) ; 292 392 if ( numLines != 0 ) { 293 Array< Quantum<Double> > qRestFreqs = srcCols.restFrequencyQuant()(0) ; 294 for ( int i = 0 ; i < numLines ; i++ ) { 295 restFreqs[i] = qRestFreqs( IPosition( 1, i ) ).getValue( "Hz" ) ; 393 if ( srctabSel.tableDesc().isColumn( "REST_FREQUENCY" ) ) { 394 sharedQDArrCol = new ROArrayQuantColumn<Double>( srctabSel, "REST_FREQUENCY" ) ; 395 Array< Quantum<Double> > qRestFreqs = (*sharedQDArrCol)( 0 ) ; 396 delete sharedQDArrCol ; 397 for ( int i = 0 ; i < numLines ; i++ ) { 398 restFreqs[i] = qRestFreqs( IPosition( 1, i ) ).getValue( "Hz" ) ; 399 } 296 400 } 297 401 //os_ << "restFreqs = " << restFreqs << LogIO::POST ; 298 402 if ( srctabSel.tableDesc().isColumn( "TRANSITION" ) ) { 299 ROScalarColumn<String> transitionNameCol = srcCols.transition() ; 403 tcolr = tpoolr->construct( srctabSel, "TRANSITION" ) ; 404 transitionName = tcolr->asString( 0 ) ; 405 tpoolr->destroy( tcolr ) ; 300 406 //os_ << "transitionNameCol.nrow() = " << transitionNameCol.nrow() << LogIO::POST ; 301 transitionName = transitionNameCol(0) ;302 407 } 303 408 } … … 305 410 // spectral setup 306 411 MeasFrame mf( me, mp, md ) ; 307 ROMSSpWindowColumns spwCols( spwtab ) ; 308 MFrequency::Types freqRef = MFrequency::castType((uInt)(spwCols.measFreqRef()(spwId))) ; 309 Int nchan = spwCols.numChan()(spwId) ; 412 tcolr = tpoolr->construct( spwtab, "MEAS_FREQ_REF" ) ; 413 MFrequency::Types freqRef = MFrequency::castType((uInt)(tcolr->asInt(spwId))) ; 414 tpoolr->destroy( tcolr ) ; 415 tcolr = tpoolr->construct( spwtab, "NUM_CHAN" ) ; 416 Int nchan = tcolr->asInt( spwId ) ; 417 tpoolr->destroy( tcolr ) ; 310 418 Bool even = False ; 311 419 if ( (nchan/2)*2 == nchan ) even = True ; 312 420 if ( sdh.nchan < nchan ) sdh.nchan = nchan ; 313 Quantum<Double> qtotbw = spwCols.totalBandwidthQuant()(spwId) ; 314 Double totbw = qtotbw.getValue( "Hz" ) ; 421 ROScalarQuantColumn<Double> *tmpQuantCol = new ROScalarQuantColumn<Double>( spwtab, "TOTAL_BANDWIDTH" ) ; 422 Double totbw = (*tmpQuantCol)( spwId ).getValue( "Hz" ) ; 423 delete tmpQuantCol ; 315 424 if ( sdh.bandwidth < totbw ) sdh.bandwidth = totbw ; 316 425 if ( sdh.freqref == "" ) … … 318 427 sdh.freqref = "LSRK" ; 319 428 if ( sdh.reffreq == -1.0 ) { 320 Quantum<Double> qreffreq = spwCols.refFrequencyQuant()(spwId) ; 429 tmpQuantCol = new ROScalarQuantColumn<Double>( spwtab, "REF_FREQUENCY" ) ; 430 Quantum<Double> qreffreq = (*tmpQuantCol)( spwId ) ; 431 delete tmpQuantCol ; 321 432 if ( freqRef == MFrequency::LSRK ) { 322 433 sdh.reffreq = qreffreq.getValue("Hz") ; … … 331 442 Double refpix = 0.5*(nchan-1) ; 332 443 Double refval = 0.0 ; 333 Double increment = spwCols.chanWidthQuant()(spwId)(refip).getValue("Hz") ; 444 sharedQDArrCol = new ROArrayQuantColumn<Double>( spwtab, "CHAN_WIDTH" ) ; 445 Double increment = (*sharedQDArrCol)( spwId )( refip ).getValue( "Hz" ) ; 446 delete sharedQDArrCol ; 334 447 //os_ << "nchan = " << nchan << " refchan = " << refchan << "(even=" << even << ") refpix = " << refpix << LogIO::POST ; 335 Vector< Quantum<Double> > chanFreqs = spwCols.chanFreqQuant()(spwId) ; 448 sharedQDArrCol = new ROArrayQuantColumn<Double>( spwtab, "CHAN_FREQ" ) ; 449 Vector< Quantum<Double> > chanFreqs = (*sharedQDArrCol)( spwId ) ; 450 delete sharedQDArrCol ; 336 451 if ( freqRef == MFrequency::LSRK ) { 337 452 if ( even ) { … … 365 480 // for TSYS and TCAL 366 481 MSSysCal caltabsel( caltab( caltab.col("ANTENNA_ID") == antenna_ && caltab.col("FEED_ID") == feedId && caltab.col("SPECTRAL_WINDOW_ID") == spwId ).sort("TIME") ) ; 367 //Vector<uInt> tcalidrange = addTcal( caltabsel ) ;368 482 // 369 483 // ITERATION: SCAN_NUMBER … … 373 487 TableIterator iter4( t3, "SCAN_NUMBER" ) ; 374 488 while( !iter4.pastEnd() ) { 375 MeasurementSet t4( iter4.table() ) ; 376 ROScalarColumn<Int> mScanNumCol( t4, "SCAN_NUMBER" ) ; 377 Int scanNum = mScanNumCol( 0 ) ; 489 Table t4 = iter4.table() ; 490 tcolr = tpoolr->construct( t4, "SCAN_NUMBER" ) ; 491 Int scanNum = tcolr->asInt( 0 ) ; 492 tpoolr->destroy( tcolr ) ; 378 493 uInt cycle = 0 ; 379 494 // … … 384 499 TableIterator iter5( t4, "STATE_ID" ) ; 385 500 while( !iter5.pastEnd() ) { 386 MeasurementSet t5( iter5.table().sort( "TIME" ) ) ; 387 ROScalarColumn<Int> mStateIdCol( t5, "STATE_ID" ) ; 388 Int stateId = mStateIdCol( 0 ) ; 389 ROMSStateColumns stateCols( t5.state() ) ; 390 String obstype = stateCols.obsMode()(stateId) ; 501 Table t5 = iter5.table() ; 502 tcolr = tpoolr->construct( t5, "STATE_ID" ) ; 503 Int stateId = tcolr->asInt( 0 ) ; 504 tpoolr->destroy( tcolr ) ; 505 tcolr = tpoolr->construct( stattab, "OBS_MODE" ) ; 506 String obstype = tcolr->asString( stateId ) ; 507 tpoolr->destroy( tcolr ) ; 391 508 if ( sdh.obstype == "" ) sdh.obstype = obstype ; 392 509 … … 394 511 Int prevnr = oldnr ; 395 512 Int addednr = 0 ; 513 Int nloop = 0 ; 396 514 397 515 // SPECTRA, FLAG 398 ArrayColumn<Float> spCol( table_->table(), "SPECTRA" ) ;399 ArrayColumn<uChar> flagCol( table_->table(), "FLAGTRA" ) ;400 516 ROArrayColumn<Bool> mFlagCol( t5, "FLAG" ) ; 401 517 if ( isFloatData_ ) { 402 518 //os_ << "FLOAT_DATA exists" << LogIO::POST ; 403 519 ROArrayColumn<Float> mFloatDataCol( t5, "FLOAT_DATA" ) ; 404 IPosition cShape = mFloatDataCol.shape( 0 ) ; 405 IPosition newShape( 2, cShape[1], nrow ) ; 406 for ( int ipol = 0 ; ipol < npol ; ipol++ ) { 407 table_->table().addRow( nrow ) ; 408 addednr += nrow ; 409 Int newnr = oldnr + nrow ; 410 RefRows rows( oldnr, newnr-1 ) ; 411 Slice paxis( ipol, 1, 1 ) ; 412 Slice caxis( 0, cShape[1], 1 ) ; 413 Slicer slicer( paxis, caxis ) ; 414 spCol.putColumnCells( rows, mFloatDataCol.getColumn(slicer).reform(newShape) ) ; 415 Array<Bool> flags = mFlagCol.getColumn(slicer).reform(newShape) ; 416 Array<uChar> flagtra( flags.shape() ) ; 417 convertArray( flagtra, flags ) ; 418 flagCol.putColumnCells( rows, flagtra ) ; 419 oldnr = newnr ; 520 addednr = nrow*npol ; 521 oldnr += addednr ; 522 table_->table().addRow( addednr ) ; 523 nloop = npol ; 524 for ( Int irow = 0 ; irow < nrow ; irow++ ) { 525 Matrix<Float> sp = mFloatDataCol( irow ) ; 526 for ( Int ipol = 0 ; ipol < npol ; ipol++ ) { 527 spCol->put( prevnr+ipol*nrow+irow, sp.row(ipol) ) ; 528 } 529 } 530 for ( Int irow = 0 ; irow < nrow ; irow++ ) { 531 Matrix<Bool> flb = mFlagCol( irow ) ; 532 Matrix<uChar> fl( flb.shape() ) ; 533 convertArray( fl, flb ) ; 534 for ( Int ipol = 0 ; ipol < npol ; ipol++ ) { 535 flCol->put( prevnr+ipol*nrow+irow, fl.row(ipol) ) ; 536 } 420 537 } 421 538 if ( sdh.fluxunit == "" ) { … … 428 545 //os_ << "DATA exists" << LogIO::POST ; 429 546 ROArrayColumn<Complex> mDataCol( t5, "DATA" ) ; 430 IPosition cShape = mDataCol.shape( 0 ) ; 431 IPosition newShape( 2, cShape[1], nrow ) ; 432 Bool crossOK = False ; 433 for ( int ipol = 0 ; ipol < npol ; ipol++ ) { 434 //os_ << "corrtype[" << ipol << "] = " << corrtype[ipol] << LogIO::POST ; 435 if ( corrtype[ipol] == Stokes::XY || corrtype[ipol] == Stokes::YX 436 || corrtype[ipol] == Stokes::RL || corrtype[ipol] == Stokes::LR ) { 437 if ( !crossOK ) { 438 //os_ << "cross polarization data" << LogIO::POST ; 439 table_->table().addRow( nrow, True ) ; 440 addednr += nrow ; 441 //os_ << "table_->nrow() = " << table_->nrow() << LogIO::POST ; 442 Int newnr = oldnr + nrow ; 443 RefRows rows( oldnr, newnr-1 ) ; 444 Slice paxis( ipol, 1, 1 ) ; 445 Slice caxis( 0, cShape[1], 1 ) ; 446 Slicer slicer( paxis, caxis ) ; 447 Array<Complex> data = mDataCol.getColumn(slicer).reform(newShape) ; 448 spCol.putColumnCells( rows, real( data ) ) ; 449 Array<Bool> flags = mFlagCol.getColumn(slicer).reform(newShape) ; 450 Array<uChar> flagtra( flags.shape() ) ; 451 convertArray( flagtra, flags ) ; 452 flagCol.putColumnCells( rows, flagtra ) ; 453 oldnr = newnr ; 454 table_->table().addRow( nrow, True ) ; 455 addednr += nrow ; 456 newnr = oldnr + nrow ; 457 rows = RefRows( oldnr, newnr-1 ) ; 458 if ( corrtype[ipol] == Stokes::YX || corrtype[ipol] == Stokes::LR ) { 459 data = conj( data ) ; 547 addednr = nrow*npol ; 548 oldnr += addednr ; 549 table_->table().addRow( addednr ) ; 550 nloop = npol ; 551 for ( Int irow = 0 ; irow < nrow ; irow++ ) { 552 Bool crossOK = False ; 553 Matrix<Complex> sp = mDataCol( irow ) ; 554 for ( Int ipol = 0 ; ipol < npol ; ipol++ ) { 555 if ( corrtype[ipol] == Stokes::XY || corrtype[ipol] == Stokes::YX 556 || corrtype[ipol] == Stokes::RL || corrtype[ipol] == Stokes::LR ) { 557 if ( !crossOK ) { 558 crossOK = True ; 559 Int pidx = prevnr + ipol * nrow + irow ; 560 spCol->put( pidx, real( sp.row(ipol) ) ) ; 561 if ( corrtype[ipol] == Stokes::XY || corrtype[ipol] == Stokes::RL ) 562 spCol->put( pidx+nrow, imag( sp.row(ipol) ) ) ; 563 else 564 spCol->put( pidx+nrow, imag( conj(sp.row(ipol)) ) ) ; 460 565 } 461 spCol.putColumnCells( rows, imag( data ) ) ; 462 flagCol.putColumnCells( rows, flagtra ) ; 463 crossOK = True ; 464 oldnr = newnr ; 566 } 567 else { 568 spCol->put( prevnr+ipol*nrow+irow, real( sp.row(ipol) ) ) ; 465 569 } 466 570 } 467 else { 468 table_->table().addRow( nrow, True ) ; 469 addednr += nrow ; 470 //os_ << "table_->nrow() = " << table_->nrow() << LogIO::POST ; 471 Int newnr = oldnr + nrow ; 472 RefRows rows( oldnr, newnr-1 ) ; 473 Slice paxis( ipol, 1, 1 ) ; 474 Slice caxis( 0, cShape[1], 1 ) ; 475 Slicer slicer( paxis, caxis ) ; 476 Array<Complex> data = mDataCol.getColumn(slicer).reform(newShape) ; 477 spCol.putColumnCells( rows, real( data ) ) ; 478 Array<Bool> flags = mFlagCol.getColumn(slicer).reform(newShape) ; 479 Array<uChar> flagtra( flags.shape() ) ; 480 convertArray( flagtra, flags ) ; 481 flagCol.putColumnCells( rows, flagtra ) ; 482 oldnr = newnr ; 571 } 572 for ( Int irow = 0 ; irow < nrow ; irow++ ) { 573 Bool crossOK = False ; 574 Matrix<Bool> flb = mFlagCol( irow ) ; 575 Matrix<uChar> fl( flb.shape() ) ; 576 convertArray( fl, flb ) ; 577 for ( Int ipol = 0 ; ipol < npol ; ipol++ ) { 578 if ( corrtype[ipol] == Stokes::XY || corrtype[ipol] == Stokes::YX 579 || corrtype[ipol] == Stokes::RL || corrtype[ipol] == Stokes::LR ) { 580 if ( !crossOK ) { 581 crossOK = True ; 582 Int pidx = prevnr + ipol * nrow + irow ; 583 flCol->put( pidx, fl.row(ipol) ) ; 584 flCol->put( pidx+nrow, fl.row(ipol+1) ) ; 585 } 586 } 587 else { 588 flCol->put( prevnr+ipol*nrow+irow, fl.row(ipol) ) ; 589 } 483 590 } 484 591 } … … 495 602 RefRows rows( prevnr, prevnr+addednr-1 ) ; 496 603 497 // CYCLENO498 ScalarColumn<uInt> cyclenoCol( table_->table(), "CYCLENO" ) ;499 Vector<uInt> cycleno( nrow ) ;500 indgen( cycleno, cycle ) ;501 for ( int i = 0 ; i < addednr ; i += nrow ) {502 Int startrow = prevnr + i ;503 Int endrow = startrow + nrow - 1 ;504 RefRows prows( startrow, endrow ) ;505 cyclenoCol.putColumnCells( prows, cycleno ) ;506 }507 cycle += nrow ;508 509 // POLNO510 ScalarColumn<uInt> polNoCol( table_->table(), "POLNO" ) ;511 Vector<uInt> polno( nrow ) ;512 Int pidx = 0 ;513 Bool crossOK = False ;514 for ( int i = 0 ; i < npol ; i++ ) {515 Vector<uInt> polnos = getPolNo( corrtype[i] ) ;516 if ( polnos.size() > 1 ) {517 if ( crossOK ) continue ;518 else crossOK = True ;519 }520 for ( uInt j = 0 ; j < polnos.size() ; j++ ) {521 Int startrow = prevnr + pidx * nrow ;522 Int endrow = startrow + nrow - 1 ;523 RefRows prows( startrow, endrow ) ;524 polno = polnos[j] ;525 polNoCol.putColumnCells( prows, polno ) ;526 pidx++ ;527 }528 }529 530 // FLAGROW531 ScalarColumn<uInt> flagRowCol( table_->table(), "FLAGROW" ) ;532 ROScalarColumn<Bool> mFlagRowCol( t5, "FLAG_ROW" ) ;533 Vector<uInt> fr( nrow ) ;534 convertArray( fr, mFlagRowCol.getColumn() ) ;535 for ( int i = 0 ; i < addednr ; i += nrow ) {536 Int startrow = prevnr + i ;537 Int endrow = startrow + nrow - 1 ;538 RefRows prows( startrow, endrow ) ;539 flagRowCol.putColumnCells( prows, fr ) ;540 }541 542 604 // TIME 543 MEpoch::ScalarColumn timeCol( table_->table(), "TIME" ) ; 544 MEpoch::ROScalarColumn mTimeCol( t5, "TIME" ) ; 605 ROScalarMeasColumn<MEpoch> *mTimeCol = new ROScalarMeasColumn<MEpoch>( t5, "TIME" ) ; 545 606 Int tidx = prevnr ; 546 for ( Int i = 0 ; i < addednr ; i += nrow) {607 for ( Int i = 0 ; i < nloop ; i++ ) { 547 608 for ( Int j = 0 ; j < nrow ; j++ ) { 548 timeCol .put( tidx++, mTimeCol( j ) ) ;609 timeCol->put( tidx++, (*mTimeCol)( j ) ) ; 549 610 } 550 611 } 551 612 552 // INTERVAL553 ScalarColumn<Double> intervalCol( table_->table(), "INTERVAL" ) ;554 ROScalarColumn<Double> mIntervalCol( t5, "INTERVAL" ) ;555 Vector<Double> integ = mIntervalCol.getColumn() ;556 for ( int i = 0 ; i < addednr ; i += nrow ) {557 Int startrow = prevnr + i ;558 Int endrow = startrow + nrow - 1 ;559 RefRows prows( startrow, endrow ) ;560 intervalCol.putColumnCells( prows, integ ) ;561 }562 563 // SRCTYPE564 ScalarColumn<Int> srcTypeCol( table_->table(), "SRCTYPE" ) ;565 Vector<Int> srcType( addednr, getSrcType( stateId ) ) ;566 srcTypeCol.putColumnCells( rows, srcType ) ;567 568 613 // TSYS 569 ArrayColumn<Float> tsysCol( table_->table(), "TSYS" ) ;570 614 Vector<Double> sysCalTime ; 571 615 if ( isSysCal_ ) { 572 sysCalTime = getSysCalTime( caltabsel, mTimeCol ) ;616 sysCalTime = getSysCalTime( caltabsel, *mTimeCol ) ; 573 617 tidx = prevnr ; 574 618 uInt calidx = 0 ; 575 619 for ( Int i = 0 ; i < nrow ; i++ ) { 576 Array<Float> tsys ;620 Matrix<Float> tsys ; 577 621 calidx = getTsys( calidx, tsys, caltabsel, sysCalTime(i) ) ; 578 622 //os_ << "tsys = " << tsys << LogIO::POST ; 579 IPosition cShape = tsys.shape() ; 580 //os_ << "cShape = " << cShape << LogIO::POST ; 581 if ( cShape.size() == 0 ) { 582 cShape = IPosition( 1, npol ) ; 623 uInt ncol = tsys.ncolumn() ; 624 if ( ncol == 0 ) { 625 IPosition cShape = IPosition( 2, npol, 1 ) ; 583 626 tsys.resize( cShape ) ; 584 627 tsys = 1.0 ; 585 628 } 586 629 for ( Int ipol = 0 ; ipol < npol ; ipol++ ) { 587 if ( cShape.nelements() == 1 ) { 588 Array<Float> subtsys( IPosition(1,1), tsys(IPosition(1,ipol)) ) ; 589 tsysCol.put( prevnr+i+nrow*ipol, subtsys ) ; 590 } 591 else { 592 Slice paxis( ipol, 1, 1 ) ; 593 Slice caxis( 0, cShape[1], 1 ) ; 594 Slicer slicer( paxis, caxis ) ; 595 Array<Float> subtsys = tsys( slicer ) ; 596 tsysCol.put( prevnr+i+nrow*ipol, subtsys ) ; 597 } 630 //floatArrCol->put( prevnr+i+nrow*ipol, tsys.row( ipol ) ) ; 631 tsysCol->put( prevnr+i+nrow*ipol, tsys.row( ipol ) ) ; 598 632 } 599 633 } 600 634 } 601 635 else { 602 Array<Float> tsys( IPosition( 2, 1, addednr ), 1.0 ) ; 603 tsysCol.putColumnCells( rows, tsys ) ; 636 Vector<Float> tsys( 1, 1.0 ) ; 637 for ( Int i = prevnr ; i < prevnr+addednr ; i++ ) 638 tsysCol->put( i, tsys ) ; 604 639 } 605 640 641 642 // INTERVAL 643 tcolr = tpoolr->construct( t5, "INTERVAL" ) ; 644 //Vector<Double> integ = mIntervalCol->getColumn() ; 645 for ( int i = 0 ; i < nloop ; i++ ) { 646 //Int startrow = prevnr + i ; 647 //Int endrow = startrow + nrow - 1 ; 648 //RefRows prows( startrow, endrow ) ; 649 //intervalCol->putColumnCells( prows, integ ) ; 650 for ( int j = 0 ; j < nrow ; j++ ) { 651 intervalCol->putScalar( prevnr+i*nrow+j, (Double)(tcolr->asdouble( j )) ) ; 652 } 653 } 654 tpoolr->destroy( tcolr ) ; 655 656 // SRCTYPE 657 Int srcType = getSrcType( stateId, tpoolr ) ; 658 for ( int i = 0 ; i < addednr ; i++ ) { 659 srctypeCol->putScalar( prevnr+i, srcType ) ; 660 } 661 //Vector<Int> *srcType = new Vector<Int>( addednr, getSrcType( stateId ) ) ; 662 //srcTypeCol->putColumnCells( rows, *srcType ) ; 663 606 664 // DIRECTION, AZIMUTH, ELEVATION, SCANRATE 607 ArrayColumn<Double> dirCol( table_->table(), "DIRECTION" ) ;608 ScalarColumn<Float> azCol( table_->table(), "AZIMUTH" ) ;609 ScalarColumn<Float> elCol( table_->table(), "ELEVATION" ) ;610 ArrayColumn<Double> scanRateCol( table_->table(), "SCANRATE" ) ;611 665 Vector<Double> defaultScanrate( 2, 0.0 ) ; 612 666 uInt diridx = 0 ; … … 617 671 Vector<Double> scanrate ; 618 672 String refString ; 619 diridx = getDirection( diridx, dir, scanrate, refString, point Cols, mTimeCol(i).get("s").getValue() ) ;673 diridx = getDirection( diridx, dir, scanrate, refString, pointtab, (*mTimeCol)(i).get("s").getValue() ) ; 620 674 //os_ << "diridx = " << diridx << " dmTimeCol(" << i << ") = " << mTimeCol(i).get("s").getValue()-mTimeCol(0).get("s").getValue() << LogIO::POST ; 621 675 //os_ << "dir = " << dir << LogIO::POST ; … … 624 678 MDirection::getType( dirType, refString ) ; 625 679 //os_ << "dirType = " << dirType << LogIO::POST ; 626 mf.resetEpoch( mTimeCol(i) ) ;680 mf.resetEpoch( (*mTimeCol)(i) ) ; 627 681 mf.resetDirection( MDirection( MVDirection(dir), dirType ) ) ; 628 682 if ( refString == "J2000" ) { 629 683 //os_ << "J2000" << LogIO::POST ; 630 684 for ( Int ipol = 0 ; ipol < npol ; ipol++ ) { 631 dirCol .put( prevnr+i+nrow*ipol, dir ) ;685 dirCol->put( prevnr+i+nrow*ipol, dir ) ; 632 686 } 633 687 MDirection::Convert toazel( dirType, MDirection::Ref( MDirection::AZEL, mf ) ) ; 634 688 Vector<Double> azel = toazel( dir ).getAngle("rad").getValue() ; 635 689 for ( Int ipol = 0 ; ipol < npol ; ipol++ ) { 636 azCol .put( prevnr+i+nrow*ipol,azel(0) ) ;637 elCol .put( prevnr+i+nrow*ipol,azel(1) ) ;690 azCol->putScalar( prevnr+i+nrow*ipol, (Float)azel(0) ) ; 691 elCol->putScalar( prevnr+i+nrow*ipol, (Float)azel(1) ) ; 638 692 } 639 693 } … … 641 695 //os_ << "AZEL" << LogIO::POST ; 642 696 for ( Int ipol = 0 ; ipol < npol ; ipol++ ) { 643 azCol .put( prevnr+i+nrow*ipol,dir(0) ) ;644 elCol .put( prevnr+i+nrow*ipol,dir(1) ) ;697 azCol->putScalar( prevnr+i+nrow*ipol, (Float)dir(0) ) ; 698 elCol->putScalar( prevnr+i+nrow*ipol, (Float)dir(1) ) ; 645 699 } 646 700 MDirection::Convert toj2000( dirType, MDirection::Ref( MDirection::J2000, mf ) ) ; 647 701 Vector<Double> newdir = toj2000( dir ).getAngle("rad").getValue() ; 648 702 for ( Int ipol = 0 ; ipol < npol ; ipol++ ) { 649 dirCol .put( prevnr+i+nrow*ipol, newdir ) ;703 dirCol->put( prevnr+i+nrow*ipol, newdir ) ; 650 704 } 651 705 } … … 657 711 Vector<Double> newdir = toj2000( dir ).getAngle("rad").getValue() ; 658 712 for ( Int ipol = 0 ; ipol < npol ; ipol++ ) { 659 dirCol .put( prevnr+i+nrow*ipol, newdir ) ;660 azCol .put( prevnr+i+nrow*ipol,dir(0) ) ;661 elCol .put( prevnr+i+nrow*ipol,dir(1) ) ;713 dirCol->put( prevnr+i+nrow*ipol, newdir ) ; 714 azCol->putScalar( prevnr+i+nrow*ipol, (Float)dir(0) ) ; 715 elCol->putScalar( prevnr+i+nrow*ipol, (Float)dir(1) ) ; 662 716 } 663 717 } … … 665 719 //os_ << "scanrate.size() = " << scanrate.size() << LogIO::POST ; 666 720 for ( Int ipol = 0 ; ipol < npol ; ipol++ ) { 667 scan RateCol.put( prevnr+i+nrow*ipol, scanrate ) ;721 scanrateCol->put( prevnr+i+nrow*ipol, scanrate ) ; 668 722 } 669 723 } … … 671 725 //os_ << "scanrate.size() = " << scanrate.size() << LogIO::POST ; 672 726 for ( Int ipol = 0 ; ipol < npol ; ipol++ ) { 673 scan RateCol.put( prevnr+i+nrow*ipol, defaultScanrate ) ;727 scanrateCol->put( prevnr+i+nrow*ipol, defaultScanrate ) ; 674 728 } 675 729 } … … 678 732 else { 679 733 // All directions are set to source direction 680 ROArrayMeasColumn<MDirection> dmcol = pointCols.directionMeasCol() ;681 ROArrayColumn<Double> dcol = pointCols.direction() ;734 ROArrayMeasColumn<MDirection> dmcol( pointtab, "DIRECTION" ) ; 735 ROArrayColumn<Double> dcol( pointtab, "DIRECTION" ) ; 682 736 IPosition ip( dmcol(0).shape().nelements(), 0 ) ; 683 737 IPosition outp( 1, 2 ) ; … … 690 744 mf.resetDirection( MDirection( MVDirection(srcDir), dirType ) ) ; 691 745 if ( ref != "J2000" ) { 692 mf.resetEpoch( pointCols.timeMeas()(0) ) ; 746 ROScalarMeasColumn<MEpoch> tmCol( pointtab, "TIME" ) ; 747 mf.resetEpoch( tmCol( 0 ) ) ; 693 748 MDirection::Convert toj2000( dirType, MDirection::Ref( MDirection::J2000, mf ) ) ; 694 749 defaultDir = toj2000( defaultDir ).getAngle("rad").getValue() ; 695 750 } 696 751 for ( Int i = 0 ; i < nrow ; i++ ) { 697 mf.resetEpoch( mTimeCol(i) ) ;752 mf.resetEpoch( (*mTimeCol)(i) ) ; 698 753 for ( Int ipol = 0 ; ipol < npol ; ipol++ ) { 699 754 Int localidx = prevnr+i+nrow*ipol ; 700 755 MDirection::Convert toazel( dirType, MDirection::Ref( MDirection::AZEL, mf ) ) ; 701 756 Vector<Double> azel = toazel( defaultDir ).getAngle("rad").getValue() ; 702 azCol .put( localidx,azel(0) ) ;703 elCol .put( localidx,azel(1) ) ;704 dirCol .put( localidx, defaultDir ) ;705 scan RateCol.put( localidx, defaultScanrate ) ;757 azCol->putScalar( localidx, (Float)azel(0) ) ; 758 elCol->putScalar( localidx, (Float)azel(1) ) ; 759 dirCol->put( localidx, defaultDir ) ; 760 scanrateCol->put( localidx, defaultScanrate ) ; 706 761 } 707 762 } 708 763 } 709 764 765 // CYCLENO 766 for ( int i = 0 ; i < nloop ; i++ ) { 767 for ( int j = 0 ; j < nrow ; j++ ) { 768 cyclenoCol->putScalar( prevnr+nrow*i+j, cycle+j ) ; 769 } 770 } 771 cycle += nrow ; 772 773 // POLNO 774 Int pidx = 0 ; 775 Bool crossOK = False ; 776 for ( int i = 0 ; i < npol ; i++ ) { 777 Vector<uInt> polnos = getPolNo( corrtype[i] ) ; 778 if ( polnos.size() > 1 ) { 779 if ( crossOK ) continue ; 780 else crossOK = True ; 781 } 782 for ( uInt j = 0 ; j < polnos.size() ; j++ ) { 783 for ( Int irow = 0 ; irow < nrow ; irow++ ) { 784 polnoCol->putScalar( prevnr+pidx*nrow+irow, polnos[j] ) ; 785 } 786 pidx++ ; 787 } 788 } 789 790 // FLAGROW 791 tcolr = tpoolr->construct( t5, "FLAG_ROW" ) ; 792 for ( int i = 0 ; i < nloop ; i++ ) { 793 for ( int j = 0 ; j < nrow ; j++ ) { 794 flagrowCol->putScalar( prevnr+nrow*i+j, (uInt)(tcolr->asBool( j )) ) ; 795 } 796 } 797 tpoolr->destroy( tcolr ) ; 798 710 799 // TCAL_ID 711 ScalarColumn<uInt> tcalIdCol( table_->table(), "TCAL_ID" ) ;712 800 if ( isSysCal_ ) { 713 801 for( Int irow = 0 ; irow < nrow ; irow++ ) { … … 718 806 } 719 807 for ( Int ipol = 0 ; ipol < npol ; ipol++ ) { 720 tcalIdCol.put( prevnr+irow+nrow*ipol, tcalids[ipol] ) ;808 tcalidCol->putScalar( prevnr+irow+nrow*ipol, tcalids[ipol] ) ; 721 809 } 722 810 } 723 811 } 724 812 else { 725 Vector<uInt> tcalid( addednr, 0 ) ; 726 tcalIdCol.putColumnCells( rows, tcalid ) ; 813 //Vector<uInt> tcalid( addednr, 0 ) ; 814 //uIntCol->putColumnCells( rows, tcalid ) ; 815 uInt tcalid = 0 ; 816 for ( Int irow = 0 ; irow < addednr ; irow++ ) 817 tcalidCol->putScalar( prevnr+irow, tcalid ) ; 727 818 } 728 819 729 820 // WEATHER_ID 730 uInt widprev = 0 ;731 Vector<uInt> vWid( nrow, 0 ) ;732 821 if ( isWeather_ ) { 733 for ( int j = 0 ; j < nrow ; j++ ) {734 //os_ << "TIME value = " << mTimeCol( j ).get("s").getValue() << LogIO::POST ;735 uInt wid = getWeatherId( widprev, mTimeCol( j).get("s").getValue() ) ;736 //os_ << "wid = " << wid << LogIO::POST ;737 vWid[j] = wid;738 widprev = wid ;822 uInt wid = 0 ; 823 for ( Int irow = 0 ; irow < nrow ; irow++ ) { 824 wid = getWeatherId( wid, (*mTimeCol)(irow).get("s").getValue() ) ; 825 for ( Int ipol = 0 ; ipol < nloop ; ipol++ ) { 826 weatheridCol->putScalar( prevnr+ipol*nrow+irow, wid ) ; 827 } 739 828 } 740 829 } 741 830 742 ScalarColumn<uInt> weatherIdCol( table_->table(), "WEATHER_ID" ) ; 743 for ( int i = 0 ; i < addednr ; i += nrow ) { 744 Int startrow = prevnr + i ; 745 Int endrow = startrow + nrow - 1 ; 746 RefRows prows( startrow, endrow ) ; 747 weatherIdCol.putColumnCells( prows, vWid ) ; 748 } 831 delete mTimeCol ; 749 832 750 833 //os_ << "field: " << fieldId << " scan: " << scanNum << " obs: " << obsId << " state: " << stateId << " ddid: " << ddId << endl ; 751 //os_ << " t.nrow() = " << t5.nrow()<< endl ;834 //os_ << "addednr = " << addednr << endl ; 752 835 added5 += addednr ; 753 836 iter5.next() ; … … 755 838 756 839 // SCANNO 757 RefRows rows5( current5, current5+added5-1 ) ; 758 Vector<uInt> scanno( added5, scanNum ) ; 759 ScalarColumn<uInt> scannoCol( table_->table(), "SCANNO" ) ; 760 scannoCol.putColumnCells( rows5, scanno ) ; 761 840 // MS: 1-base 841 // Scantable: 0-base 842 Int dest5 = current5 + added5 ; 843 scanNum -= 1 ; 844 for ( Int irow = current5 ; irow < dest5 ; irow++ ) 845 scannoCol->putScalar( irow, (uInt)scanNum ) ; 846 847 //os_ << "added5 = " << added5 << endl ; 762 848 added4 += added5 ; 763 849 iter4.next() ; … … 765 851 766 852 // IFNO 767 RefRows rows4( current4, current4+added4-1 ) ; 768 Vector<uInt> shareduIArr( added4, spwId ) ; 769 ScalarColumn<uInt> shareduIArrCol( table_->table(), "IFNO" ) ; 770 shareduIArrCol.putColumnCells( rows4, shareduIArr ) ; 853 Int dest4 = current4 + added4 ; 854 for ( Int irow = current4 ; irow < dest4 ; irow++ ) 855 ifnoCol->putScalar( irow, (uInt)spwId ) ; 771 856 772 857 // FREQ_ID 773 shareduIArr= ifmap[spwId] ;774 shareduIArrCol.attach( table_->table(), "FREQ_ID" ) ;775 shareduIArrCol.putColumnCells( rows4, shareduIArr) ;858 uInt fid = ifmap[spwId] ; 859 for ( Int irow = current4 ; irow < dest4 ; irow++ ) 860 freqidCol->putScalar( irow, fid ) ; 776 861 777 862 // MOLECULE_ID 778 shareduIArr = molId ; 779 shareduIArrCol.attach( table_->table(), "MOLECULE_ID" ) ; 780 shareduIArrCol.putColumnCells( rows4, shareduIArr ) ; 863 for ( Int irow = current4 ; irow < dest4 ; irow++ ) 864 molidCol->putScalar( irow, molId ) ; 781 865 782 866 // SRCNAME 783 ScalarColumn<String> srcNameCol( table_->table(), "SRCNAME" ) ; 784 Vector<String> vSrcName( added4, srcName ) ; 785 srcNameCol.putColumnCells( rows4, vSrcName ) ; 867 for ( Int irow = current4 ; irow < dest4 ; irow++ ) 868 srcnameCol->putScalar( irow, srcName ) ; 786 869 787 870 // SRCVELOCITY, SRCPROPERMOTION and SRCDIRECTION 788 871 // no reference conversion for direction at the moment (assume J2000) 789 872 // no reference conversion for velocity at the moment (assume LSRK) 790 Matrix<Double> sharedDArr( 2, added4 ) ; 791 for ( uInt icol = 0 ; icol < added4 ; icol++ ) { 792 sharedDArr.column(icol) = srcPM ; 793 } 794 ArrayColumn<Double> sharedDArrCol( table_->table(), "SRCPROPERMOTION" ) ; 795 sharedDArrCol.putColumnCells( rows4, sharedDArr ) ; 796 for ( uInt icol = 0 ; icol < added4 ; icol++ ) { 797 sharedDArr.column(icol) = srcDir ; 798 } 799 sharedDArrCol.attach( table_->table(), "SRCDIRECTION" ) ; 800 sharedDArrCol.putColumnCells( rows4, sharedDArr ) ; 801 ScalarColumn<Double> sysVelCol( table_->table(), "SRCVELOCITY" ) ; 802 Vector<Double> sysVelArr( added4, sysVel ) ; 803 sysVelCol.putColumnCells( rows4, sysVelArr ) ; 804 873 for ( Int irow = current4 ; irow < dest4 ; irow++ ) 874 srcpmCol->put( irow, srcPM ) ; 875 for ( Int irow = current4 ; irow < dest4 ; irow++ ) 876 srcdirCol->put( irow, srcDir ) ; 877 for ( Int irow = current4 ; irow < dest4 ; irow++ ) 878 srcvelCol->putScalar( irow, sysVel ) ; 879 880 //os_ << "added4 = " << added4 << endl ; 805 881 added3 += added4 ; 806 882 iter3.next() ; … … 808 884 809 885 // FIELDNAME 810 RefRows rows3( current3, current3+added3-1 );811 Vector<String> vFieldName( added3, fieldName ) ;812 ScalarColumn<String> fieldNameCol( table_->table(), "FIELDNAME") ;813 fieldNameCol.putColumnCells( rows3, vFieldName ) ; 814 886 Int dest3 = current3 + added3 ; 887 for ( Int irow = current3 ; irow < dest3 ; irow++ ) 888 fieldnameCol->putScalar( irow, fieldName ) ; 889 890 //os_ << "added3 = " << added3 << endl ; 815 891 added2 += added3 ; 816 892 iter2.next() ; … … 818 894 819 895 // BEAMNO 820 RefRows rows2( current2, current2+added2-1 ) ; 821 Vector<uInt> beamno( added2, feedId ) ; 822 ScalarColumn<uInt> beamnoCol( table_->table(), "BEAMNO" ) ; 823 beamnoCol.putColumnCells( rows2, beamno ) ; 896 Int dest2 = current2 + added2 ; 897 for ( Int irow = current2 ; irow < dest2 ; irow++ ) 898 beamnoCol->putScalar( irow, (uInt)feedId ) ; 824 899 825 900 // FOCUS_ID 826 901 // tentative 827 beamnoCol.attach( table_->table(), "FOCUS_ID" ) ; 828 beamno = 0 ; 829 beamnoCol.putColumnCells( rows2, beamno ) ; 830 902 uInt focusId = 0 ; 903 for ( Int irow = current2 ; irow < dest2 ; irow++ ) 904 focusidCol->putScalar( irow, focusId ) ; 905 906 //os_ << "added2 = " << added2 << endl ; 831 907 added1 += added2 ; 832 908 iter1.next() ; … … 834 910 if ( sdh.nbeam < nbeam ) sdh.nbeam = nbeam ; 835 911 912 //os_ << "added1 = " << added1 << endl ; 836 913 added0 += added1 ; 837 914 iter0.next() ; 838 915 } 839 916 917 //os_ << "added0 = " << added0 << endl ; 918 840 919 // REFBEAMNO 841 920 // set 0 at the moment 842 ScalarColumn<Int> sharedICol( table_->table(), "REFBEAMNO" ) ; 843 Vector<Int> sharedI( added0, 0 ) ; 844 sharedICol.putColumn( sharedI ) ; 921 tcolw = tpoolw->construct( table_->table(), "REFBEAMNO" ) ; 922 for ( Int irow = current0 ; irow < added0 ; irow++ ) 923 tcolw->putScalar( irow, 0 ) ; 924 tpoolw->destroy( tcolw ) ; 925 926 // FIT_ID 927 // nothing to do 928 tcolw = tpoolw->construct( table_->table(), "FIT_ID" ) ; 929 for ( Int irow = current0 ; irow < added0 ; irow++ ) 930 tcolw->putScalar( irow, -1 ) ; 931 tpoolw->destroy( tcolw ) ; 845 932 846 933 // OPACITY 847 934 // not used? 848 ScalarColumn<Float> opacityCol( table_->table(), "OPACITY" ) ; 849 Vector<Float> opacity( added0, 0.0 ) ; 850 opacityCol.putColumn( opacity ) ; 851 852 // FIT_ID 853 // nothing to do 854 sharedICol.attach( table_->table(), "FIT_ID" ) ; 855 sharedI = -1 ; 856 sharedICol.putColumn( sharedI ) ; 935 tcolw = tpoolw->construct( table_->table(), "OPACITY" ) ; 936 for ( Int irow = current0 ; irow < added0 ; irow++ ) 937 tcolw->putScalar( irow, 0.0 ) ; 938 tpoolw->destroy( tcolw ) ; 939 940 // delete Scantable columns 941 tpoolw->destroy( scannoCol ) ; 942 tpoolw->destroy( cyclenoCol ) ; 943 tpoolw->destroy( beamnoCol ) ; 944 tpoolw->destroy( ifnoCol ) ; 945 tpoolw->destroy( polnoCol ) ; 946 tpoolw->destroy( freqidCol ) ; 947 tpoolw->destroy( molidCol ) ; 948 tpoolw->destroy( flagrowCol ) ; 949 delete timeCol ; 950 tpoolw->destroy( intervalCol ) ; 951 tpoolw->destroy( srcnameCol ) ; 952 tpoolw->destroy( srctypeCol ) ; 953 tpoolw->destroy( fieldnameCol ) ; 954 delete spCol ; 955 delete flCol ; 956 delete tsysCol ; 957 delete dirCol ; 958 tpoolw->destroy( azCol ) ; 959 tpoolw->destroy( elCol ) ; 960 tpoolw->destroy( tcalidCol ) ; 961 tpoolw->destroy( focusidCol ) ; 962 tpoolw->destroy( weatheridCol ) ; 963 delete srcpmCol ; 964 delete srcdirCol ; 965 tpoolw->destroy( srcvelCol ) ; 966 delete scanrateCol ; 967 968 delete tpoolr ; 969 delete tpoolw ; 857 970 858 971 859 972 // Table Keywords 860 973 sdh.nif = ifmap.size() ; 861 String antennaName = antCols.name()(antenna_) ; 862 if ( antennaName == telescopeName ) { 974 if ( ( telescopeName == "" ) || ( antennaName == telescopeName ) ) { 863 975 sdh.antennaname = antennaName ; 864 976 } … … 869 981 sdh.antennaname += "@" + stationName ; 870 982 } 871 sdh.antennaposition = antCols.position()(antenna_); 872 ROMSPointingColumns pointingCols( mstable_.pointing() ) ; 873 String dirref = pointingCols.direction().keywordSet().asRecord("MEASINFO").asString("Ref") ; 983 ROArrayColumn<Double> pdirCol( pointtab, "DIRECTION" ) ; 984 String dirref = pdirCol.keywordSet().asRecord("MEASINFO").asString("Ref") ; 874 985 if ( dirref == "AZELGEO" || dirref == "AZEL" ) { 875 986 dirref = "J2000" ; … … 893 1004 } 894 1005 table_->setHeader( sdh ) ; 1006 1007 // save path to POINTING table 1008 //Path datapath(mstable_.tableName()) ; 1009 Path datapath( tablename_ ) ; 1010 String pTabName = datapath.absoluteName() + "/POINTING" ; 1011 table_->table().rwKeywordSet().define( "POINTING", pTabName ) ; 1012 1013 // for GBT 1014 if ( antennaName == "GBT" ) { 1015 String goTabName = datapath.absoluteName() + "/GBT_GO" ; 1016 table_->table().rwKeywordSet().define( "GBT_GO", goTabName ) ; 1017 } 1018 //os_ << "end MSFiller::fill()" << LogIO::POST ; 895 1019 } 896 1020 897 1021 void MSFiller::close() 898 1022 { 899 tablesel_.closeSubTables() ;1023 //tablesel_.closeSubTables() ; 900 1024 mstable_.closeSubTables() ; 901 tablesel_.unlock() ;1025 //tablesel_.unlock() ; 902 1026 mstable_.unlock() ; 903 1027 } 904 1028 905 void MSFiller::fillId( uInt idx, const char *colname, RefRows &rows ) 1029 Int MSFiller::getSrcType( Int stateId, boost::object_pool<ROTableColumn> *tpool ) 906 1030 { 907 ScalarColumn<uInt> col( table_->table(), colname ) ; 908 Vector<uInt> ids( rows.nrow(), idx ) ; 909 col.putColumnCells( rows, ids ) ; 910 } 911 912 void MSFiller::fillId( Int idx, const char *colname, RefRows &rows ) 913 { 914 ScalarColumn<Int> col( table_->table(), colname ) ; 915 Vector<Int> ids( rows.nrow(), idx ) ; 916 col.putColumnCells( rows, ids ) ; 917 } 918 919 Int MSFiller::getSrcType( Int stateId ) 920 { 1031 //os_ << "start MSFiller::getSrcType()" << LogIO::POST ; 1032 921 1033 MSState statetab = mstable_.state() ; 922 ROScalarColumn<String> obsModeCol( statetab, "OBS_MODE" ) ; 923 String obsMode = obsModeCol( stateId ) ; 924 ROScalarColumn<Bool> sigCol( statetab, "SIG" ) ; 925 ROScalarColumn<Bool> refCol( statetab, "REF" ) ; 926 Bool sig = sigCol( stateId ) ; 927 Bool ref = refCol( stateId ) ; 1034 ROTableColumn *sharedCol ; 1035 sharedCol = tpool->construct( statetab, "OBS_MODE" ) ; 1036 String obsMode = sharedCol->asString( stateId ) ; 1037 tpool->destroy( sharedCol ) ; 1038 sharedCol = tpool->construct( statetab, "SIG" ) ; 1039 Bool sig = sharedCol->asBool( stateId ) ; 1040 tpool->destroy( sharedCol ) ; 1041 sharedCol = tpool->construct( statetab, "REF" ) ; 1042 Bool ref = sharedCol->asBool( stateId ) ; 1043 tpool->destroy( sharedCol ) ; 1044 sharedCol = tpool->construct( statetab, "CAL" ) ; 1045 Double cal = (Double)(sharedCol->asdouble( stateId )) ; 1046 tpool->destroy( sharedCol ) ; 928 1047 //os_ << "OBS_MODE = " << obsMode << LogIO::POST ; 929 1048 … … 953 1072 // SIG=1: FSON 954 1073 // REF=1: FSOFF 1074 // Calibration scan if CAL != 0 955 1075 Int epos = obsMode.find_first_of( sep ) ; 956 1076 Int nextpos = obsMode.find_first_of( sep, epos+1 ) ; … … 969 1089 if ( ref ) srcType = SrcType::FSOFF ; 970 1090 } 1091 } 1092 if ( cal > 0.0 ) { 1093 if ( srcType == SrcType::NOD ) 1094 srcType = SrcType::NODCAL ; 1095 else if ( srcType == SrcType::PSON ) 1096 srcType = SrcType::PONCAL ; 1097 else if ( srcType == SrcType::PSOFF ) 1098 srcType = SrcType::POFFCAL ; 1099 else if ( srcType == SrcType::FSON ) 1100 srcType = SrcType::FONCAL ; 1101 else if ( srcType == SrcType::FSOFF ) 1102 srcType = SrcType::FOFFCAL ; 1103 else 1104 srcType = SrcType::CAL ; 971 1105 } 972 1106 } … … 1001 1135 1002 1136 //os_ << "srcType = " << srcType << LogIO::POST ; 1003 1137 //os_ << "end MSFiller::getSrcType()" << LogIO::POST ; 1004 1138 return srcType ; 1005 1139 } … … 1007 1141 Vector<uInt> MSFiller::getPolNo( Int corrType ) 1008 1142 { 1143 //os_ << "start MSFiller::getPolNo()" << LogIO::POST ; 1009 1144 Vector<uInt> polno( 1 ) ; 1010 1145 … … 1036 1171 } 1037 1172 //os_ << "polno = " << polno << LogIO::POST ; 1173 //os_ << "end MSFiller::getPolNo()" << LogIO::POST ; 1038 1174 1039 1175 return polno ; … … 1042 1178 String MSFiller::getPolType( Int corrType ) 1043 1179 { 1180 //os_ << "start MSFiller::getPolType()" << LogIO::POST ; 1044 1181 String poltype = "" ; 1045 1182 … … 1053 1190 poltype = "linpol" ; 1054 1191 1192 //os_ << "end MSFiller::getPolType()" << LogIO::POST ; 1055 1193 return poltype ; 1056 1194 } … … 1058 1196 void MSFiller::fillWeather() 1059 1197 { 1060 MSWeather mWeather( mstable_.weather() ) ; 1061 MSWeather mWeatherSel( mWeather( mWeather.col("ANTENNA_ID") == antenna_ ).sort("TIME") ) ; 1198 //os_ << "start MSFiller::fillWeather()" << LogIO::POST ; 1199 Table mWeather = mstable_.weather() ; 1200 //Table mWeatherSel = mWeather( mWeather.col("ANTENNA_ID") == antenna_ ).sort("TIME") ; 1201 Table mWeatherSel( mWeather( mWeather.col("ANTENNA_ID") == antenna_ ).sort("TIME") ) ; 1062 1202 //os_ << "mWeatherSel.nrow() = " << mWeatherSel.nrow() << LogIO::POST ; 1063 1203 if ( mWeatherSel.nrow() == 0 ) { 1064 1204 os_ << "No rows with ANTENNA_ID = " << antenna_ << ", Try -1..." << LogIO::POST ; 1065 mWeatherSel = MSWeather( mWeather( mWeather.col("ANTENNA_ID") == -1) ) ;1205 mWeatherSel = Table( MSWeather( mWeather( mWeather.col("ANTENNA_ID") == -1 ) ) ) ; 1066 1206 if ( mWeatherSel.nrow() == 0 ) { 1067 1207 os_ << "No rows in WEATHER table" << LogIO::POST ; 1068 1208 } 1069 1209 } 1070 ROMSWeatherColumns mWeatherCols( mWeatherSel ) ; 1071 Int wnrow = mWeatherCols.nrow() ; 1210 uInt wnrow = mWeatherSel.nrow() ; 1072 1211 //os_ << "wnrow = " << wnrow << LogIO::POST ; 1073 1212 … … 1078 1217 wtab.addRow( wnrow ) ; 1079 1218 1080 ScalarColumn<Float> tempCol( wtab, "TEMPERATURE" ) ; 1081 tempCol.putColumn( mWeatherCols.temperature() ) ; 1082 ScalarColumn<Float> pressCol( wtab, "PRESSURE" ) ; 1083 pressCol.putColumn( mWeatherCols.pressure() ) ; 1084 ScalarColumn<Float> humCol( wtab, "HUMIDITY" ) ; 1085 humCol.putColumn( mWeatherCols.relHumidity() ) ; 1086 ScalarColumn<Float> windVelCol( wtab, "WINDSPEED" ) ; 1087 windVelCol.putColumn( mWeatherCols.windSpeed() ) ; 1088 ScalarColumn<Float> windDirCol( wtab, "WINDAZ" ) ; 1089 windDirCol.putColumn( mWeatherCols.windDirection() ) ; 1090 Vector<uInt> ids( wnrow ) ; 1091 indgen( ids ) ; 1219 ScalarColumn<Float> *fCol ; 1220 ROScalarColumn<Float> *sharedFloatCol ; 1221 if ( mWeatherSel.tableDesc().isColumn( "TEMPERATURE" ) ) { 1222 fCol = new ScalarColumn<Float>( wtab, "TEMPERATURE" ) ; 1223 sharedFloatCol = new ROScalarColumn<Float>( mWeatherSel, "TEMPERATURE" ) ; 1224 fCol->putColumn( *sharedFloatCol ) ; 1225 delete sharedFloatCol ; 1226 delete fCol ; 1227 } 1228 if ( mWeatherSel.tableDesc().isColumn( "PRESSURE" ) ) { 1229 fCol = new ScalarColumn<Float>( wtab, "PRESSURE" ) ; 1230 sharedFloatCol = new ROScalarColumn<Float>( mWeatherSel, "PRESSURE" ) ; 1231 fCol->putColumn( *sharedFloatCol ) ; 1232 delete sharedFloatCol ; 1233 delete fCol ; 1234 } 1235 if ( mWeatherSel.tableDesc().isColumn( "REL_HUMIDITY" ) ) { 1236 fCol = new ScalarColumn<Float>( wtab, "HUMIDITY" ) ; 1237 sharedFloatCol = new ROScalarColumn<Float>( mWeatherSel, "REL_HUMIDITY" ) ; 1238 fCol->putColumn( *sharedFloatCol ) ; 1239 delete sharedFloatCol ; 1240 delete fCol ; 1241 } 1242 if ( mWeatherSel.tableDesc().isColumn( "WIND_SPEED" ) ) { 1243 fCol = new ScalarColumn<Float>( wtab, "WINDSPEED" ) ; 1244 sharedFloatCol = new ROScalarColumn<Float>( mWeatherSel, "WIND_SPEED" ) ; 1245 fCol->putColumn( *sharedFloatCol ) ; 1246 delete sharedFloatCol ; 1247 delete fCol ; 1248 } 1249 if ( mWeatherSel.tableDesc().isColumn( "WIND_DIRECTION" ) ) { 1250 fCol = new ScalarColumn<Float>( wtab, "WINDAZ" ) ; 1251 sharedFloatCol = new ROScalarColumn<Float>( mWeatherSel, "WIND_DIRECTION" ) ; 1252 fCol->putColumn( *sharedFloatCol ) ; 1253 delete sharedFloatCol ; 1254 delete fCol ; 1255 } 1092 1256 ScalarColumn<uInt> idCol( wtab, "ID" ) ; 1093 idCol.putColumn( ids ) ; 1094 1095 String tUnit = mWeatherCols.timeQuant().getUnits() ; 1096 mwTime_ = mWeatherCols.time().getColumn() ; 1257 for ( uInt irow = 0 ; irow < wnrow ; irow++ ) 1258 idCol.put( irow, irow ) ; 1259 1260 ROScalarQuantColumn<Double> tqCol( mWeatherSel, "TIME" ) ; 1261 ROScalarColumn<Double> tCol( mWeatherSel, "TIME" ) ; 1262 String tUnit = tqCol.getUnits() ; 1263 mwTime_ = tCol.getColumn() ; 1097 1264 if ( tUnit == "d" ) 1098 1265 mwTime_ *= 86400.0 ; 1099 String iUnit = mWeatherCols.intervalQuant().getUnits() ; 1100 mwInterval_ = mWeatherCols.interval().getColumn() ; 1266 tqCol.attach( mWeatherSel, "INTERVAL" ) ; 1267 tCol.attach( mWeatherSel, "INTERVAL" ) ; 1268 String iUnit = tqCol.getUnits() ; 1269 mwInterval_ = tCol.getColumn() ; 1101 1270 if ( iUnit == "d" ) 1102 1271 mwInterval_ *= 86400.0 ; 1103 1272 //os_ << "mwTime[0] = " << mwTime_[0] << " mwInterval[0] = " << mwInterval_[0] << LogIO::POST ; 1273 //os_ << "end MSFiller::fillWeather()" << LogIO::POST ; 1104 1274 } 1105 1275 1106 1276 void MSFiller::fillFocus() 1107 1277 { 1278 //os_ << "start MSFiller::fillFocus()" << LogIO::POST ; 1108 1279 // tentative 1109 1280 Table tab = table_->focus().table() ; … … 1111 1282 ScalarColumn<uInt> idCol( tab, "ID" ) ; 1112 1283 idCol.put( 0, 0 ) ; 1284 //os_ << "end MSFiller::fillFocus()" << LogIO::POST ; 1113 1285 } 1114 1286 1115 void MSFiller::fillTcal( )1287 void MSFiller::fillTcal( boost::object_pool<ROTableColumn> *tpool ) 1116 1288 { 1117 MSSysCal sctab = mstable_.sysCal() ; 1289 //os_ << "start MSFiller::fillTcal()" << LogIO::POST ; 1290 1291 //MSSysCal sctab = mstable_.sysCal() ; 1292 Table sctab = mstable_.sysCal() ; 1118 1293 if ( sctab.nrow() == 0 ) { 1119 1294 os_ << "No SysCal rows" << LogIO::POST ; … … 1121 1296 } 1122 1297 Bool isSp = sctab.tableDesc().isColumn( "TCAL_SPECTRUM" ) ; 1123 MSSysCal sctabsel( sctab( sctab.col("ANTENNA_ID") == antenna_ ) ) ; 1298 //MSSysCal sctabsel = sctab( sctab.col("ANTENNA_ID") == antenna_ ) ; 1299 //Table sctabsel = sctab( sctab.col("ANTENNA_ID") == antenna_ ) ; 1300 Table sctabsel( sctab( sctab.col("ANTENNA_ID") == antenna_ ) ) ; 1124 1301 if ( sctabsel.nrow() == 0 ) { 1125 1302 os_ << "No SysCal rows" << LogIO::POST ; 1126 1303 return ; 1127 1304 } 1128 ROArrayColumn<Float> tmpTcalCol( sctabsel, "TCAL" ) ; 1129 uInt npol = tmpTcalCol.shape( 0 )(0) ; 1305 ROArrayColumn<Float> *tmpTcalCol = new ROArrayColumn<Float>( sctabsel, "TCAL" ) ; 1306 uInt npol = tmpTcalCol->shape( 0 )(0) ; 1307 delete tmpTcalCol ; 1130 1308 //os_ << "fillTcal(): npol = " << npol << LogIO::POST ; 1131 1309 Table tab = table_->tcal().table() ; … … 1133 1311 ScalarColumn<String> timeCol( tab, "TIME" ) ; 1134 1312 ArrayColumn<Float> tcalCol( tab, "TCAL" ) ; 1313 ROTableColumn *sharedCol ; 1135 1314 uInt oldnr = 0 ; 1136 1315 uInt newnr = 0 ; 1137 1316 TableIterator iter0( sctabsel, "FEED_ID" ) ; 1138 // Record for TCAL_ID1139 // "FIELD0": "SPW0": Vector<uInt>1140 // "SPW1": Vector<uInt>1141 // ...1142 1317 while( !iter0.pastEnd() ) { 1143 MSSysCal t0( iter0.table() ) ; 1144 ROScalarColumn<Int> feedIdCol( t0, "FEED_ID" ) ; 1145 Int feedId = feedIdCol( 0 ) ; 1318 Table t0 = iter0.table() ; 1319 sharedCol = tpool->construct( t0, "FEED_ID" ) ; 1320 Int feedId = sharedCol->asInt( 0 ) ; 1321 tpool->destroy( sharedCol ) ; 1146 1322 String ffield = "FEED" + String::toString( feedId ) ; 1147 1323 Record rec ; … … 1150 1326 MSSysCal t1( iter1.table().sort("TIME") ) ; 1151 1327 uInt nrow = t1.nrow() ; 1152 ROMSSysCalColumns scCols( t1 ) ; 1153 Int spwId = scCols.spectralWindowId()(0) ; 1328 sharedCol = tpool->construct( t1, "SPECTRAL_WINDOW_ID" ) ; 1329 Int spwId = sharedCol->asInt( 0 ) ; 1330 tpool->destroy( sharedCol ) ; 1154 1331 String spwfield = "SPW" + String::toString( spwId ) ; 1155 ROScalarQuantColumn<Double> scTimeCol = scCols.timeQuant() ;1332 ROScalarQuantColumn<Double> scTimeCol( t1, "TIME" ) ; 1156 1333 ROArrayColumn<Float> scTcalCol ; 1157 1334 IPosition newShape( 2, 1, nrow ) ; 1158 1335 if ( isSp ) { 1159 scTcalCol. reference( scCols.tcalSpectrum()) ;1336 scTcalCol.attach( t1, "TCAL_SPECTRUM" ) ; 1160 1337 newShape[0] = scTcalCol.shape(0)(1) ; 1161 1338 } 1162 1339 else { 1163 scTcalCol. reference( scCols.tcal()) ;1340 scTcalCol.attach( t1, "TCAL" ) ; 1164 1341 } 1165 Vector<uInt> idx( nrow) ;1166 Vector<String> sTime( nrow );1342 tab.addRow( nrow*npol ) ; 1343 newnr += nrow*npol ; 1167 1344 for ( uInt irow = 0 ; irow < nrow ; irow++ ) { 1168 sTime[irow] = MVTime( scTimeCol(irow) ).string(MVTime::YMD) ; 1345 String sTime = MVTime( scTimeCol(irow) ).string( MVTime::YMD ) ; 1346 for ( uInt ipol = 0 ; ipol < npol ; ipol++ ) { 1347 timeCol.put( oldnr+irow+ipol*nrow, sTime ) ; 1348 } 1349 } 1350 uInt idx = oldnr ; 1351 for ( uInt ipol = 0 ; ipol < npol ; ipol++ ) { 1352 for ( uInt irow = 0 ; irow < nrow ; irow++ ) { 1353 idCol.put( oldnr+ipol*nrow+irow, idx++ ) ; 1354 } 1169 1355 } 1170 1356 Vector<uInt> idminmax( 2, oldnr ) ; 1171 for ( uInt ipol = 0 ; ipol < npol ; ipol++ ) { 1172 tab.addRow( nrow ) ; 1173 newnr += nrow ; 1174 RefRows rows( oldnr, newnr-1 ) ; 1175 indgen( idx, oldnr ) ; 1176 idCol.putColumnCells( rows, idx ) ; 1177 timeCol.putColumnCells( rows, sTime ) ; 1178 Slicer slicer ; 1179 if ( isSp ) { 1180 Slice paxis( ipol, 1, 1 ) ; 1181 Slice caxis( 0, newShape[0], 1 ) ; 1182 slicer = Slicer( paxis, caxis ) ; 1357 for ( uInt irow = 0 ; irow < nrow ; irow++ ) { 1358 Matrix<Float> subtcal = scTcalCol( irow ) ; 1359 for ( uInt ipol = 0 ; ipol < npol ; ipol++ ) { 1360 tcalCol.put( oldnr+ipol*nrow+irow, subtcal.row( ipol ) ) ; 1183 1361 } 1184 else {1185 Slice paxis( ipol, 1, 1 ) ;1186 slicer = Slicer( paxis ) ;1187 }1188 Array<Float> subtcal = scTcalCol.getColumn( slicer ).reform( newShape ) ;1189 tcalCol.putColumnCells( rows, subtcal ) ;1190 oldnr += nrow ;1191 1362 } 1192 1363 idminmax[1] = newnr - 1 ; 1364 oldnr = newnr ; 1193 1365 rec.define( spwfield, idminmax ) ; 1194 1366 iter1++ ; … … 1198 1370 } 1199 1371 1372 1200 1373 //tcalrec_.print( std::cout ) ; 1374 //os_ << "end MSFiller::fillFocus()" << LogIO::POST ; 1201 1375 } 1202 1203 // void MSFiller::fillMolecules()1204 // {1205 // os_ << "MSFiller::fillMolecules()" << LogIO::POST ;1206 // // tentative1207 // Table tab = table_->molecules().table() ;1208 // tab.addRow( 1 ) ;1209 // ScalarColumn<uInt> idCol( tab, "ID" ) ;1210 // idCol.put( 0, 0 ) ;1211 // }1212 1213 // void MSFiller::fillFit()1214 // {1215 // os_ << "MSFiller::fillFit()" << LogIO::POST ;1216 // // tentative1217 // Table tab = table_->fit().table() ;1218 // tab.addRow( 1 ) ;1219 // ScalarColumn<uInt> idCol( tab, "ID" ) ;1220 // idCol.put( 0, 0 ) ;1221 // }1222 1223 // void MSFiller::fillFrequencies()1224 // {1225 // os_ << "MSFiller::fillFrequencies()" << LogIO::POST ;1226 // // tentative1227 // Table tab = table_->frequencies().table() ;1228 // tab.addRow( 1 ) ;1229 // ScalarColumn<uInt> idCol( tab, "ID" ) ;1230 // idCol.put( 0, 0 ) ;1231 // }1232 1233 // void MSFiller::fillHistory()1234 // {1235 // os_ << "MSFiller::fillHistory()" << LogIO::POST ;1236 // // tentative1237 // Table tab = table_->history().table() ;1238 // tab.addRow( 1 ) ;1239 // ScalarColumn<uInt> idCol( tab, "ID" ) ;1240 // idCol.put( 0, 0 ) ;1241 // }1242 1376 1243 1377 uInt MSFiller::getWeatherId( uInt idx, Double wtime ) 1244 1378 { 1379 //os_ << "start MSFiller::getWeatherId()" << LogIO::POST ; 1245 1380 uInt nrow = mwTime_.size() ; 1246 1381 if ( nrow == 0 ) … … 1271 1406 //os_ << LogIO::WARN << "Couldn't find correct WEATHER_ID for time " << wtime << LogIO::POST ; 1272 1407 1408 //os_ << "end MSFiller::getWeatherId()" << LogIO::POST ; 1273 1409 return wid ; 1274 1410 } … … 1276 1412 Vector<Double> MSFiller::getSysCalTime( MSSysCal &tab, MEpoch::ROScalarColumn &tcol ) 1277 1413 { 1414 //os_ << "start MSFiller::getSysCalTime()" << LogIO::POST ; 1278 1415 uInt nrow = tcol.table().nrow() ; 1279 1416 Vector<Double> tstr( nrow, -1.0 ) ; … … 1281 1418 return tstr ; 1282 1419 uInt scnrow = tab.nrow() ; 1283 ROMSSysCalColumns sysCalCols( tab ) ; 1284 ROScalarMeasColumn<MEpoch> scTimeCol = sysCalCols.timeMeas() ; 1285 ROScalarQuantColumn<Double> scIntervalCol = sysCalCols.intervalQuant() ; 1420 ROScalarMeasColumn<MEpoch> scTimeCol( tab, "TIME" ) ; 1421 ROScalarQuantColumn<Double> scIntervalCol( tab, "INTERVAL" ) ; 1286 1422 uInt idx = 0 ; 1287 1423 const Double half = 0.5e0 ; … … 1306 1442 } 1307 1443 } 1444 //os_ << "end MSFiller::getSysCalTime()" << LogIO::POST ; 1308 1445 return tstr ; 1309 1446 } 1310 1447 1311 uInt MSFiller::getTsys( uInt idx, Array<Float> &tsys, MSSysCal &tab, Double t )1448 uInt MSFiller::getTsys( uInt idx, Matrix<Float> &tsys, MSSysCal &tab, Double t ) 1312 1449 { 1450 //os_ << "start MSFiller::getTsys()" << LogIO::POST ; 1313 1451 uInt nrow = tab.nrow() ; 1314 1452 if ( nrow == 0 ) { … … 1318 1456 } 1319 1457 Bool isSp = tab.tableDesc().isColumn( "TSYS_SPECTRUM" ) ; 1320 ROMSSysCalColumns calCols( tab ) ; 1321 ROScalarMeasColumn<MEpoch> scTimeCol = calCols.timeMeas() ; 1458 ROScalarMeasColumn<MEpoch> scTimeCol( tab, "TIME" ) ; 1322 1459 ROArrayColumn<Float> mTsysCol ; 1323 1460 if ( isSp ) { 1324 mTsysCol. reference( calCols.tsysSpectrum()) ;1461 mTsysCol.attach( tab, "TSYS_SPECTRUM" ) ; 1325 1462 } 1326 1463 else { 1327 mTsysCol. reference( calCols.tsys()) ;1464 mTsysCol.attach( tab, "TSYS" ) ; 1328 1465 } 1329 1466 for ( uInt i = idx ; i < nrow ; i++ ) { … … 1335 1472 } 1336 1473 } 1474 //os_ << "MSFiller::getTsys() idx = " << idx << " tsys = " << tsys << LogIO::POST ; 1475 //os_ << "end MSFiller::getTsys()" << LogIO::POST ; 1337 1476 return idx ; 1338 1477 } … … 1340 1479 Vector<uInt> MSFiller::getTcalId( Int fid, Int spwid, Double t ) 1341 1480 { 1481 //os_ << "start MSFiller::getTcalId()" << LogIO::POST ; 1342 1482 String feed = "FEED" + String::toString(fid) ; 1343 1483 String spw = "SPW" + String::toString(spwid) ; … … 1350 1490 } 1351 1491 Vector<uInt> ids = tcalrec_.asRecord(feed).asArrayuInt(spw) ; 1352 Table ttabsel = ttab( ttab.col("TIME") == sctime && ttab.col("ID") >= ids[0] && ttab.col("ID") <= ids[1] ).sort("ID") ; 1492 //Table ttabsel = ttab( ttab.col("TIME") == sctime && ttab.col("ID") >= ids[0] && ttab.col("ID") <= ids[1] ).sort("ID") ; 1493 Table ttabsel( ttab( ttab.col("TIME") == sctime && ttab.col("ID") >= ids[0] && ttab.col("ID") <= ids[1] ).sort("ID")) ; 1353 1494 uInt nrow = ttabsel.nrow() ; 1354 1495 Vector<uInt> tcalids( nrow ) ; … … 1372 1513 } 1373 1514 1515 //os_ << "end MSFiller::getTcalId()" << LogIO::POST ; 1374 1516 return tcalids ; 1375 1517 } 1376 1518 1377 uInt MSFiller::getDirection( uInt idx, Vector<Double> &dir, Vector<Double> &srate, String &ref, ROMSPointingColumns &cols, Double t )1519 uInt MSFiller::getDirection( uInt idx, Vector<Double> &dir, Vector<Double> &srate, String &ref, MSPointing &tab, Double t ) 1378 1520 { 1521 //os_ << "start MSFiller::getDirection()" << LogIO::POST ; 1379 1522 // assume that cols is sorted by TIME 1380 1523 Bool doInterp = False ; 1381 uInt nrow = cols.nrow() ; 1524 //uInt nrow = cols.nrow() ; 1525 uInt nrow = tab.nrow() ; 1382 1526 if ( nrow == 0 ) 1383 1527 return 0 ; 1384 ROScalarMeasColumn<MEpoch> tcol = cols.timeMeas() ;1385 ROArrayMeasColumn<MDirection> dmcol = cols.directionMeasCol() ;1386 ROArrayColumn<Double> dcol = cols.direction() ;1528 ROScalarMeasColumn<MEpoch> tcol( tab, "TIME" ) ; 1529 ROArrayMeasColumn<MDirection> dmcol( tab, "DIRECTION" ) ; 1530 ROArrayColumn<Double> dcol( tab, "DIRECTION" ) ; 1387 1531 // ensure that tcol(idx) < t 1388 1532 //os_ << "tcol(idx) = " << tcol(idx).get("s").getValue() << " t = " << t << " diff = " << tcol(idx).get("s").getValue()-t << endl ; … … 1414 1558 //os_ << "searched idx = " << idx << LogIO::POST ; 1415 1559 1416 Slice ds( 0, 2, 1 ) ;1417 Slice ds0( 0, 1, 1 ) ;1418 Slice ds1( 1, 1, 1 ) ;1419 Slicer dslice0( ds, ds0 ) ;1420 Slicer dslice1( ds, ds1 ) ;1421 1560 //os_ << "dmcol(idx).shape() = " << dmcol(idx).shape() << LogIO::POST ; 1422 1561 IPosition ip( dmcol(idx).shape().nelements(), 0 ) ; … … 1424 1563 ref = dmcol(idx)(ip).getRefString() ; 1425 1564 //os_ << "ref = " << ref << LogIO::POST ; 1426 IPosition outp(1,2) ;1427 1565 if ( doInterp ) { 1428 1566 //os_ << "do interpolation" << LogIO::POST ; … … 1430 1568 Double tref0 = tcol(idx).get("s").getValue() ; 1431 1569 Double tref1 = tcol(idx+1).get("s").getValue() ; 1432 Vector<Double> dir0 = dcol(idx)(dslice0).reform(outp) ; 1570 Matrix<Double> mdir0 = dcol( idx ) ; 1571 Matrix<Double> mdir1 = dcol( idx+1 ) ; 1572 Vector<Double> dir0 = mdir0.column( 0 ) ; 1433 1573 //os_ << "dir0 = " << dir0 << LogIO::POST ; 1434 Vector<Double> dir1 = dcol(idx+1)(dslice0).reform(outp) ;1574 Vector<Double> dir1 = mdir1.column( 0 ) ; 1435 1575 //os_ << "dir1 = " << dir1 << LogIO::POST ; 1436 1576 Double dt0 = t - tref0 ; 1437 1577 Double dt1 = tref1 - t ; 1438 1578 dir.reference( (dt0*dir1+dt1*dir0)/(dt0+dt1) ) ; 1439 if ( dcol(idx).shape()(1) > 1 ) { 1440 if ( dt0 >= dt1 ) { 1441 srate.reference( dcol(idx)(dslice1).reform(outp) ) ; 1442 } 1443 else { 1444 srate.reference( dcol(idx+1)(dslice1) ) ; 1445 } 1579 if ( mdir0.ncolumn() > 1 ) { 1580 if ( dt0 >= dt1 ) 1581 srate.reference( mdir0.column( 1 ) ) ; 1582 else 1583 srate.reference( mdir1.column( 1 ) ) ; 1446 1584 } 1447 1585 //os_ << "dir = " << dir << LogIO::POST ; … … 1449 1587 else { 1450 1588 //os_ << "no interpolation" << LogIO::POST ; 1451 dir.reference( dcol(idx)(dslice0).reform(outp) ) ; 1452 if ( dcol(idx).shape()(1) > 1 ) { 1453 srate.reference( dcol(idx)(dslice1).reform(outp) ) ; 1454 } 1455 } 1456 1589 Matrix<Double> mdir0 = dcol( idx ) ; 1590 dir.reference( mdir0.column( 0 ) ) ; 1591 if ( mdir0.ncolumn() > 1 ) 1592 srate.reference( mdir0.column( 1 ) ) ; 1593 } 1594 1595 //os_ << "end MSFiller::getDirection()" << LogIO::POST ; 1457 1596 return idx ; 1458 1597 } -
trunk/src/MSFiller.h
r1974 r1987 16 16 // STL 17 17 #include <string> 18 19 // Boost 20 #include <boost/pool/object_pool.hpp> 21 18 22 // AIPS++ 19 23 #include <casa/aips.h> 20 24 #include <casa/Utilities/CountedPtr.h> 21 25 #include <casa/Arrays/Vector.h> 26 #include <casa/Arrays/Matrix.h> 22 27 #include <casa/Logging/LogIO.h> 23 28 24 29 #include <casa/Containers/Record.h> 25 #include <tables/Tables/RefRows.h> 30 31 //#include <tables/Tables/TableColumn.h> 26 32 27 33 #include <ms/MeasurementSets/MeasurementSet.h> 28 #include <ms/MeasurementSets/MS Columns.h>34 #include <ms/MeasurementSets/MSPointing.h> 29 35 30 36 #include "Scantable.h" … … 59 65 //void fillHistory() ; 60 66 //void fillFit() ; 61 void fillTcal() ; 62 63 // fill ID columns 64 void fillId( casa::uInt idx, const char *colname, casa::RefRows &rows ) ; 65 void fillId( casa::Int idx, const char *colname, casa::RefRows &rows ) ; 67 void fillTcal( boost::object_pool<casa::ROTableColumn> *pool ) ; 66 68 67 69 // get SRCTYPE from STATE_ID 68 casa::Int getSrcType( casa::Int stateId ) ; 70 casa::Int getSrcType( casa::Int stateId, boost::object_pool<casa::ROTableColumn> *pool ) ; 71 //casa::Int getSrcType( casa::Int stateId ) ; 69 72 70 73 // get POLNO from CORR_TYPE … … 85 88 // assume that tab is selected by ANTENNA_ID, FEED_ID, SPECTRAL_WINDOW_ID 86 89 // and sorted by TIME 87 casa::uInt getTsys( casa::uInt idx, casa:: Array<casa::Float> &tsys, casa::MSSysCal &tab, casa::Double t ) ;90 casa::uInt getTsys( casa::uInt idx, casa::Matrix<casa::Float> &tsys, casa::MSSysCal &tab, casa::Double t ) ; 88 91 89 92 // get TCAL_ID … … 91 94 92 95 // get direction for DIRECTION, AZIMUTH, and ELEVATION columns 93 casa::uInt getDirection( casa::uInt idx, casa::Vector<casa::Double> &dir, casa::Vector<casa::Double> &srate, casa::String &ref, casa:: ROMSPointingColumns &cols, casa::Double t ) ;96 casa::uInt getDirection( casa::uInt idx, casa::Vector<casa::Double> &dir, casa::Vector<casa::Double> &srate, casa::String &ref, casa::MSPointing &tab, casa::Double t ) ; 94 97 95 98 casa::CountedPtr<Scantable> table_ ; 96 99 casa::MeasurementSet mstable_ ; 97 casa:: MeasurementSet tablesel_ ;100 casa::String tablename_ ; 98 101 casa::Int antenna_ ; 99 102 casa::Bool getPt_ ; … … 115 118 casa::Vector<casa::Double> mwInterval_ ; 116 119 120 // Record for TCAL_ID 121 // "FIELD0": "SPW0": Vector<uInt> 122 // "SPW1": Vector<uInt> 123 // ... 117 124 casa::Record tcalrec_ ; 125 126 //casa::ROTableColumn *scCol_ ; 118 127 }; 119 128 -
trunk/src/MSWriter.cpp
r1977 r1987 358 358 359 359 // SCAN_NUMBER 360 // MS: 1-based 361 // Scantable: 0-based 360 362 RefRows rows3( current3, current3+added3-1 ) ; 361 Vector<Int> scanNum( added3, scanNo ) ;363 Vector<Int> scanNum( added3, scanNo+1 ) ; 362 364 ScalarColumn<Int> scanNumCol( *mstable_, "SCAN_NUMBER" ) ; 363 365 scanNumCol.putColumnCells( rows3, scanNum ) ; -
trunk/src/Scantable.cpp
r1947 r1987 1267 1267 String out; 1268 1268 table_.keywordSet().get("AntennaName", out); 1269 String::size_type pos1 = out.find("@") ; 1270 String::size_type pos2 = out.find("//") ; 1271 if ( pos2 != String::npos ) 1272 out = out.substr(pos2+2,pos1) ; 1273 else if ( pos1 != String::npos ) 1274 out = out.substr(0,pos1) ; 1269 1275 return out; 1270 1276 }
Note:
See TracChangeset
for help on using the changeset viewer.