casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CTPatchedInterp.h
Go to the documentation of this file.
1 //# CTPatchedInterp.h: Definition for Calibration patch panel
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_CTPATCHEDINTERP_H
29 #define CALTABLES_CTPATCHEDINTERP_H
30 
36 #include <casa/Arrays/Array.h>
37 #include <casa/Arrays/Matrix.h>
38 #include <casa/Arrays/Cube.h>
42 #include <casa/aips.h>
43 
44 //#include <casa/BasicSL/Constants.h>
45 //#include <casa/OS/File.h>
46 //#include <casa/Logging/LogMessage.h>
47 //#include <casa/Logging/LogSink.h>
48 
49 namespace casa { //# NAMESPACE CASA - BEGIN
50 
51 
53 {
54 public:
55 
56  // From NewCalTable only
60  const casacore::String& timetype,
61  const casacore::String& freqtype,
62  const casacore::String& fieldtype,
65  const CTTIFactoryPtr cttifactoryptr=&CTTimeInterp1::factory);
66 
67  // From NewCalTable and casacore::MS
70  casacore::Int nPar,
71  const casacore::String& timetype,
72  const casacore::String& freqtype,
73  const casacore::String& fieldtype,
74  const casacore::MeasurementSet& ms,
76  const CTTIFactoryPtr cttifactoryptr=&CTTimeInterp1::factory);
77 
78  // From NewCalTable and casacore::MSColumns
81  casacore::Int nPar,
82  const casacore::String& timetype,
83  const casacore::String& freqtype,
84  const casacore::String& fieldtype,
85  const casacore::ROMSColumns& mscol,
87  const CTTIFactoryPtr cttifactoryptr=&CTTimeInterp1::factory);
88 
89 
90  // Destructor
91  virtual ~CTPatchedInterp();
92 
93  // Interpolate, given input field, spw, timestamp, & (optionally) freq list
94  // returns T if new result (anywhere)
97 
98  // Access to the result
102 
103  // Temporary public function for testing
106 
107  // spwOK info for users
110 
111  // Const access to various state
112  // TBD
113 
114  // Report state
115  void state();
116 
117 private:
118 
119  // Null ctor does nothing
121  mtype_(VisCalEnum::GLOBAL),
123 
124  // Setup methods
125  void sliceTable();
126  void makeInterpolators();
127 
128  casacore::Int thisobs(casacore::Int obs) { return (byObs_?obs:0); };
129 
130  // Methods to set up 1:1 patch-panel maps
131  // Private for now as not yet ready to control from outside
132  // Field
133  // default: all 0 (no field-dep yet)
135  void setFldMap(const casacore::MSField& msfld); // via nearest on-sky
136  void setFldMap(const casacore::ROMSFieldColumns& fcol); // via nearest on-sky
137  void setFldMap(casacore::Vector<casacore::Int>& fldmap); // via ordered index list
138  //void setFldMap(casacore::Vector<casacore::String>& field); // via name matching
139  //void setFldMap(casacore::uInt to, casacore::uInt from); // via single to/from
140 
141  // Calculate fldmap redundancy, enabling reuse
142  void calcAltFld();
143 
144  // Spw
145  // default: indgen (index identity)
148  //void setSpwMap(casacore::Vector<casacore::Double>& refFreqs); // via refFreq matching
149  //void setSpwMap(casacore::uInt to, casacore::uInt from); // via single to/from
150 
151  // Antenna
152  // default: indgen (index identity)
154  //void setAntMap(casacore::Vector<casacore::Int>& ant); // via ordered index list
155  //void setAntMap(casacore::Vector<casacore::String>& ant); // via name/station matching
156  //void setAntMap(casacore::uInt to, casacore::uInt from); // via single to/from
157 
158  // Set generic antenna/baseline map
159  void setElemMap();
160 
161  // Resample in frequency
166 
167  // Baseline index from antenna indices: (assumes a1<=a2 !!)
168  inline casacore::Int blnidx(const casacore::Int& a1, const casacore::Int& a2, const casacore::Int& nAnt) { return a1*nAnt-a1*(a1+1)/2+a2; };
169 
170  // Translate freq axis interpolation string
172 
173 
174  // PRIVATE DATA:
175 
176  // The Caltable
178 
179  // casacore::Matrix type
181 
182  // Are parameters fundamentally complex?
184 
185  // The number of (casacore::Float) parameters (per-chan, per-element)
187 
188  // Interpolation modes
190 
191  // Relative-to-center interpolation
193 
194  // Freq-dep interpolation method (from InterpolateArray1D enum)
195 #define INTERPMETHOD casacore::InterpolateArray1D<casacore::Double,casacore::Float>::InterpolationMethod
196  const INTERPMETHOD freqInterpMethod0_; // user-specified
199 
200  // Are we slicing caltable by field?
202 
203  // CalTable freq axis info
206 
207 
208  // Obs, Field, Spw, Ant _output_ (casacore::MS) sizes
209  // calibration required for up to this many
211 
212  // Alternate field indices
214 
215  // Obs, Field, Spw, Ant _input_ (CalTable) sizes
216  // patch panels should not violate these (point to larger indices)
218 
219  // OK flag
221 
222  // The patch panels
223  // Each has length from casacore::MS, values refer to CT
225 
226  // Control conjugation of baseline-based solutions when mapping requires
228 
229  // Internal result Arrays
230  casacore::Cube<casacore::Cube<casacore::Float> > timeResult_,freqResult_; // [nMSSpw_,nMSFld_,nMSObs_][nFpar,nChan,nAnt]
231  casacore::Cube<casacore::Cube<casacore::Bool> > timeResFlag_,freqResFlag_; // [nMSSpw_,nMSFld_,nMSObs_][nFpar,nChan,nAnt]
232 
233  // Current interpolation result Arrays
234  // These will reference time or freq result, depending on context,
235  // and may be referenced by external code
236  casacore::Cube<casacore::Cube<casacore::Float> > result_; // [nMSSpw_,nMSFld_,nMSObs_][nFpar,nChan,nAnt]
237  casacore::Cube<casacore::Cube<casacore::Bool> > resFlag_; // [nMSSpw_,nMSFld_,nMSObs_][nFpar,nChan,nAnt]
238 
239  // The CalTable slices
240  casacore::Array<NewCalTable*> ctSlices_; // [nCTElem_,nCTSpw_,nCTFld_,nCTObs_]
241 
242  // The pre-patched casacore::Time interpolation engines
243  // These are populated by the available caltables slices
244  casacore::Array<CTTimeInterp1*> tI_; // [nMSElem_,nMSSpw_,nMSFld_,nMSObs_]
245  casacore::Array<casacore::Bool> tIdel_; // [nMSElem_,nMSSpw_,nMSFld_,mMSObs_]
246 
248 
249  // Pointer to the factory to use to create CTTimeInterp1s (or specializations)
251 
252 };
253 
254 
255 } //# NAMESPACE CASA - END
256 
257 #endif
casacore::Cube< casacore::Cube< casacore::Float > > freqResult_
casacore::Vector< casacore::Int > nChanIn_
CalTable freq axis info.
casacore::Array< casacore::Complex > c()
Render casacore::Complex version (calc from casacore::Float, if necessary)
int Int
Definition: aipstype.h:50
casacore::InterpolateArray1D< casacore::Double, casacore::Float >::InterpolationMethod ftype(casacore::String &strtype)
Translate freq axis interpolation string.
casacore::Array< casacore::Bool > & rflag(casacore::Int obs, casacore::Int fld, casacore::Int spw)
CTTimeInterp1 *(* CTTIFactoryPtr)(NewCalTable &, const casacore::String &, casacore::Array< casacore::Float > &, casacore::Array< casacore::Bool > &)
Pointer to static factory methods for CTTimeInterp1.
casacore::Bool isCmplx_
Are parameters fundamentally complex?
void setDefSpwMap()
Spw default: indgen (index identity)
casacore::Int nCTObs_
Obs, Field, Spw, Ant input (CalTable) sizes patch panels should not violate these (point to larger in...
A class to provide easy access to MSField columns.
casacore::Vector< casacore::Int > fldMap_
The patch panels Each has length from casacore::MS, values refer to CT.
casacore::Cube< casacore::Cube< casacore::Float > > result_
Current interpolation result Arrays These will reference time or freq result, depending on context...
void setDefAntMap()
void setSpwMap(casacore::Vector&lt;casacore::Double&gt;&amp; refFreqs); // via refFreq matching void setSpwMap(...
casacore::Bool spwOK(casacore::Int spw) const
spwOK info for users
casacore::Bool relativeFreq_
Relative-to-center interpolation.
CTTIFactoryPtr cttifactoryptr_
Pointer to the factory to use to create CTTimeInterp1s (or specializations)
A 3-D Specialization of the Array class.
casacore::Vector< INTERPMETHOD > freqInterpMethodVec_
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
NewCalTable ct_
PRIVATE DATA:
virtual casacore::Int nPar()
M currently has just 2 complex parameters, i.e., both parallel hands.
void state()
Const access to various state TBD.
void resampleInFreq(casacore::Matrix< casacore::Float > &fres, casacore::Matrix< casacore::Bool > &fflg, const casacore::Vector< casacore::Double > &fout, casacore::Matrix< casacore::Float > &tres, casacore::Matrix< casacore::Bool > &tflg, const casacore::Vector< casacore::Double > &fin)
Resample in frequency.
void setSpwMap(casacore::Vector< casacore::Int > &spwmap)
casacore::Bool byObs_
Are we slicing caltable by field?
Interpolate in one dimension.
casacore::Vector< casacore::Int > spwMap_
casacore::Array< casacore::Bool > & tresultFlag(casacore::Int obs, casacore::Int fld, casacore::Int spw)
virtual ~CTPatchedInterp()
Destructor.
casacore::Cube< casacore::Cube< casacore::Bool > > resFlag_
casacore::Array< casacore::Complex > resultC(casacore::Int obs, casacore::Int fld, casacore::Int spw)
casacore::Cube< casacore::Cube< casacore::Bool > > freqResFlag_
InterpolationMethod
Interpolation methods.
casacore::Vector< casacore::Int > antMap_
casacore::Bool interpolate(casacore::Int obs, casacore::Int fld, casacore::Int spw, casacore::Double time, casacore::Double freq=-1.0)
Interpolate, given input field, spw, timestamp, &amp; (optionally) freq list returns T if new result (any...
casacore::Cube< casacore::Cube< casacore::Bool > > timeResFlag_
casacore::Bool spwInOK(casacore::Int spw) const
const INTERPMETHOD freqInterpMethod0_
casacore::String freqTypeStr_
double Double
Definition: aipstype.h:55
A class to provide easy read-only access to MeasurementSet columns.
Definition: MSColumns.h:111
static CTTimeInterp1 * factory(NewCalTable &ct, const casacore::String &timetype, casacore::Array< casacore::Float > &result, casacore::Array< casacore::Bool > &rflag)
static factory method to make CTTimeInterp1
Definition: CTTimeInterp1.h:73
casacore::Array< CTTimeInterp1 * > tI_
The pre-patched casacore::Time interpolation engines These are populated by the available caltables s...
casacore::Array< casacore::Bool > tIdel_
casacore::Vector< casacore::Int > elemMap_
void resampleFlagsInFreq(casacore::Vector< casacore::Bool > &flgout, const casacore::Vector< casacore::Double > &fout, casacore::Vector< casacore::Bool > &flgin, const casacore::Vector< casacore::Double > &fin)
casacore::Vector< casacore::Int > lastObs_
casacore::Vector< casacore::Bool > conjTab_
Control conjugation of baseline-based solutions when mapping requires.
void indgen(TableVector< T > &tv, Int start, Int inc)
Definition: TabVecMath.h:400
casacore::Int nPar_
The number of (casacore::Float) parameters (per-chan, per-element)
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::Vector< casacore::Int > lastFld_
casacore::Array< NewCalTable * > ctSlices_
The CalTable slices.
void sliceTable()
Setup methods.
casacore::Cube< casacore::Cube< casacore::Float > > timeResult_
Internal result Arrays.
float Float
Definition: aipstype.h:54
casacore::Vector< casacore::Vector< casacore::Double > > freqIn_
casacore::Bool byField_
A Table intended to hold a MeasurementSet FIELD table.
Definition: MSField.h:78
A Table intended to hold astronomical data (a set of Measurements).
CTPatchedInterp()
Null ctor does nothing.
void setDefFldMap()
Methods to set up 1:1 patch-panel maps Private for now as not yet ready to control from outside Field...
casacore::Vector< casacore::Bool > spwInOK_
OK flag.
void set(const T &value)
Set every element of the array to &quot;value.&quot; Also could use the assignment operator which assigns an ar...
void setElemMap()
void setAntMap(casacore::Vector&lt;casacore::Int&gt;&amp; ant); // via ordered index list void setAntMap(casaco...
INTERPMETHOD freqInterpMethod_
casacore::Int blnidx(const casacore::Int &a1, const casacore::Int &a2, const casacore::Int &nAnt)
Baseline index from antenna indices: (assumes a1&lt;=a2 !!)
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Array< casacore::Float > & tresultF(casacore::Int obs, casacore::Int fld, casacore::Int spw)
Temporary public function for testing.
VisCalEnum::MatrixType mtype_
casacore::Matrix type
void setFldMap(const casacore::MSField &msfld)
void resize(size_t len, Bool copyValues=False)
Definition: Vector.h:167
casacore::Int thisobs(casacore::Int obs)
casacore::String timeType_
Interpolation modes.
#define INTERPMETHOD
Freq-dep interpolation method (from InterpolateArray1D enum)
casacore::Vector< casacore::Int > altFld_
Alternate field indices.
casacore::Int nMSObs_
Obs, Field, Spw, Ant output (casacore::MS) sizes calibration required for up to this many...
casacore::Array< casacore::Float > & resultF(casacore::Int obs, casacore::Int fld, casacore::Int spw)
Access to the result.
void calcAltFld()
void setFldMap(casacore::Vector&lt;casacore::String&gt;&amp; field); // via name matching void setFldMap(casaco...
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42