source: branches/plotter2/src/STCalSkyTable.cpp@ 2846

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

New Development: No

JIRA Issue: Yes CAS-4770, CAS-4774

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...

Updated STApplyCal to be able to specify interpolation method.
The method can be specified in time and frequency axes independently.
Possible options are nearest, linear (default), (natural) cubic spline,
and polynomial with arbitrary order.

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