[2696] | 1 | //
|
---|
| 2 | // C++ Implementation: STCalTsys
|
---|
| 3 | //
|
---|
| 4 | // Description:
|
---|
| 5 | //
|
---|
| 6 | //
|
---|
[2703] | 7 | // Author: Takeshi Nakazato <takeshi.nakazato@nao.ac.jp> (C) 2012
|
---|
[2696] | 8 | //
|
---|
| 9 | // Copyright: See COPYING file that comes with this distribution
|
---|
| 10 | //
|
---|
| 11 | //
|
---|
| 12 |
|
---|
[2703] | 13 | #include <vector>
|
---|
[2786] | 14 |
|
---|
| 15 | #include <casa/Arrays/ArrayMath.h>
|
---|
| 16 | #include <casa/Logging/LogIO.h>
|
---|
| 17 |
|
---|
[2703] | 18 | #include "STSelector.h"
|
---|
[2696] | 19 | #include "STCalTsys.h"
|
---|
[2703] | 20 | #include "STDefs.h"
|
---|
| 21 | #include <atnf/PKSIO/SrcType.h>
|
---|
[2696] | 22 |
|
---|
[2703] | 23 | using namespace std;
|
---|
[2696] | 24 | using namespace casa;
|
---|
| 25 |
|
---|
| 26 | namespace asap {
|
---|
[2703] | 27 | STCalTsys::STCalTsys(CountedPtr<Scantable> &s, vector<int> &iflist)
|
---|
[2915] | 28 | : STCalibration(s, "TSYS"),
|
---|
[2703] | 29 | iflist_(iflist)
|
---|
[2696] | 30 | {
|
---|
[2703] | 31 | applytable_ = new STCalTsysTable(*s);
|
---|
[2696] | 32 | }
|
---|
| 33 |
|
---|
[2786] | 34 | void STCalTsys::setupSelector(const STSelector &sel)
|
---|
[2696] | 35 | {
|
---|
[2786] | 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 | }
|
---|
[2696] | 57 | }
|
---|
| 58 |
|
---|
[2915] | 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)
|
---|
[2696] | 63 | {
|
---|
[2915] | 64 | STCalTsysTable *p = dynamic_cast<STCalTsysTable *>(&(*applytable_));
|
---|
| 65 | p->appenddata(scanno, cycleno, beamno, ifno, polno,
|
---|
| 66 | freqid, time, elevation, any_data);
|
---|
[2696] | 67 | }
|
---|
| 68 |
|
---|
| 69 | }
|
---|