1 | //
|
---|
2 | // C++ Implementation: STCalTsys
|
---|
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 | //
|
---|
12 |
|
---|
13 | #include <vector>
|
---|
14 |
|
---|
15 | #include <casa/Arrays/ArrayMath.h>
|
---|
16 | #include <casa/Logging/LogIO.h>
|
---|
17 |
|
---|
18 | #include "STSelector.h"
|
---|
19 | #include "STCalTsys.h"
|
---|
20 | #include "STDefs.h"
|
---|
21 | #include <atnf/PKSIO/SrcType.h>
|
---|
22 |
|
---|
23 | using namespace std;
|
---|
24 | using namespace casa;
|
---|
25 |
|
---|
26 | namespace asap {
|
---|
27 | STCalTsys::STCalTsys(CountedPtr<Scantable> &s, vector<int> &iflist)
|
---|
28 | : STCalibration(s, "TSYS"),
|
---|
29 | iflist_(iflist)
|
---|
30 | {
|
---|
31 | applytable_ = new STCalTsysTable(*s);
|
---|
32 | }
|
---|
33 |
|
---|
34 | void STCalTsys::setupSelector(const STSelector &sel)
|
---|
35 | {
|
---|
36 | sel_ = sel;
|
---|
37 | vector<int> ifnos = sel_.getIFs();
|
---|
38 | if (ifnos.size() > 0) {
|
---|
39 | int nif = 0;
|
---|
40 | int nifOrg = iflist_.size();
|
---|
41 | vector<int> iflistNew(iflist_);
|
---|
42 | for (int i = 0; i < nifOrg; i++) {
|
---|
43 | if (find(ifnos.begin(), ifnos.end(), iflist_[i]) != ifnos.end()) {
|
---|
44 | iflistNew[nif] = iflist_[i];
|
---|
45 | ++nif;
|
---|
46 | }
|
---|
47 | }
|
---|
48 | if (nif == 0) {
|
---|
49 | LogIO os(LogOrigin("STCalTsys", "setupSelector", WHERE));
|
---|
50 | os << LogIO::SEVERE << "Selection contains no data." << LogIO::EXCEPTION;
|
---|
51 | }
|
---|
52 | sel_.setIFs(iflistNew);
|
---|
53 | }
|
---|
54 | else {
|
---|
55 | sel_.setIFs(iflist_);
|
---|
56 | }
|
---|
57 | }
|
---|
58 |
|
---|
59 | void STCalTsys::appenddata(uInt scanno, uInt cycleno,
|
---|
60 | uInt beamno, uInt ifno, uInt polno,
|
---|
61 | uInt freqid, Double time, Float elevation,
|
---|
62 | Vector<Float> any_data)
|
---|
63 | {
|
---|
64 | STCalTsysTable *p = dynamic_cast<STCalTsysTable *>(&(*applytable_));
|
---|
65 | p->appenddata(scanno, cycleno, beamno, ifno, polno,
|
---|
66 | freqid, time, elevation, any_data);
|
---|
67 | }
|
---|
68 |
|
---|
69 | }
|
---|