Changeset 2960
- Timestamp:
- 06/27/14 19:39:09 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STApplyCal.cpp
r2928 r2960 304 304 Vector<Double> timeSkySorted; 305 305 Matrix<Float> spoffSorted; 306 Matrix<uChar> flagoffSorted; 306 307 { 307 308 Vector<Double> timeSky(nrowSky); 308 309 Matrix<Float> spoff(nrowSky, nchanSp); 310 Matrix<uChar> flagoff(nrowSky, nchanSp); 309 311 nrowSky = 0; 310 312 for (uInt i = 0 ; i < skylist.nelements(); i++) { … … 312 314 Vector<Double> t = p->getTime(); 313 315 Matrix<Float> sp = p->getSpectra(); 316 Matrix<uChar> fl = p->getFlagtra(); 314 317 for (uInt j = 0; j < t.nelements(); j++) { 315 318 timeSky[nrowSky] = t[j]; 316 319 spoff.row(nrowSky) = sp.column(j); 320 flagoff.row(nrowSky) = fl.column(j); 317 321 nrowSky++; 318 322 } … … 333 337 new Float[nrowSky * nchanSp], 334 338 TAKE_OVER); 339 flagoffSorted.takeStorage(IPosition(2, nrowSkySorted, nchanSp), 340 new uChar[nrowSkySorted * nchanSp], 341 TAKE_OVER); 335 342 for (uInt i = 0 ; i < nrowSky; i++) { 336 343 spoffSorted.row(i) = spoff.row(skyIdx[i]); 344 flagoffSorted.row(i) = flagoff.row(skyIdx[i]); 337 345 } 338 346 } … … 340 348 uInt nrowTsysSorted = nrowTsys; 341 349 Matrix<Float> tsysSorted; 350 Matrix<uChar> flagtsysSorted; 342 351 Vector<Double> timeTsysSorted; 343 352 if (doTsys) { … … 345 354 Vector<Double> timeTsys(nrowTsys); 346 355 Matrix<Float> tsys(nrowTsys, nchanTsys); 356 Matrix<uChar> flagtsys(nrowTsys, nchanTsys); 347 357 tsysSorted.takeStorage(IPosition(2, nrowTsys, nchanTsys), 348 358 new Float[nrowTsys * nchanTsys], … … 353 363 Vector<Double> t = p->getTime(); 354 364 Matrix<Float> ts = p->getTsys(); 365 Matrix<uChar> fl = p->getFlagtra(); 355 366 for (uInt j = 0; j < t.nelements(); j++) { 356 367 timeTsys[nrowTsys] = t[j]; 357 368 tsys.row(nrowTsys) = ts.column(j); 369 flagtsys.row(nrowTsys) = fl.column(j); 358 370 nrowTsys++; 359 371 } … … 365 377 new Double[nrowTsysSorted], 366 378 TAKE_OVER); 379 flagtsysSorted.takeStorage(IPosition(2, nrowTsysSorted, nchanTsys), 380 new uChar[nrowTsysSorted * nchanTsys], 381 TAKE_OVER); 367 382 for (uInt i = 0 ; i < nrowTsysSorted; i++) { 368 383 timeTsysSorted[i] = timeTsys[tsysIdx[i]]; … … 372 387 for (uInt i = 0; i < nrowTsys; ++i) { 373 388 tsysSorted.row(i) = tsys.row(tsysIdx[i]); 389 flagtsysSorted.row(i) = flagtsys.row(tsysIdx[i]); 374 390 } 375 391 } … … 377 393 Table tab = work_->table(); 378 394 ArrayColumn<Float> spCol(tab, "SPECTRA"); 395 ArrayColumn<uChar> flCol(tab, "FLAGTRA"); 379 396 ArrayColumn<Float> tsysCol(tab, "TSYS"); 380 397 ScalarColumn<Double> timeCol(tab, "TIME"); 381 Vector<Float> on;398 //Vector<Float> on; 382 399 383 400 // Array for scaling factor (aka Tsys) … … 396 413 397 414 // target spectral data 398 on = spCol(irow); 415 Vector<Float> on = spCol(irow); 416 Vector<uChar> flag = flCol(irow); 399 417 //os_ << "on=" << on[0] << LogIO::POST; 400 418 calibrator_->setSource(on); … … 403 421 Double t0 = timeCol(irow); 404 422 for (uInt ichan = 0; ichan < nchanSp; ichan++) { 405 Float *tmpY = &(spoffSorted.data()[ichan * nrowSkySorted]); 423 Float *tmpY = &(spoffSorted.data()[ichan * nrowSkySorted]); 424 if (allNE(flagoffSorted.column(ichan), (uChar)0)) { 425 flag[ichan] = 1 << 7; // user flag 426 } 406 427 interpolatorS_->setY(tmpY, nrowSkySorted); 407 428 iOff[ichan] = interpolatorS_->interpolate(t0); … … 450 471 //os_ << "calibrated=" << calibrator_->getCalibrated()[0] << LogIO::POST; 451 472 spCol.put(irow, calibrator_->getCalibrated()); 473 flCol.put(irow, flag); 452 474 if (filltsys) 453 475 tsysCol.put(irow, iTsys);
Note:
See TracChangeset
for help on using the changeset viewer.