casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CalInterp.h
Go to the documentation of this file.
1 //# CalInterp.h: Definition for Calibration parameter Interpolation
2 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be adressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 
28 #ifndef CALTABLES_CALINTERP_H
29 #define CALTABLES_CALINTERP_H
30 #include <casa/aips.h>
31 #include <casa/BasicSL/Constants.h>
33 #include <casa/OS/File.h>
35 #include <casa/Logging/LogSink.h>
36 
37 namespace casa { //# NAMESPACE CASA - BEGIN
38 
39 
40 class CalInterp
41 {
42 public:
43 
44  // Null ctor does nothing
45  CalInterp() {};
46 
47  // From CalSet
49  const casacore::String& timetype,
50  const casacore::String& freqtype);
51 
52  // Destructor
53  virtual ~CalInterp();
54 
55 
56  // Set non-trivial spw mapping
57  void setSpwMap(const casacore::Vector<casacore::Int>& spwmap) {spwMap_ = spwmap; setSpwOK();};
58 
59  // Interpolate, given timestamp, spw, freq list; returns T if new result
61  const casacore::Int& spw,
63 
64  // Do time-dep interpolation (called by interpolate)
66 
67  // Do freq-dep interpolation (called by interpolate)
69 
70  // Timestamp of current Slot
72 
73  // Access to result (by reference)
76 
77  // Spwmap-sensitive spwOK()
79 
80  // Set spwOK_ according to spwmap RI made public 200910
81  void setSpwOK();
82 
83 protected:
84 
85  // Find the reference timeslot for requested time
87 
88  void updTimeCoeff();
89 
90  void interpTimeCalc(const casacore::Double& time);
91 
93 
94  void calcAPC();
95 
96  void updFreqCoeff();
97 
98  void interpFreqCalc();
99 
100  void finalize();
101 
102  void inflTimeC();
103  void inflFreqC();
104  void deflTimeC();
105  void deflFreqC();
106  void deflFreqA();
107 
108  // Access to private shape data (reflecting CalSet)
109  inline casacore::Int& nSpw() { return cs_->nSpw(); };
110  inline casacore::Int& nPar() { return cs_->nPar(); };
111  inline casacore::Int& nElem() { return cs_->nElem(); };
112 
113  // Access to imutable private data
114  inline casacore::String& timeType() { return timeType_; };
115  inline casacore::Bool nearestT() { return (timeType()=="nearest"); };
116  inline casacore::Bool linearT() { return (timeType()=="linear"); };
117  inline casacore::Bool aipslinT() { return (timeType()=="aipslin"); };
118  inline casacore::String& freqType() { return freqType_; };
119  inline casacore::Bool nearestF() { return (freqType()=="nearest"); };
120  inline casacore::Bool linearF() { return (freqType()=="linear"); };
121  inline casacore::Bool aipslinF() { return (freqType()=="aipslin"); };
122 
124  inline casacore::Int spwMap(const casacore::Int& spw) { return ((spwMap_(spw)>-1) ? spwMap_(spw) : spw); };
125 
126  // Access to info relevant to currSpw
127  inline casacore::Int& currSpw() { return currSpw_; };
128  inline casacore::Int currSpwMap() { return spwMap(currSpw()); };
129  inline casacore::Int& currSlot() { return currSlot_(currSpw()); };
130  inline casacore::Int& nFreq() { return nFreq_(currSpw()); };
132  inline casacore::Bool& finit() { return finit_(currSpw()); };
133  inline casacore::Double& lastTime() { return lastTime_(currSpw_); };
134  inline casacore::Bool& exactTime() { return exactTime_; };
135 
136  // Access to in-focus portion of CalSet (spwmap'd)
137  inline casacore::Int& nTime() { return cs_->nTime(currSpwMap()); };
138  inline casacore::Int& nChan() { return cs_->nChan(currSpwMap()); }
143 
144  // Access to IPositions
145  inline casacore::IPosition& ip4d() { return (*ip4d_[currSpw_]); };
146  inline casacore::IPosition& ip3d() { return (*ip3d_[currSpw_]); };
147  inline casacore::IPosition& ip2d() { return (*ip2d_[currSpw_]); };
148 
149  // Access to in-focus interpolation abscissa data
150  inline casacore::Double& t0() {return t0_(currSpw_);};
151  inline casacore::Double& tS() {return tS_(currSpw_);};
152  inline casacore::Int& lastlo() {return lastlo_(currSpw_); };
153 
158 
159  // In-focus casacore::Time Interpolation coefficients
160  inline casacore::Array<casacore::Float>& tAC() {return (*tAC_[currSpw()]); };
161  inline casacore::Array<casacore::Float>& tPC() {return (*tPC_[currSpw()]); };
163  inline casacore::Cube<casacore::Bool>& tOk() {return (*tOk_[currSpw()]); };
164 
165  // In-focus Freq Interpolation coefficients
166  inline casacore::Array<casacore::Float>& fAC() {return (*fAC_[currSpw()]); };
167  inline casacore::Array<casacore::Float>& fPC() {return (*fPC_[currSpw()]); };
169  inline casacore::Cube<casacore::Bool>& fOk() {return (*fOk_[currSpw()]); };
170 
173 
175 
177 
178 private:
179 
180  // The CalSet from which we interpolate
182 
183  // Interpolation modes
185 
186  // Spw map
188 
189  // SpwOK
191 
192  // Prior interp time, per spw
194 
195  // Frequency initialization flag (true if init complete)
197 
198  // Number of channels
199  casacore::Vector<casacore::Int> nFreq_; // (nSpw_) number of _data_ channels per spw
200 
201  // Freq lists
204 
207 
208  // Exact time match flag
210 
211  casacore::Cube<casacore::Float> a,p; // For referencing interp results
214 
216 
217  // casacore::Array shapes
221 
222  // casacore::Time Interpolation ordinate info (per spw)
226 
227  // casacore::Time Interpolation coefficients (per spw)
231 
232  // casacore::Time Interpolation results (currSpw)
233  casacore::Cube<casacore::Float> tA_, tP_; // (nPar,nChan,nElem)
234  casacore::Cube<casacore::Complex> tC_; // (nPar,nChan,nElem)
235 
236  // Freq Interpolation ordinate info (per spw)
241 
242  // Freq Interpolation coefficients (per spw)
246 
247  // Freq Interpolation results (currSspw)
248  casacore::Cube<casacore::Float> fA_, fP_; // (nPar,nFreq,nElem)
249  casacore::Cube<casacore::Complex> fC_; // (nPar,nFreq,nElem)
250 
253 
255 
256 };
257 
258 
259 } //# NAMESPACE CASA - END
260 
261 #endif
casacore::Bool aipslinF()
Definition: CalInterp.h:121
void asFloatArr(const casacore::Array< casacore::Complex > &in, casacore::Array< casacore::Float > &out)
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
casacore::Array< casacore::Bool > & parOK(const casacore::Int &spw)
Definition: CalSet.h:126
casacore::Cube< casacore::Float > p
Definition: CalInterp.h:211
casacore::PtrBlock< casacore::Cube< casacore::Bool > * > tOk_
Definition: CalInterp.h:230
CalInterp()
Null ctor does nothing.
Definition: CalInterp.h:45
casacore::String & timeType()
Access to imutable private data.
Definition: CalInterp.h:114
int Int
Definition: aipstype.h:50
void interpFreqCalc()
casacore::Vector< casacore::Double > t0_
casacore::Time Interpolation ordinate info (per spw)
Definition: CalInterp.h:223
casacore::Cube< casacore::Float > a
Definition: CalInterp.h:211
void rPart(casacore::Array< casacore::Complex > &c, casacore::Array< casacore::Float > &rp)
Definition: CalInterp.h:171
casacore::Double & lastTime()
Definition: CalInterp.h:133
void initFreqInterp(const casacore::Vector< casacore::Double > freq)
casacore::Bool linearT()
Definition: CalInterp.h:116
casacore::Array< casacore::Float > & fPC()
Definition: CalInterp.h:167
casacore::Bool & exactTime()
Definition: CalInterp.h:134
casacore::Array< T > & par(const casacore::Int &spw)
Definition: CalSet.h:125
void interpFreq(const casacore::Vector< casacore::Double > &freq)
Do freq-dep interpolation (called by interpolate)
casacore::Vector< casacore::Double > lastTime_
Prior interp time, per spw.
Definition: CalInterp.h:193
casacore::Int & currSlot()
Definition: CalInterp.h:129
virtual ~CalInterp()
Destructor.
ABSTRACT TOOL CLASSES A PlotTool is a higher level event handler for a PlotCanvas The idea is to take common tasks which may require multiple events and put them in one place PlotTools also provide additional functionality in that they can be active and blocking non blocking The PlotCanvas will only send events to active and will not send events to later tools or event handlers if the latest tool was blocking In this way a single tool can be used to handle ALL user interaction via the GUI at one time
Definition: PlotTool.h:43
casacore::Bool exactTime_
Exact time match flag.
Definition: CalInterp.h:209
casacore::PtrBlock< casacore::Array< casacore::Float > * > tPC_
Definition: CalInterp.h:228
casacore::IPosition & ip4d()
Access to IPositions.
Definition: CalInterp.h:145
casacore::Vector< casacore::Double > & datFreq()
Definition: CalInterp.h:131
casacore::PtrBlock< casacore::IPosition * > ip3d_
Definition: CalInterp.h:219
casacore::Cube< casacore::Complex > r_
Definition: CalInterp.h:215
casacore::Double & tS()
Definition: CalInterp.h:151
casacore::Bool nearestF()
Definition: CalInterp.h:119
casacore::Bool verbose_
Definition: CalInterp.h:252
casacore::IPosition & ip3d()
Definition: CalInterp.h:146
casacore::Int currSpwMap()
Definition: CalInterp.h:128
void setSpwMap(const casacore::Vector< casacore::Int > &spwmap)
Set non-trivial spw mapping.
Definition: CalInterp.h:57
casacore::Cube< casacore::Bool > ok
Definition: CalInterp.h:213
casacore::Cube< casacore::Float > fP_
Definition: CalInterp.h:248
casacore::Vector< casacore::Int > currSlot_
Definition: CalInterp.h:206
casacore::Cube< casacore::Float > tA_
casacore::Time Interpolation results (currSpw)
Definition: CalInterp.h:233
void part(const casacore::Array< casacore::Complex > &c, const casacore::Int &which, casacore::Array< casacore::Float > &f)
casacore::Bool nearestT()
Definition: CalInterp.h:115
casacore::Vector< casacore::Bool > & ef()
Definition: CalInterp.h:155
casacore::PtrBlock< casacore::Vector< casacore::Bool > * > ef_
Definition: CalInterp.h:238
casacore::Int spwMap(const casacore::Int &spw)
Definition: CalInterp.h:124
casacore::Vector< casacore::Double > & csTimes()
Definition: CalInterp.h:139
casacore::Bool interpTime(const casacore::Double &time)
Do time-dep interpolation (called by interpolate)
casacore::Cube< casacore::Float > fA_
Freq Interpolation results (currSspw)
Definition: CalInterp.h:248
casacore::Cube< casacore::Complex > fC_
Definition: CalInterp.h:249
casacore::Array< casacore::Float > & tPC()
Definition: CalInterp.h:161
casacore::IPosition & ip2d()
Definition: CalInterp.h:147
casacore::Vector< casacore::Double > & fdf()
Definition: CalInterp.h:157
casacore::Int & nChan()
Definition: CalInterp.h:138
casacore::Int & nFreq()
Definition: CalInterp.h:130
casacore::Bool linearF()
Definition: CalInterp.h:120
casacore::Int & nTime()
Access to in-focus portion of CalSet (spwmap&#39;d)
Definition: CalInterp.h:137
casacore::Cube< casacore::Bool > & resultOK()
Definition: CalInterp.h:75
casacore::Vector< casacore::Bool > finit_
Frequency initialization flag (true if init complete)
Definition: CalInterp.h:196
casacore::Vector< casacore::Int > spwMap_
Spw map.
Definition: CalInterp.h:187
casacore::Int & nSpw()
Access to shape info:
Definition: CalSet.h:94
double Double
Definition: aipstype.h:55
casacore::Bool & finit()
Definition: CalInterp.h:132
casacore::PtrBlock< casacore::IPosition * > ip2d_
Definition: CalInterp.h:220
casacore::Cube< casacore::Bool > & tOk()
Definition: CalInterp.h:163
casacore::Vector< casacore::Int > & nChan()
Definition: CalSet.h:96
casacore::PtrBlock< casacore::Array< casacore::Complex > * > tCC_
Definition: CalInterp.h:229
casacore::Int & nElem()
Definition: CalInterp.h:111
casacore::Vector< casacore::Int > lastlo_
Definition: CalInterp.h:225
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::Vector< casacore::Double > tS_
Definition: CalInterp.h:224
casacore::PtrBlock< casacore::IPosition * > ip4d_
casacore::Array shapes
Definition: CalInterp.h:218
casacore::Array< casacore::Bool > & csParOK()
Definition: CalInterp.h:142
casacore::Vector< casacore::Double > & csFreq()
Definition: CalInterp.h:140
casacore::Vector< casacore::Double > & df()
Definition: CalInterp.h:156
casacore::Cube< casacore::Float > tP_
Definition: CalInterp.h:233
casacore::Cube< casacore::Complex > & result()
Access to result (by reference)
Definition: CalInterp.h:74
casacore::Int currSpw_
Definition: CalInterp.h:205
casacore::PtrBlock< casacore::Array< casacore::Float > * > fPC_
Definition: CalInterp.h:243
A drop-in replacement for Block&lt;T*&gt;.
Definition: WProjectFT.h:54
casacore::Array< casacore::Float > & fAC()
In-focus Freq Interpolation coefficients.
Definition: CalInterp.h:166
casacore::LogSink logSink_p
Definition: CalInterp.h:251
casacore::Bool interpolate(const casacore::Double &time, const casacore::Int &spw, const casacore::Vector< casacore::Double > &freq=casacore::Vector< casacore::Double >())
Interpolate, given timestamp, spw, freq list; returns T if new result.
casacore::Int & nPar()
Definition: CalSet.h:95
casacore::Double slotTime()
Timestamp of current Slot.
Definition: CalInterp.h:71
void interpTimeCalc(const casacore::Double &time)
casacore::Vector< casacore::Int > nFreq_
Number of channels.
Definition: CalInterp.h:199
casacore::PtrBlock< casacore::Array< casacore::Float > * > fAC_
Freq Interpolation coefficients (per spw)
Definition: CalInterp.h:243
casacore::PtrBlock< casacore::Cube< casacore::Bool > * > fOk_
Definition: CalInterp.h:245
casacore::PtrBlock< casacore::Array< casacore::Float > * > tAC_
casacore::Time Interpolation coefficients (per spw)
Definition: CalInterp.h:228
casacore::PtrBlock< casacore::Vector< casacore::Double > * > df_
Definition: CalInterp.h:239
casacore::Bool findSlot(const casacore::Double &time)
Find the reference timeslot for requested time.
casacore::Vector< casacore::Bool > spwOK()
Spwmap-sensitive spwOK()
Definition: CalInterp.h:78
casacore::Vector< casacore::Int > & nTime()
Definition: CalSet.h:99
casacore::PtrBlock< casacore::Array< casacore::Complex > * > fCC_
Definition: CalInterp.h:244
casacore::String timeType_
Interpolation modes.
Definition: CalInterp.h:184
casacore::Vector< casacore::Double > & frequencies(const casacore::Int &spw)
Freq list per spw.
Definition: CalSet.h:112
casacore::Array< casacore::Float > & tAC()
In-focus casacore::Time Interpolation coefficients.
Definition: CalInterp.h:160
casacore::Vector< casacore::Int > & spwMap()
Definition: CalInterp.h:123
casacore::Cube< casacore::Complex > r
Definition: CalInterp.h:215
Distribute LogMessages to their destination(s)
Definition: LogSink.h:141
casacore::Int & lastlo()
Definition: CalInterp.h:152
void setSpwOK()
Set spwOK_ according to spwmap RI made public 200910.
casacore::Vector< casacore::Int > & ch0()
Definition: CalInterp.h:154
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Bool aipslinT()
Definition: CalInterp.h:117
casacore::PtrBlock< casacore::Vector< casacore::Double > * > solFreq_
Freq lists.
Definition: CalInterp.h:202
void iPart(casacore::Array< casacore::Complex > &c, casacore::Array< casacore::Float > &ip)
Definition: CalInterp.h:172
casacore::Array< casacore::Complex > & tCC()
Definition: CalInterp.h:162
casacore::Cube< casacore::Complex > c
Definition: CalInterp.h:212
casacore::Int & nPar()
Definition: CalInterp.h:110
casacore::String & freqType()
Definition: CalInterp.h:118
casacore::PtrBlock< casacore::Vector< casacore::Double > * > datFreq_
Definition: CalInterp.h:203
casacore::LogSink & logSink()
Definition: CalInterp.h:252
casacore::Cube< casacore::Complex > tC_
Definition: CalInterp.h:234
casacore::Array< casacore::Complex > & csPar()
Definition: CalInterp.h:141
casacore::Int & nElem()
Definition: CalSet.h:98
casacore::Int & nSpw()
Access to private shape data (reflecting CalSet)
Definition: CalInterp.h:109
casacore::Vector< casacore::Bool > spwOK_
SpwOK.
Definition: CalInterp.h:190
casacore::Vector< casacore::Double > & time(const casacore::Int &spw)
Definition: CalSet.h:121
casacore::PtrBlock< casacore::Vector< casacore::Int > * > ch0_
Freq Interpolation ordinate info (per spw)
Definition: CalInterp.h:237
casacore::Double & t0()
Access to in-focus interpolation abscissa data.
Definition: CalInterp.h:150
casacore::Int & currSpw()
Access to info relevant to currSpw.
Definition: CalInterp.h:127
casacore::Array< casacore::Complex > & fCC()
Definition: CalInterp.h:168
casacore::String freqType_
Definition: CalInterp.h:184
casacore::PtrBlock< casacore::Vector< casacore::Double > * > fdf_
Definition: CalInterp.h:240
CalSet< casacore::Complex > * cs_
The CalSet from which we interpolate.
Definition: CalInterp.h:181
casacore::Cube< casacore::Bool > & fOk()
Definition: CalInterp.h:169