Changeset 1450
- Timestamp:
- 11/19/08 14:15:36 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STFiller.cpp
r1438 r1450 25 25 #include <tables/Tables/TableRow.h> 26 26 27 #include <atnf/PKSIO/PKSrecord.h> 27 28 #include <atnf/PKSIO/PKSreader.h> 28 29 #ifdef HAS_ALMA … … 193 194 Vector<Int> start(nIF_, 1); 194 195 Vector<Int> end(nIF_, 0); 195 reader_->select(beams, ifs, start, end, ref, True, haveXPol_[0] , False);196 reader_->select(beams, ifs, start, end, ref, True, haveXPol_[0]); 196 197 table_->setHeader(*header_); 197 198 //For MS, add the location of POINTING of the input MS so one get … … 226 227 int status = 0; 227 228 228 Int beamNo, IFno, refBeam, scanNo, cycleNo;229 Float azimuth, elevation, focusAxi, focusRot, focusTan,230 humidity, parAngle, pressure, temperature, windAz, windSpeed;231 Double bandwidth, freqInc, interval, mjd, refFreq, restFreq, srcVel;232 String fieldName, srcName, tcalTime, obsType;233 Vector<Float> calFctr, sigma, tcal, tsys;234 Matrix<Float> baseLin, baseSub;235 Vector<Double> direction(2), scanRate(2), srcDir(2), srcPM(2);236 Matrix<Float> spectra;237 Matrix<uChar> flagtra;238 Complex xCalFctr;239 Vector<Complex> xPol;240 229 Double min = 0.0; 241 230 Double max = nInDataRow; … … 243 232 ProgressMeter fillpm(min, max, "Data importing progress"); 244 233 #endif 234 PKSrecord pksrec; 245 235 int n = 0; 246 236 while ( status == 0 ) { 247 status = reader_->read(scanNo, cycleNo, mjd, interval, fieldName, 248 srcName, srcDir, srcPM, srcVel, obsType, IFno, 249 refFreq, bandwidth, freqInc, restFreq, tcal, tcalTime, 250 azimuth, elevation, parAngle, focusAxi, 251 focusTan, focusRot, temperature, pressure, 252 humidity, windSpeed, windAz, refBeam, 253 beamNo, direction, scanRate, 254 tsys, sigma, calFctr, baseLin, baseSub, 255 spectra, flagtra, xCalFctr, xPol); 237 status = reader_->read(pksrec); 256 238 if ( status != 0 ) break; 257 239 n += 1; … … 259 241 Regex filterrx(".*[SL|PA]$"); 260 242 Regex obsrx("^AT.+"); 261 if ( header_->antennaname.matches(obsrx) && obsType.matches(filterrx)) { 243 if ( header_->antennaname.matches(obsrx) && 244 pksrec.obsType.matches(filterrx)) { 262 245 //cerr << "ignoring paddle scan" << endl; 263 246 continue; … … 267 250 // fields that don't get used and are just passed through asap 268 251 RecordFieldPtr<Array<Double> > srateCol(rec, "SCANRATE"); 269 *srateCol = scanRate;252 *srateCol = pksrec.scanRate; 270 253 RecordFieldPtr<Array<Double> > spmCol(rec, "SRCPROPERMOTION"); 271 *spmCol = srcPM;254 *spmCol = pksrec.srcPM; 272 255 RecordFieldPtr<Array<Double> > sdirCol(rec, "SRCDIRECTION"); 273 *sdirCol = srcDir;256 *sdirCol = pksrec.srcDir; 274 257 RecordFieldPtr<Double> svelCol(rec, "SRCVELOCITY"); 275 *svelCol = srcVel;258 *svelCol = pksrec.srcVel; 276 259 // the real stuff 277 260 RecordFieldPtr<Int> fitCol(rec, "FIT_ID"); 278 261 *fitCol = -1; 279 262 RecordFieldPtr<uInt> scanoCol(rec, "SCANNO"); 280 *scanoCol = scanNo-1;263 *scanoCol = pksrec.scanNo-1; 281 264 RecordFieldPtr<uInt> cyclenoCol(rec, "CYCLENO"); 282 *cyclenoCol = cycleNo-1;265 *cyclenoCol = pksrec.cycleNo-1; 283 266 RecordFieldPtr<Double> mjdCol(rec, "TIME"); 284 *mjdCol = mjd;267 *mjdCol = pksrec.mjd; 285 268 RecordFieldPtr<Double> intCol(rec, "INTERVAL"); 286 *intCol = interval;269 *intCol = pksrec.interval; 287 270 RecordFieldPtr<String> srcnCol(rec, "SRCNAME"); 288 271 RecordFieldPtr<Int> srctCol(rec, "SRCTYPE"); 289 272 RecordFieldPtr<String> fieldnCol(rec, "FIELDNAME"); 290 *fieldnCol = fieldName;273 *fieldnCol = pksrec.fieldName; 291 274 // try to auto-identify if it is on or off. 292 275 Regex rx(".*(e|w|_R)$"); 293 276 Regex rx2("_S$"); 294 Int match = srcName.matches(rx);277 Int match = pksrec.srcName.matches(rx); 295 278 if (match) { 296 *srcnCol = srcName;279 *srcnCol = pksrec.srcName; 297 280 } else { 298 *srcnCol = srcName.before(rx2);299 } 300 //*srcnCol = srcName;//.before(rx2);281 *srcnCol = pksrec.srcName.before(rx2); 282 } 283 //*srcnCol = pksrec.srcName;//.before(rx2); 301 284 *srctCol = match; 302 285 RecordFieldPtr<uInt> beamCol(rec, "BEAMNO"); 303 *beamCol = beamNo-beamOffset_-1;286 *beamCol = pksrec.beamNo-beamOffset_-1; 304 287 RecordFieldPtr<Int> rbCol(rec, "REFBEAMNO"); 305 288 Int rb = -1; 306 if (nBeam_ > 1 ) rb = refBeam-1;289 if (nBeam_ > 1 ) rb = pksrec.refBeam-1; 307 290 *rbCol = rb; 308 291 RecordFieldPtr<uInt> ifCol(rec, "IFNO"); 309 *ifCol = IFno-ifOffset_- 1;292 *ifCol = pksrec.IFno-ifOffset_- 1; 310 293 uInt id; 311 294 /// @todo this has to change when nchan isn't global anymore 312 295 id = table_->frequencies().addEntry(Double(header_->nchan/2), 313 refFreq,freqInc);296 pksrec.refFreq, pksrec.freqInc); 314 297 RecordFieldPtr<uInt> mfreqidCol(rec, "FREQ_ID"); 315 298 *mfreqidCol = id; 316 299 317 id = table_->molecules().addEntry( restFreq);300 id = table_->molecules().addEntry(pksrec.restFreq); 318 301 RecordFieldPtr<uInt> molidCol(rec, "MOLECULE_ID"); 319 302 *molidCol = id; 320 303 321 id = table_->tcal().addEntry( tcalTime,tcal);304 id = table_->tcal().addEntry(pksrec.tcalTime, pksrec.tcal); 322 305 RecordFieldPtr<uInt> mcalidCol(rec, "TCAL_ID"); 323 306 *mcalidCol = id; 324 id = table_->weather().addEntry(temperature, pressure, humidity, 325 windSpeed, windAz); 307 id = table_->weather().addEntry(pksrec.temperature, pksrec.pressure, 308 pksrec.humidity, pksrec.windSpeed, 309 pksrec.windAz); 326 310 RecordFieldPtr<uInt> mweatheridCol(rec, "WEATHER_ID"); 327 311 *mweatheridCol = id; 328 312 RecordFieldPtr<uInt> mfocusidCol(rec, "FOCUS_ID"); 329 id = table_->focus().addEntry(focusAxi, focusTan, focusRot); 313 id = table_->focus().addEntry(pksrec.focusAxi, pksrec.focusTan, 314 pksrec.focusRot); 330 315 *mfocusidCol = id; 331 316 RecordFieldPtr<Array<Double> > dirCol(rec, "DIRECTION"); 332 *dirCol = direction;317 *dirCol = pksrec.direction; 333 318 RecordFieldPtr<Float> azCol(rec, "AZIMUTH"); 334 *azCol = azimuth;319 *azCol = pksrec.azimuth; 335 320 RecordFieldPtr<Float> elCol(rec, "ELEVATION"); 336 *elCol = elevation;321 *elCol = pksrec.elevation; 337 322 338 323 RecordFieldPtr<Float> parCol(rec, "PARANGLE"); 339 *parCol = p arAngle;324 *parCol = pksrec.parAngle; 340 325 341 326 RecordFieldPtr< Array<Float> > specCol(rec, "SPECTRA"); … … 347 332 // into 2-4 rows in the scantable 348 333 Vector<Float> tsysvec(1); 349 // Why is spectra.ncolumn() == 3 for haveXPol_ == True350 uInt npol = ( spectra.ncolumn()==1 ? 1: 2);334 // Why is pksrec.spectra.ncolumn() == 3 for haveXPol_ == True 335 uInt npol = (pksrec.spectra.ncolumn()==1 ? 1: 2); 351 336 for ( uInt i=0; i< npol; ++i ) { 352 tsysvec = tsys(i);337 tsysvec = pksrec.tsys(i); 353 338 *tsysCol = tsysvec; 354 339 *polnoCol = i; 355 340 356 *specCol = spectra.column(i);357 *flagCol = flagtra.column(i);341 *specCol = pksrec.spectra.column(i); 342 *flagCol = pksrec.flagtra.column(i); 358 343 table_->table().addRow(); 359 344 row.put(table_->table().nrow()-1, rec); … … 361 346 if ( haveXPol_[0] ) { 362 347 // no tsys given for xpol, so emulate it 363 tsysvec = sqrt( tsys[0]*tsys[1]);348 tsysvec = sqrt(pksrec.tsys[0]*pksrec.tsys[1]); 364 349 *tsysCol = tsysvec; 365 350 // add real part of cross pol 366 351 *polnoCol = 2; 367 Vector<Float> r(real( xPol));352 Vector<Float> r(real(pksrec.xPol)); 368 353 *specCol = r; 369 354 // make up flags from linears 370 355 /// @fixme this has to be a bitwise or of both pols 371 *flagCol = flagtra.column(0);// |flagtra.column(1);356 *flagCol = pksrec.flagtra.column(0);// | pksrec.flagtra.column(1); 372 357 table_->table().addRow(); 373 358 row.put(table_->table().nrow()-1, rec); 374 359 // ad imaginary part of cross pol 375 360 *polnoCol = 3; 376 Vector<Float> im(imag( xPol));361 Vector<Float> im(imag(pksrec.xPol)); 377 362 *specCol = im; 378 363 table_->table().addRow();
Note:
See TracChangeset
for help on using the changeset viewer.