Changeset 2727 for trunk/src/STApplyCal.cpp
- Timestamp:
- 01/11/13 18:48:37 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STApplyCal.cpp
r2722 r2727 34 34 #include "PSAlmaCalibrator.h" 35 35 #include "NearestInterpolator1D.h" 36 #include "BufferedLinearInterpolator1D.h" 37 #include "PolynomialInterpolator1D.h" 38 #include "CubicSplineInterpolator1D.h" 36 39 #include <atnf/PKSIO/SrcType.h> 37 40 … … 62 65 doTsys_ = False; 63 66 interp_.resize((int)STCalEnum::NumAxis); 67 // default is linear interpolation 68 for (unsigned int i = 0; i < interp_.size(); i++) { 69 interp_[i] = STCalEnum::LinearInterpolation; 70 } 64 71 } 65 72 … … 125 132 126 133 // interpolator 127 interpolatorS_ = new NearestInterpolator1D(); 128 interpolatorT_ = new NearestInterpolator1D(); 129 interpolatorF_ = new NearestInterpolator1D(); 134 initInterpolator(); 130 135 131 136 // select data … … 450 455 } 451 456 452 } 457 void STApplyCal::initInterpolator() 458 { 459 int ta = (int)STCalEnum::TimeAxis; 460 int fa = (int)STCalEnum::FrequencyAxis; 461 int order = (order_ > 0) ? order_ : 1; 462 switch (interp_[ta]) { 463 case STCalEnum::NearestInterpolation: 464 { 465 os_ << "use NearestInterpolator in time axis" << LogIO::POST; 466 interpolatorS_ = new NearestInterpolator1D(); 467 interpolatorT_ = new NearestInterpolator1D(); 468 break; 469 } 470 case STCalEnum::LinearInterpolation: 471 { 472 os_ << "use BufferedLinearInterpolator in time axis" << LogIO::POST; 473 interpolatorS_ = new BufferedLinearInterpolator1D(); 474 interpolatorT_ = new BufferedLinearInterpolator1D(); 475 break; 476 } 477 case STCalEnum::CubicSplineInterpolation: 478 { 479 os_ << "use CubicSplineInterpolator in time axis" << LogIO::POST; 480 interpolatorS_ = new CubicSplineInterpolator1D(); 481 interpolatorT_ = new CubicSplineInterpolator1D(); 482 break; 483 } 484 case STCalEnum::PolynomialInterpolation: 485 { 486 os_ << "use PolynomialInterpolator in time axis" << LogIO::POST; 487 if (order == 0) { 488 interpolatorS_ = new NearestInterpolator1D(); 489 interpolatorT_ = new NearestInterpolator1D(); 490 } 491 else { 492 interpolatorS_ = new PolynomialInterpolator1D(); 493 interpolatorT_ = new PolynomialInterpolator1D(); 494 interpolatorS_->setOrder(order); 495 interpolatorT_->setOrder(order); 496 } 497 break; 498 } 499 default: 500 { 501 os_ << "use BufferedLinearInterpolator in time axis" << LogIO::POST; 502 interpolatorS_ = new BufferedLinearInterpolator1D(); 503 interpolatorT_ = new BufferedLinearInterpolator1D(); 504 break; 505 } 506 } 507 508 switch (interp_[fa]) { 509 case STCalEnum::NearestInterpolation: 510 { 511 os_ << "use NearestInterpolator in frequency axis" << LogIO::POST; 512 interpolatorF_ = new NearestInterpolator1D(); 513 break; 514 } 515 case STCalEnum::LinearInterpolation: 516 { 517 os_ << "use BufferedLinearInterpolator in frequency axis" << LogIO::POST; 518 interpolatorF_ = new BufferedLinearInterpolator1D(); 519 break; 520 } 521 case STCalEnum::CubicSplineInterpolation: 522 { 523 os_ << "use CubicSplineInterpolator in frequency axis" << LogIO::POST; 524 interpolatorF_ = new CubicSplineInterpolator1D(); 525 break; 526 } 527 case STCalEnum::PolynomialInterpolation: 528 { 529 os_ << "use PolynomialInterpolator in frequency axis" << LogIO::POST; 530 if (order == 0) { 531 interpolatorF_ = new NearestInterpolator1D(); 532 } 533 else { 534 interpolatorF_ = new PolynomialInterpolator1D(); 535 interpolatorF_->setOrder(order); 536 } 537 break; 538 } 539 default: 540 { 541 os_ << "use LinearInterpolator in frequency axis" << LogIO::POST; 542 interpolatorF_ = new BufferedLinearInterpolator1D(); 543 break; 544 } 545 } 546 } 547 }
Note: See TracChangeset
for help on using the changeset viewer.