source: trunk/src/STApplyCal.cpp@ 2960

Last change on this file since 2960 was 2960, checked in by Takeshi Nakazato, 11 years ago

New Development: No

JIRA Issue: Yes CAS-6585, CAS-6571

Ready for Test: Yes

Interface Changes: Yes/No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Channel flag in sky caltable is properly handled in applycal stage.


File size: 17.9 KB
RevLine 
[2720]1//
2// C++ Implementation: STApplyCal
3//
4// Description:
5//
6//
7// Author: Takeshi Nakazato <takeshi.nakazato@nao.ac.jp> (C) 2012
8//
9// Copyright: See COPYING file that comes with this distribution
10//
11//
[2722]12#include <assert.h>
[2720]13
14#include <casa/Arrays/Array.h>
15#include <casa/Arrays/Vector.h>
16#include <casa/Arrays/Matrix.h>
17#include <casa/Arrays/ArrayIO.h>
18#include <casa/Arrays/ArrayMath.h>
19#include <casa/BasicSL/String.h>
20#include <casa/Logging/LogIO.h>
21#include <casa/Exceptions/Error.h>
22#include <casa/Utilities/CountedPtr.h>
23#include <casa/Utilities/Sort.h>
[2756]24#include <casa/Utilities/Assert.h>
[2720]25#include <tables/Tables/Table.h>
26
27#include "Scantable.h"
28#include "STApplyCal.h"
29#include "STApplyTable.h"
30#include "STCalTsysTable.h"
31#include "STCalSkyTable.h"
32#include "STCalEnum.h"
33#include "STIdxIter.h"
34#include "Calibrator.h"
35#include "PSAlmaCalibrator.h"
[2733]36#include "Interpolator1D.h"
[2720]37#include "NearestInterpolator1D.h"
[2727]38#include "BufferedLinearInterpolator1D.h"
39#include "PolynomialInterpolator1D.h"
40#include "CubicSplineInterpolator1D.h"
[2720]41#include <atnf/PKSIO/SrcType.h>
42
43
44using namespace casa;
45using namespace std;
46
47namespace asap {
48
49STApplyCal::STApplyCal()
50{
51 init();
52}
53
54STApplyCal::STApplyCal(CountedPtr<Scantable> target)
55 : target_(target)
56{
57 init();
58}
59
60STApplyCal::~STApplyCal()
61{
62}
63
64void STApplyCal::init()
65{
66 caltype_ = STCalEnum::NoType;
67 doTsys_ = False;
[2742]68 iTime_ = STCalEnum::DefaultInterpolation;
69 iFreq_ = STCalEnum::DefaultInterpolation;
[2720]70}
71
[2735]72void STApplyCal::reset()
73{
[2742]74 // call init
75 init();
76
77 // clear apply tables
78 // do not delete object here
79 skytable_.resize(0);
80 tsystable_.resize(0);
81
82 // clear mapping for Tsys transfer
83 spwmap_.clear();
84
85 // reset selector
86 sel_.reset();
87
88 // delete interpolators
89 interpolatorT_ = 0;
90 interpolatorS_ = 0;
91 interpolatorF_ = 0;
92
93 // clear working scantable
94 work_ = 0;
95
96 // clear calibrator
97 calibrator_ = 0;
[2735]98}
99
100void STApplyCal::completeReset()
101{
102 reset();
103 target_ = 0;
104}
105
[2720]106void STApplyCal::setTarget(CountedPtr<Scantable> target)
107{
108 target_ = target;
109}
110
111void STApplyCal::setTarget(const String &name)
112{
113 // always create PlainTable
114 target_ = new Scantable(name, Table::Plain);
115}
116
117void STApplyCal::push(STCalSkyTable *table)
118{
[2735]119 os_.origin(LogOrigin("STApplyCal","push",WHERE));
[2720]120 skytable_.push_back(table);
121 STCalEnum::CalType caltype = STApplyTable::getCalType(table);
122 os_ << "caltype=" << caltype << LogIO::POST;
123 if (caltype_ == STCalEnum::NoType ||
124 caltype_ == STCalEnum::DefaultType ||
125 caltype_ == STCalEnum::CalTsys) {
126 caltype_ = caltype;
127 }
128 os_ << "caltype_=" << caltype_ << LogIO::POST;
129}
130
131void STApplyCal::push(STCalTsysTable *table)
132{
133 tsystable_.push_back(table);
134 doTsys_ = True;
135}
136
[2735]137void STApplyCal::setTimeInterpolation(STCalEnum::InterpolationType itype, Int order)
[2720]138{
[2735]139 iTime_ = itype;
[2720]140 order_ = order;
141}
142
[2735]143void STApplyCal::setFrequencyInterpolation(STCalEnum::InterpolationType itype, Int order)
144{
145 iFreq_ = itype;
146 order_ = order;
147}
148
[2720]149void STApplyCal::setTsysTransfer(uInt from, Vector<uInt> to)
150{
[2735]151 os_.origin(LogOrigin("STApplyCal","setTsysTransfer",WHERE));
[2720]152 os_ << "from=" << from << ", to=" << to << LogIO::POST;
153 map<uInt, Vector<uInt> >::iterator i = spwmap_.find(from);
154 if (i == spwmap_.end()) {
155 spwmap_.insert(pair<uInt, Vector<uInt> >(from, to));
156 }
157 else {
158 Vector<uInt> toNew = i->second;
159 spwmap_.erase(i);
160 uInt k = toNew.nelements();
161 toNew.resize(k+to.nelements(), True);
162 for (uInt i = 0; i < to.nelements(); i++)
163 toNew[i+k] = to[i];
164 spwmap_.insert(pair<uInt, Vector<uInt> >(from, toNew));
165 }
166}
167
[2742]168void STApplyCal::apply(Bool insitu, Bool filltsys)
[2720]169{
[2735]170 os_.origin(LogOrigin("STApplyCal","apply",WHERE));
[2750]171
[2756]172 //assert(!target_.null());
173 assert_<AipsError>(!target_.null(),"You have to set target scantable first.");
[2750]174
[2720]175 // calibrator
176 if (caltype_ == STCalEnum::CalPSAlma)
177 calibrator_ = new PSAlmaCalibrator();
178
179 // interpolator
[2727]180 initInterpolator();
[2720]181
182 // select data
183 sel_.reset();
[2806]184 sel_ = target_->getSelection();
[2720]185 if (caltype_ == STCalEnum::CalPSAlma ||
186 caltype_ == STCalEnum::CalPS) {
187 sel_.setTypes(vector<int>(1,(int)SrcType::PSON));
188 }
189 target_->setSelection(sel_);
190
[2735]191 //os_ << "sel_.print()=" << sel_.print() << LogIO::POST;
[2720]192
193 // working data
[2750]194 if (insitu) {
195 os_.origin(LogOrigin("STApplyCal","apply",WHERE));
196 os_ << "Overwrite input scantable" << LogIO::POST;
[2720]197 work_ = target_;
[2750]198 }
199 else {
200 os_.origin(LogOrigin("STApplyCal","apply",WHERE));
201 os_ << "Create output scantable from input" << LogIO::POST;
[2720]202 work_ = new Scantable(*target_, false);
[2750]203 }
[2720]204
[2735]205 //os_ << "work_->nrow()=" << work_->nrow() << LogIO::POST;
[2720]206
207 // list of apply tables for sky calibration
[2928]208 Vector<uInt> skycalList(skytable_.size());
[2720]209 uInt numSkyCal = 0;
[2735]210
[2720]211 // list of apply tables for Tsys calibration
212 for (uInt i = 0 ; i < skytable_.size(); i++) {
213 STCalEnum::CalType caltype = STApplyTable::getCalType(skytable_[i]);
214 if (caltype == caltype_) {
215 skycalList[numSkyCal] = i;
216 numSkyCal++;
217 }
218 }
[2928]219 skycalList.resize(numSkyCal, True);
[2720]220
221
222 vector<string> cols( 3 ) ;
223 cols[0] = "BEAMNO" ;
224 cols[1] = "POLNO" ;
225 cols[2] = "IFNO" ;
[2916]226 CountedPtr<STIdxIter2> iter = new STIdxIter2(work_, cols) ;
[2925]227 double start = mathutil::gettimeofday_sec();
228 os_ << LogIO::DEBUGGING << "start iterative doapply: " << start << LogIO::POST;
[2720]229 while (!iter->pastEnd()) {
[2916]230 Record ids = iter->currentValue();
[2720]231 Vector<uInt> rows = iter->getRows(SHARE);
232 if (rows.nelements() > 0)
[2916]233 doapply(ids.asuInt("BEAMNO"), ids.asuInt("IFNO"), ids.asuInt("POLNO"), rows, skycalList, filltsys);
[2720]234 iter->next();
235 }
[2925]236 double end = mathutil::gettimeofday_sec();
237 os_ << LogIO::DEBUGGING << "end iterative doapply: " << end << LogIO::POST;
238 os_ << LogIO::DEBUGGING << "elapsed time for doapply: " << end - start << " sec" << LogIO::POST;
[2720]239
240 target_->unsetSelection();
241}
242
243void STApplyCal::doapply(uInt beamno, uInt ifno, uInt polno,
244 Vector<uInt> &rows,
[2742]245 Vector<uInt> &skylist,
246 Bool filltsys)
[2720]247{
[2735]248 os_.origin(LogOrigin("STApplyCal","doapply",WHERE));
[2720]249 Bool doTsys = doTsys_;
250
251 STSelector sel;
252 vector<int> id(1);
253 id[0] = beamno;
254 sel.setBeams(id);
255 id[0] = ifno;
256 sel.setIFs(id);
257 id[0] = polno;
258 sel.setPolarizations(id);
259
260 // apply selection to apply tables
261 uInt nrowSky = 0;
262 uInt nrowTsys = 0;
263 for (uInt i = 0; i < skylist.nelements(); i++) {
264 skytable_[skylist[i]]->setSelection(sel);
265 nrowSky += skytable_[skylist[i]]->nrow();
266 os_ << "nrowSky=" << nrowSky << LogIO::POST;
267 }
[2806]268
269 // Skip IFNO without sky data
270 if (nrowSky == 0)
271 return;
272
[2720]273 uInt nchanTsys = 0;
274 Vector<Double> ftsys;
275 uInt tsysifno = getIFForTsys(ifno);
[2758]276 os_ << "tsysifno=" << (Int)tsysifno << LogIO::POST;
[2720]277 if (tsystable_.size() == 0) {
278 os_.origin(LogOrigin("STApplyTable", "doapply", WHERE));
279 os_ << "No Tsys tables are given. Skip Tsys calibratoin." << LogIO::POST;
280 doTsys = False;
281 }
282 else if (tsysifno == (uInt)-1) {
283 os_.origin(LogOrigin("STApplyTable", "doapply", WHERE));
284 os_ << "No corresponding Tsys for IFNO " << ifno << ". Skip Tsys calibration" << LogIO::POST;
285 doTsys = False;
286 }
287 else {
288 id[0] = (int)tsysifno;
289 sel.setIFs(id);
290 for (uInt i = 0; i < tsystable_.size() ; i++) {
291 tsystable_[i]->setSelection(sel);
[2848]292 uInt nrowThisTsys = tsystable_[i]->nrow();
293 nrowTsys += nrowThisTsys;
294 if (nrowThisTsys > 0 and nchanTsys == 0) {
295 nchanTsys = tsystable_[i]->nchan(tsysifno);
296 ftsys = tsystable_[i]->getBaseFrequency(0);
297 }
[2720]298 }
[2848]299 interpolatorF_->setX(ftsys.data(), nchanTsys);
[2720]300 }
301
302 uInt nchanSp = skytable_[skylist[0]]->nchan(ifno);
[2928]303 uInt nrowSkySorted = nrowSky;
304 Vector<Double> timeSkySorted;
305 Matrix<Float> spoffSorted;
[2960]306 Matrix<uChar> flagoffSorted;
[2928]307 {
308 Vector<Double> timeSky(nrowSky);
309 Matrix<Float> spoff(nrowSky, nchanSp);
[2960]310 Matrix<uChar> flagoff(nrowSky, nchanSp);
[2928]311 nrowSky = 0;
312 for (uInt i = 0 ; i < skylist.nelements(); i++) {
313 STCalSkyTable *p = skytable_[skylist[i]];
314 Vector<Double> t = p->getTime();
315 Matrix<Float> sp = p->getSpectra();
[2960]316 Matrix<uChar> fl = p->getFlagtra();
[2928]317 for (uInt j = 0; j < t.nelements(); j++) {
318 timeSky[nrowSky] = t[j];
319 spoff.row(nrowSky) = sp.column(j);
[2960]320 flagoff.row(nrowSky) = fl.column(j);
[2928]321 nrowSky++;
322 }
[2720]323 }
[2928]324
325 Vector<uInt> skyIdx = timeSort(timeSky);
326 nrowSkySorted = skyIdx.nelements();
327
328 timeSkySorted.takeStorage(IPosition(1, nrowSkySorted),
329 new Double[nrowSkySorted],
330 TAKE_OVER);
331 for (uInt i = 0 ; i < nrowSkySorted; i++) {
332 timeSkySorted[i] = timeSky[skyIdx[i]];
333 }
334 interpolatorS_->setX(timeSkySorted.data(), nrowSkySorted);
335
336 spoffSorted.takeStorage(IPosition(2, nrowSky, nchanSp),
337 new Float[nrowSky * nchanSp],
338 TAKE_OVER);
[2960]339 flagoffSorted.takeStorage(IPosition(2, nrowSkySorted, nchanSp),
340 new uChar[nrowSkySorted * nchanSp],
341 TAKE_OVER);
[2928]342 for (uInt i = 0 ; i < nrowSky; i++) {
343 spoffSorted.row(i) = spoff.row(skyIdx[i]);
[2960]344 flagoffSorted.row(i) = flagoff.row(skyIdx[i]);
[2928]345 }
[2720]346 }
347
[2928]348 uInt nrowTsysSorted = nrowTsys;
349 Matrix<Float> tsysSorted;
[2960]350 Matrix<uChar> flagtsysSorted;
[2733]351 Vector<Double> timeTsysSorted;
[2720]352 if (doTsys) {
[2758]353 //os_ << "doTsys" << LogIO::POST;
[2928]354 Vector<Double> timeTsys(nrowTsys);
355 Matrix<Float> tsys(nrowTsys, nchanTsys);
[2960]356 Matrix<uChar> flagtsys(nrowTsys, nchanTsys);
[2928]357 tsysSorted.takeStorage(IPosition(2, nrowTsys, nchanTsys),
358 new Float[nrowTsys * nchanTsys],
359 TAKE_OVER);
[2720]360 nrowTsys = 0;
361 for (uInt i = 0 ; i < tsystable_.size(); i++) {
362 STCalTsysTable *p = tsystable_[i];
363 Vector<Double> t = p->getTime();
364 Matrix<Float> ts = p->getTsys();
[2960]365 Matrix<uChar> fl = p->getFlagtra();
[2720]366 for (uInt j = 0; j < t.nelements(); j++) {
367 timeTsys[nrowTsys] = t[j];
[2925]368 tsys.row(nrowTsys) = ts.column(j);
[2960]369 flagtsys.row(nrowTsys) = fl.column(j);
[2720]370 nrowTsys++;
371 }
372 }
[2928]373 Vector<uInt> tsysIdx = timeSort(timeTsys);
374 nrowTsysSorted = tsysIdx.nelements();
[2720]375
[2928]376 timeTsysSorted.takeStorage(IPosition(1, nrowTsysSorted),
377 new Double[nrowTsysSorted],
378 TAKE_OVER);
[2960]379 flagtsysSorted.takeStorage(IPosition(2, nrowTsysSorted, nchanTsys),
380 new uChar[nrowTsysSorted * nchanTsys],
381 TAKE_OVER);
[2928]382 for (uInt i = 0 ; i < nrowTsysSorted; i++) {
[2733]383 timeTsysSorted[i] = timeTsys[tsysIdx[i]];
[2720]384 }
[2928]385 interpolatorT_->setX(timeTsysSorted.data(), nrowTsysSorted);
386
387 for (uInt i = 0; i < nrowTsys; ++i) {
388 tsysSorted.row(i) = tsys.row(tsysIdx[i]);
[2960]389 flagtsysSorted.row(i) = flagtsys.row(tsysIdx[i]);
[2928]390 }
[2720]391 }
392
393 Table tab = work_->table();
394 ArrayColumn<Float> spCol(tab, "SPECTRA");
[2960]395 ArrayColumn<uChar> flCol(tab, "FLAGTRA");
[2735]396 ArrayColumn<Float> tsysCol(tab, "TSYS");
[2720]397 ScalarColumn<Double> timeCol(tab, "TIME");
[2960]398 //Vector<Float> on;
[2925]399
400 // Array for scaling factor (aka Tsys)
[2928]401 Vector<Float> iTsys(IPosition(1, nchanSp), new Float[nchanSp], TAKE_OVER);
402 // Array for Tsys interpolation
403 // This is empty array and is never referenced if doTsys == false
404 // (i.e. nchanTsys == 0)
405 Vector<Float> iTsysT(IPosition(1, nchanTsys), new Float[nchanTsys], TAKE_OVER);
406
407 // Array for interpolated off spectrum
408 Vector<Float> iOff(IPosition(1, nchanSp), new Float[nchanSp], TAKE_OVER);
[2925]409
[2720]410 for (uInt i = 0; i < rows.nelements(); i++) {
[2758]411 //os_ << "start i = " << i << " (row = " << rows[i] << ")" << LogIO::POST;
[2720]412 uInt irow = rows[i];
413
414 // target spectral data
[2960]415 Vector<Float> on = spCol(irow);
416 Vector<uChar> flag = flCol(irow);
[2862]417 //os_ << "on=" << on[0] << LogIO::POST;
[2720]418 calibrator_->setSource(on);
419
420 // interpolation
[2733]421 Double t0 = timeCol(irow);
[2720]422 for (uInt ichan = 0; ichan < nchanSp; ichan++) {
[2960]423 Float *tmpY = &(spoffSorted.data()[ichan * nrowSkySorted]);
424 if (allNE(flagoffSorted.column(ichan), (uChar)0)) {
425 flag[ichan] = 1 << 7; // user flag
426 }
[2928]427 interpolatorS_->setY(tmpY, nrowSkySorted);
[2720]428 iOff[ichan] = interpolatorS_->interpolate(t0);
429 }
[2862]430 //os_ << "iOff=" << iOff[0] << LogIO::POST;
[2720]431 calibrator_->setReference(iOff);
432
433 if (doTsys) {
434 // Tsys correction
[2928]435 Float *yt = iTsysT.data();
[2720]436 for (uInt ichan = 0; ichan < nchanTsys; ichan++) {
[2928]437 Float *tmpY = &(tsysSorted.data()[ichan * nrowTsysSorted]);
438 interpolatorT_->setY(tmpY, nrowTsysSorted);
[2720]439 iTsysT[ichan] = interpolatorT_->interpolate(t0);
440 }
441 if (nchanSp == 1) {
442 // take average
443 iTsys[0] = mean(iTsysT);
444 }
445 else {
446 // interpolation on frequency axis
447 Vector<Double> fsp = getBaseFrequency(rows[i]);
448 interpolatorF_->setY(yt, nchanTsys);
449 for (uInt ichan = 0; ichan < nchanSp; ichan++) {
[2733]450 iTsys[ichan] = interpolatorF_->interpolate(fsp[ichan]);
[2720]451 }
452 }
453 }
454 else {
[2759]455 Vector<Float> tsysInRow = tsysCol(irow);
456 if (tsysInRow.nelements() == 1) {
457 iTsys = tsysInRow[0];
458 }
459 else {
[2862]460 for (uInt ichan = 0; ichan < tsysInRow.nelements(); ++ichan)
[2759]461 iTsys[ichan] = tsysInRow[ichan];
462 }
[2720]463 }
[2862]464 //os_ << "iTsys=" << iTsys[0] << LogIO::POST;
[2720]465 calibrator_->setScaler(iTsys);
466
467 // do calibration
468 calibrator_->calibrate();
469
470 // update table
[2862]471 //os_ << "calibrated=" << calibrator_->getCalibrated()[0] << LogIO::POST;
[2720]472 spCol.put(irow, calibrator_->getCalibrated());
[2960]473 flCol.put(irow, flag);
[2742]474 if (filltsys)
475 tsysCol.put(irow, iTsys);
[2720]476 }
477
478
479 // reset selection on apply tables
480 for (uInt i = 0; i < skylist.nelements(); i++)
481 skytable_[i]->unsetSelection();
482 for (uInt i = 0; i < tsystable_.size(); i++)
483 tsystable_[i]->unsetSelection();
484
485
486 // reset interpolator
487 interpolatorS_->reset();
488 interpolatorF_->reset();
489 interpolatorT_->reset();
490}
491
492Vector<uInt> STApplyCal::timeSort(Vector<Double> &t)
493{
494 Sort sort;
495 sort.sortKey(&t[0], TpDouble, 0, Sort::Ascending);
496 Vector<uInt> idx;
497 sort.sort(idx, t.nelements(), Sort::QuickSort|Sort::NoDuplicates);
498 return idx;
499}
500
501uInt STApplyCal::getIFForTsys(uInt to)
502{
503 for (map<casa::uInt, Vector<uInt> >::iterator i = spwmap_.begin();
504 i != spwmap_.end(); i++) {
505 Vector<uInt> tolist = i->second;
[2735]506 os_ << "from=" << i->first << ": tolist=" << tolist << LogIO::POST;
[2720]507 for (uInt j = 0; j < tolist.nelements(); j++) {
508 if (tolist[j] == to)
509 return i->first;
510 }
511 }
512 return (uInt)-1;
513}
514
515void STApplyCal::save(const String &name)
516{
[2756]517 //assert(!work_.null());
518 assert_<AipsError>(!work_.null(),"You have to execute apply method first.");
[2720]519
520 work_->setSelection(sel_);
521 work_->makePersistent(name);
522 work_->unsetSelection();
523}
524
525Vector<Double> STApplyCal::getBaseFrequency(uInt whichrow)
526{
[2756]527 //assert(whichrow <= (uInt)work_->nrow());
528 assert_<AipsError>(whichrow <= (uInt)work_->nrow(),"row index out of range.");
[2720]529 ROTableColumn col(work_->table(), "IFNO");
530 uInt ifno = col.asuInt(whichrow);
531 col.attach(work_->table(), "FREQ_ID");
532 uInt freqid = col.asuInt(whichrow);
533 uInt nc = work_->nchan(ifno);
534 STFrequencies ftab = work_->frequencies();
535 Double rp, rf, inc;
536 ftab.getEntry(rp, rf, inc, freqid);
537 Vector<Double> r(nc);
538 indgen(r, rf-rp*inc, inc);
539 return r;
540}
541
[2727]542void STApplyCal::initInterpolator()
543{
[2735]544 os_.origin(LogOrigin("STApplyCal","initInterpolator",WHERE));
[2727]545 int order = (order_ > 0) ? order_ : 1;
[2735]546 switch (iTime_) {
[2727]547 case STCalEnum::NearestInterpolation:
548 {
549 os_ << "use NearestInterpolator in time axis" << LogIO::POST;
[2733]550 interpolatorS_ = new NearestInterpolator1D<Double, Float>();
551 interpolatorT_ = new NearestInterpolator1D<Double, Float>();
[2727]552 break;
553 }
554 case STCalEnum::LinearInterpolation:
555 {
556 os_ << "use BufferedLinearInterpolator in time axis" << LogIO::POST;
[2733]557 interpolatorS_ = new BufferedLinearInterpolator1D<Double, Float>();
558 interpolatorT_ = new BufferedLinearInterpolator1D<Double, Float>();
[2727]559 break;
560 }
561 case STCalEnum::CubicSplineInterpolation:
562 {
563 os_ << "use CubicSplineInterpolator in time axis" << LogIO::POST;
[2733]564 interpolatorS_ = new CubicSplineInterpolator1D<Double, Float>();
565 interpolatorT_ = new CubicSplineInterpolator1D<Double, Float>();
[2727]566 break;
567 }
568 case STCalEnum::PolynomialInterpolation:
569 {
570 os_ << "use PolynomialInterpolator in time axis" << LogIO::POST;
571 if (order == 0) {
[2733]572 interpolatorS_ = new NearestInterpolator1D<Double, Float>();
573 interpolatorT_ = new NearestInterpolator1D<Double, Float>();
[2727]574 }
575 else {
[2733]576 interpolatorS_ = new PolynomialInterpolator1D<Double, Float>();
577 interpolatorT_ = new PolynomialInterpolator1D<Double, Float>();
[2727]578 interpolatorS_->setOrder(order);
579 interpolatorT_->setOrder(order);
580 }
581 break;
582 }
583 default:
584 {
585 os_ << "use BufferedLinearInterpolator in time axis" << LogIO::POST;
[2733]586 interpolatorS_ = new BufferedLinearInterpolator1D<Double, Float>();
587 interpolatorT_ = new BufferedLinearInterpolator1D<Double, Float>();
[2727]588 break;
589 }
590 }
591
[2735]592 switch (iFreq_) {
[2727]593 case STCalEnum::NearestInterpolation:
594 {
595 os_ << "use NearestInterpolator in frequency axis" << LogIO::POST;
[2733]596 interpolatorF_ = new NearestInterpolator1D<Double, Float>();
[2727]597 break;
598 }
599 case STCalEnum::LinearInterpolation:
600 {
601 os_ << "use BufferedLinearInterpolator in frequency axis" << LogIO::POST;
[2733]602 interpolatorF_ = new BufferedLinearInterpolator1D<Double, Float>();
[2727]603 break;
604 }
605 case STCalEnum::CubicSplineInterpolation:
606 {
607 os_ << "use CubicSplineInterpolator in frequency axis" << LogIO::POST;
[2733]608 interpolatorF_ = new CubicSplineInterpolator1D<Double, Float>();
[2727]609 break;
610 }
611 case STCalEnum::PolynomialInterpolation:
612 {
613 os_ << "use PolynomialInterpolator in frequency axis" << LogIO::POST;
614 if (order == 0) {
[2733]615 interpolatorF_ = new NearestInterpolator1D<Double, Float>();
[2727]616 }
617 else {
[2733]618 interpolatorF_ = new PolynomialInterpolator1D<Double, Float>();
[2727]619 interpolatorF_->setOrder(order);
620 }
621 break;
622 }
623 default:
624 {
625 os_ << "use LinearInterpolator in frequency axis" << LogIO::POST;
[2733]626 interpolatorF_ = new BufferedLinearInterpolator1D<Double, Float>();
[2727]627 break;
628 }
629 }
[2720]630}
[2727]631}
Note: See TracBrowser for help on using the repository browser.