source: trunk/src/STCalSkyTable.cpp@ 2720

Last change on this file since 2720 was 2720, checked in by Takeshi Nakazato, 12 years ago

New Development: Yes

JIRA Issue: Yes CAS-4770 and its sub-tickets

Ready for Test: Yes

Interface Changes: 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...

First version of applycal for single dish calibration.
Added new classes for the operation (STApplyCal, Calibrator, PSAlmaCalibrator,
Locator, BisectionLocator, Interpolator1D, NearestInterpolator1D).
Also, modified existing classes to fit with implementation of applycal.


File size: 3.1 KB
Line 
1//
2// C++ Implementation: STCalSkyTable
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#include <casa/Exceptions/Error.h>
13#include <casa/Logging/LogIO.h>
14#include <tables/Tables/TableDesc.h>
15#include <tables/Tables/SetupNewTab.h>
16#include <tables/Tables/ArrColDesc.h>
17#include <tables/Tables/ScaColDesc.h>
18#include <tables/Tables/TableRecord.h>
19#include <measures/TableMeasures/TableMeasDesc.h>
20#include <measures/TableMeasures/TableMeasRefDesc.h>
21#include <measures/TableMeasures/TableMeasValueDesc.h>
22
23#include "Scantable.h"
24#include "STCalSkyTable.h"
25
26
27using namespace casa;
28
29namespace asap {
30
31const String STCalSkyTable::name_ = "APPLY_SKY";
32
33STCalSkyTable::STCalSkyTable(const Scantable& parent, const String &caltype)
34 : STApplyTable(parent, name_),
35 caltype_(caltype)
36{
37 setup();
38}
39
40STCalSkyTable::STCalSkyTable(const String &name)
41 : STApplyTable(name)
42{
43 attachOptionalColumns();
44}
45
46STCalSkyTable::~STCalSkyTable()
47{
48}
49
50void STCalSkyTable::setup()
51{
52 table_.addColumn(ArrayColumnDesc<Float>("SPECTRA"));
53 table_.addColumn(ScalarColumnDesc<Float>("ELEVATION"));
54
55 //table_.rwKeywordSet().define("ApplyType", "SKY");
56 String caltype = "CALSKY_" + caltype_;
57 caltype.upcase();
58 table_.rwKeywordSet().define("ApplyType", caltype);
59
60 attachOptionalColumns();
61}
62
63void STCalSkyTable::attachOptionalColumns()
64{
65 spectraCol_.attach(table_, "SPECTRA");
66 elCol_.attach(table_,"ELEVATION");
67
68}
69
70void STCalSkyTable::setdata(uInt irow, uInt scanno, uInt cycleno,
71 uInt beamno, uInt ifno, uInt polno, uInt freqid,
72 Double time, Float elevation, Vector<Float> spectra)
73{
74 if (irow >= (uInt)nrow()) {
75 throw AipsError("row index out of range");
76 }
77
78 if (!sel_.empty()) {
79 os_.origin(LogOrigin("STCalSkyTable","setdata",WHERE));
80 os_ << LogIO::WARN << "Data selection is effective. Specified row index may be wrong." << LogIO::POST;
81 }
82
83 setbasedata(irow, scanno, cycleno, beamno, ifno, polno, freqid, time);
84 elCol_.put(irow, elevation);
85 spectraCol_.put(irow, spectra);
86}
87
88void STCalSkyTable::appenddata(uInt scanno, uInt cycleno,
89 uInt beamno, uInt ifno, uInt polno, uInt freqid,
90 Double time, Float elevation, Vector<Float> spectra)
91{
92 uInt irow = nrow();
93 table_.addRow(1, True);
94 setdata(irow, scanno, cycleno, beamno, ifno, polno, freqid, time, elevation, spectra);
95}
96
97uInt STCalSkyTable::nchan(uInt ifno)
98{
99 STSelector org = sel_;
100 STSelector sel;
101 sel.setIFs(vector<int>(1,(int)ifno));
102 setSelection(sel);
103 uInt n = spectraCol_(0).nelements();
104 unsetSelection();
105 if (!org.empty())
106 setSelection(org);
107 return n;
108}
109
110// Vector<Double> STCalSkyTable::getBaseFrequency(uInt whichrow)
111// {
112// assert(whichrow < nrow());
113// uInt freqid = freqidCol_(whichrow);
114// uInt nc = spectraCol_(whichrow).nelements();
115// Block<Double> f = getFrequenciesRow(freqid);
116// Vector<Double> freqs(nc);
117// indgen(freqs, f[1]-f[0]*f[2], f[2]);
118// return freqs;
119// }
120}
Note: See TracBrowser for help on using the repository browser.