casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CalibratingVi2.h
Go to the documentation of this file.
1 //# CalibratingVi2.h: Interface definition of the CalibratingVi2 class.
2 //#
3 //# CASA - Common Astronomy Software Applications (http://casa.nrao.edu/)
4 //# Copyright (C) Associated Universities, Inc. Washington DC, USA 2011, All rights reserved.
5 //# Copyright (C) European Southern Observatory, 2011, All rights reserved.
6 //#
7 //# This library is free software; you can redistribute it and/or
8 //# modify it under the terms of the GNU Lesser General Public
9 //# License as published by the Free software Foundation; either
10 //# version 2.1 of the License, or (at your option) any later version.
11 //#
12 //# This library is distributed in the hope that it will be useful,
13 //# but WITHOUT ANY WARRANTY, without even the implied warranty of
14 //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 //# Lesser General Public License for more details.
16 //#
17 //# You should have received a copy of the GNU Lesser General Public
18 //# License along with this library; if not, write to the Free Software
19 //# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 //# MA 02111-1307 USA
21 //# $Id: $
22 
23 #ifndef CalibratingVi2_H_
24 #define CalibratingVi2_H_
25 
26 // Where TransformingVi2 interface is defined
30 
31 #include <casa/Containers/Record.h>
32 
33 namespace casa { //# NAMESPACE CASA - BEGIN
34 namespace vi { //# NAMESPACE VI - BEGIN
35 
37 
38 // TBD: add solve-context parameters, like apply pivot (solved-for term), normalization
39 
40 public:
41 
43 
44  CalibratingParameters(const casacore::Record& calLibRecord);
46  CalibratingParameters(casacore::Float corrFactor); // temporary, for initial testing
47 
50 
51  casacore::Bool byCalLib() const;
52 
53  const casacore::Record& getCalLibRecord() const;
55 
56  void setCalLibRecord(const casacore::Record& calLibRecord);
57  void setCorrFactor(casacore::Float corrFactor);
58 
59 private:
60 
61  void validate() const;
64  casacore::Float corrFactor_p; // temporary, for initial testing
65 };
66 
67 
68 
69 
71 {
72 
73 public:
74 
76  const CalibratingParameters& calpar);
77 
78  // From cal pars and an MS (used by OTF calibration outside synthesis)
80  const CalibratingParameters& calpar,
81  casacore::String msname);
82 
83  // From a VE pointer (used within synthesis, e.g., for solving)
85  VisEquation *ve);
86 
88 
89  // Report the the ViImplementation type
90  virtual casacore::String ViiType() const { return casacore::String("Cal( ")+getVii()->ViiType()+" )"; };
91 
92 
93  // Iterating management
94  virtual void origin ();
95  virtual void next ();
96 
97  // Smart corrected data/weights/flags accessors
98  virtual void weight(casacore::Matrix<casacore::Float>& wt) const;
99  virtual void weightSpectrum(casacore::Cube<casacore::Float>& wtsp) const;
101  virtual void flag(casacore::Cube<casacore::Bool>& flagC) const;
102  // virtual void flag(casacore::Matrix<casacore::Bool>& flagM) const; // CORR-INDEP FLAGS DEPRECATED IN VI2/VB2?
103 
104  // Reports true in case of *Corrected columns
105  // (because this class provides it, even if it doesn't exist physically!)
107 
108 protected:
109 
110  // Correct the current VB
111  virtual void calibrateCurrentVB() const;
112 
113  // Initialize corrected data member to raw data
114  // (this method is sensitive to DATA vs. FLOAT_DATA
115  virtual void initCorrected(casa::vi::VisBuffer2* vb) const;
116 
117  // Calibrater and VisEquation
120 
121  // A simple factor for testing
123 
124  // signals whether or not correctCurrentVB has been called
126 
127 };
128 
130 
131  public:
132 
134 
135  virtual ~CalVi2LayerFactory () {}
136 
137  protected:
138 
139  // CalVi2-specific layer-creater
140  //
141  virtual ViImplementation2 * createInstance (ViImplementation2* vii0) const;
142 
143  // Store a copy of the parameters
145 
146 
147 };
148 
150 {
151 
152 public:
153 
155  const CalibratingParameters& calpar);
156 
158  const CalibratingParameters& calpar,
159  casacore::String msname);
160 
162  VisEquation *ve);
163 
164  ~CalSolvingVi2();
165 
166 
167  // Iterating management
168  virtual void originChunks(casacore::Bool forceRewind = false);
169  virtual void origin ();
170  virtual void next ();
171 
172  // Report the the ViImplementation type
173  virtual casacore::String ViiType() const {
174  return casacore::String("CalForSolve( ")+getVii()->ViiType()+" )";
175  }
176 
177  // Weight spectrum exists _by_defn_ in the solving context
178  // (it is generated by verifyWeightSpectrum() below)
179  virtual casacore::Bool weightSpectrumExists () const { return true; };
180 
181  // Cal solving also involve modified model data
182  virtual void visibilityModel(casacore::Cube<casacore::Complex>& vis) const;
183 
184 private:
185 
186  // specialized cal application for solving
187  virtual void calibrateCurrentVB() const;
188 
189  // Flag all corrs if any one is flagged (OLD style)
190  virtual void corrIndepFlags(casa::vi::VisBuffer2* vb) const;
191 
192  // Ensure weightSpectrum is populated
193  virtual void verifyWeightSpectrum(casa::vi::VisBuffer2* vb) const;
194 
195  // Sample counters
199 
200 
201 };
202 
203 
205 
206  public:
207 
209 
211 
212  protected:
213 
214  // CalSolvingVi2-specific layer-creater
215  virtual ViImplementation2 * createInstance (ViImplementation2* vii0) const;
216 
217 };
218 
220 
221  public:
222 
223  CalSolvingVi2LayerFactoryByVE(VisEquation* ve); // From a VE pointer in calling scope
224 
226 
227  protected:
228 
229  // CalSolvingVi2-specific layer-creater
230  virtual ViImplementation2 * createInstance (ViImplementation2* vii0) const;
231 
232  private:
233 
235 
236 };
237 
238 
239 
240 
241 } //# NAMESPACE VI - END
242 } //# NAMESPACE CASA - END
243 
244 
245 #endif /* CalibratingVi2_H_ */
246 
virtual void verifyWeightSpectrum(casa::vi::VisBuffer2 *vb) const
Ensure weightSpectrum is populated.
virtual casacore::String ViiType() const
Report the the ViImplementation type.
CalibratingParameters & operator=(const CalibratingParameters &other)
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
virtual casacore::Bool weightSpectrumExists() const
Weight spectrum exists by_defn in the solving context (it is generated by verifyWeightSpectrum() belo...
virtual void originChunks(casacore::Bool forceRewind=false)
Iterating management.
casacore::Int64 nskipped_
casacore::Bool byCalLib() const
const CalibratingParameters calpars_
Store a copy of the parameters.
virtual casacore::String ViiType() const
Report the the ViImplementation type.
void setCorrFactor(casacore::Float corrFactor)
Calibrater * cb_p
Calibrater and VisEquation.
casacore::Double Tcalfl_
virtual void visibilityCorrected(casacore::Cube< casacore::Complex > &vis) const
Return the visibilities as found in the casacore::MS, casacore::Cube (npol,nchan,nrow).
virtual void flag(casacore::Cube< casacore::Bool > &flagC) const
Return flag for each polarization, channel and row.
CalVi2LayerFactory(const CalibratingParameters &calpars)
casacore::Double Tcalws_
casacore::Float corrFactor_p
A simple factor for testing.
casacore::Double Tcal2_
virtual void origin()
Iterating management.
virtual ViImplementation2 * createInstance(ViImplementation2 *vii0) const
CalSolvingVi2-specific layer-creater.
virtual void weight(casacore::Matrix< casacore::Float > &wt) const
Smart corrected data/weights/flags accessors.
virtual ViImplementation2 * createInstance(ViImplementation2 *vii0) const
CalVi2-specific layer-creater.
double Double
Definition: aipstype.h:55
void setCalLibRecord(const casacore::Record &calLibRecord)
casacore::Double Tio_
CalibratingParameters()
TBD: add solve-context parameters, like apply pivot (solved-for term), normalization.
virtual void visibilityModel(casacore::Cube< casacore::Complex > &vis) const
Cal solving also involve modified model data.
CalSolvingVi2LayerFactory(const CalibratingParameters &calpars)
A hierarchical collection of named fields of various types.
Definition: Record.h:180
ViImplementation2 * getVii() const
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
CalSolvingVi2(vi::ViImplementation2 *inputVii, const CalibratingParameters &calpar)
virtual void calibrateCurrentVB() const
Correct the current VB.
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
float Float
Definition: aipstype.h:54
virtual void initCorrected(casa::vi::VisBuffer2 *vb) const
Initialize corrected data member to raw data (this method is sensitive to DATA vs.
casacore::Int64 nflagged_
const casacore::Record & getCalLibRecord() const
virtual casacore::Bool existsColumn(VisBufferComponent2 id) const
virtual void flag(casacore::Matrix&lt;casacore::Bool&gt;&amp; flagM) const; // CORR-INDEP FLAGS DEPRECATED IN V...
VisBuffer2s encapsulate one chunk of visibility data for processing.
Definition: VisBuffer2.h:141
virtual void corrIndepFlags(casa::vi::VisBuffer2 *vb) const
Flag all corrs if any one is flagged (OLD style)
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
virtual void origin()
Iterating management.
virtual casacore::String ViiType() const =0
Report the the ViImplementation type.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
CalibratingVi2(vi::ViImplementation2 *inputVii, const CalibratingParameters &calpar)
casacore::Float getCorrFactor() const
casacore::Bool visCalibrationOK_p
signals whether or not correctCurrentVB has been called
virtual void calibrateCurrentVB() const
specialized cal application for solving
virtual void weightSpectrum(casacore::Cube< casacore::Float > &wtsp) const
Return weightspectrum (a weight for each channel)
virtual ViImplementation2 * createInstance(ViImplementation2 *vii0) const
CalSolvingVi2-specific layer-creater.
casacore::Int64 ntotal_
Sample counters.