casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CalMainBuffer.h
Go to the documentation of this file.
1 //# CalMainBuffer.h: Calibration main table buffer
2 //# Copyright (C) 1996,1997,1998,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 //# $Id$
28 
29 #ifndef CALIBRATION_CALMAINBUFFER_H
30 #define CALIBRATION_CALMAINBUFFER_H
31 
36 #include <msvis/MSVis/MSCalEnums.h>
37 #include <msvis/MSVis/VisBuffer.h>
39 
40 namespace casa { //# NAMESPACE CASA - BEGIN
41 
42 // <summary>
43 // CalMainBuffer: Calibration main table buffer
44 // </summary>
45 
46 // <use visibility=export>
47 
48 // <reviewed reviewer="" date="" tests="" demos="">
49 
50 // <prerequisite>
51 // <li> <linkto class="CalTable">CalTable</linkto> module
52 // <li> <linkto class="CalIterBase">CalIterBase</linkto> module
53 // </prerequisite>
54 //
55 // <etymology>
56 // From "calibration main table" and "buffer"
57 // </etymology>
58 //
59 // <synopsis>
60 // The CalMainBuffer class holds a buffer, optionally connected to a
61 // calibration main table iterator (of base type CalIterBase).
62 // Specializations for baseline-based, time-variable and solvable
63 // VisJones calibration table formats are provided through
64 // inheritance.
65 // </synopsis>
66 //
67 // <example>
68 // <srcblock>
69 // </srcblock>
70 // </example>
71 //
72 // <motivation>
73 // Encapsulate calibration main table data buffers.
74 // </motivation>
75 //
76 // <todo asof="01/08/01">
77 // (i) Deal with non-standard columns.
78 // </todo>
79 
81 {
82  public:
83  // Default constructor. No connection to an underlying
84  // calibration table iterator in this case.
85  CalMainBuffer();
86 
87  // Construct from a set of calibration buffer indices and
88  // their specified values. Non-index columns will be set
89  // to default values. There is no connection to an underlying
90  // calibration table iterator in this case.
93 
94  // Construct from a calibration table iterator. The calibration
95  // buffer will remain synchronized with the iterator.
96  CalMainBuffer (CalIterBase& calIter);
97 
98  // Default destructor
99  virtual ~CalMainBuffer();
100 
101  // Synchronize the buffer (if attached to an iterator)
102  virtual void synchronize();
103 
104  // Force an explicit read to cache for all columns
105  // (if attached to an iterator)
106  virtual void fillCache();
107 
108  // Write the current buffer at the end of a specified cal table;
109  // returns the number of rows appended.
110  virtual casacore::Int append (CalTable& calTable);
111 
112  // Maximum number of rows in the calibration buffer
113  virtual casacore::Int nRow();
114 
115  // Accessors for the contained cal_desc and cal_history buffers
116  virtual CalDescBuffer& calDescBuffer() {return *calDescBuf_p;};
118 
119  // casacore::Data field accessors
151 
152  // Generic access to integer columns by MSCalEnums enumeration. Throws
153  // an exception if the column is not recognized or is not an integer column.
155 
156  // Generic access to string columns by MSCalEnums enumeration. Throws
157  // an exception if the column is not recognized or is not a string column.
159 
160  // Find the matching rows for a given antenna1 id.
162 
163  // Find the matching rows for a given antenna1 id. and field id. pair
165  const casacore::Int& fldId);
166 
167  // Find the matching rows for a given antenna1 id. and freq. group name
169  const casacore::String& frqGrpName);
170 
171  protected:
172  // Factory method to create a columns accessor object of the appropriate type
173  virtual CalMainColumns* newCalMainCol (CalTable& calTable)
174  {return new CalMainColumns (calTable);};
175 
176  // Access to the columns accessor object
177  virtual CalMainColumns* calMainCol() {return calMainCol_p;};
178 
179  // Is the buffer connected to an underlying iterator ?
181 
182  // Invalidate the current cache.
183  virtual void invalidate();
184 
185  // <group>
186  // Span an empty cal buffer by taking all permutations of the
187  // values of a specified set of cal indices, specified as
188  // enums from class MSCalEnums:
189  //
190  // Use a visibility buffer to define the index values
191  virtual void fillIndices (const casacore::Vector<casacore::Int>& calIndices,
192  const VisBuffer& vb);
193 
194  // Define the index values directly
195  virtual void fillIndices (const casacore::Vector<casacore::Int>& calIndices,
196  const casacore::Block<casacore::Vector<casacore::Int> >& indexValues);
197  // </group>
198 
199  // <group>
200  // Fill the cal buffer attribute columns in an empty cal buffer,
201  // after the cal indices have been set using fillIndices(). The
202  // cal indices, specified as enums from class MSCalEnums, are excluded
203  // as non-attribute columns.
204  //
205  // Use a visibility buffer to define the attribute values
206  virtual void fillAttributes(const casacore::Vector<casacore::Int>& calIndices,
207  const VisBuffer& vb);
208 
209  // Set default attribute values
210  virtual void fillAttributes(const casacore::Vector<casacore::Int>& calIndices);
211 
212  // </group>
213 
214  // Utility function to test for membership in a list of calibration enums
216  const casacore::Vector<casacore::Int>& excludeIndices);
217 
218  private:
219  // true if connected to underlying iterator
221 
222  // Ptr to calibration table iterator
224 
225  // Ptr to cal main columns accessor
227 
228  // Contained sub-table cal_desc and cal_history buffers
231 
232  // Buffer fields
264 
265  // Buffer field status flags
297 };
298 
299 
300 } //# NAMESPACE CASA - END
301 
302 #endif
303 
304 
305 
306 
307 
casacore::Bool excluded(const MSCalEnums::colDef &calEnum, const casacore::Vector< casacore::Int > &excludeIndices)
Utility function to test for membership in a list of calibration enums.
int Int
Definition: aipstype.h:50
casacore::Vector< casacore::Int > measFreqRef_p
casacore::Bool sourceCodeOK_p
casacore::Vector< casacore::Int > stateId_p
virtual casacore::Vector< casacore::String > & freqGrpName()
casacore::Vector< casacore::Int > pulsarGateId_p
casacore::Vector< casacore::String > sourceCode_p
casacore::Vector< casacore::Int > phaseId_p
casacore::Bool freqGrpNameOK_p
casacore::Vector< casacore::Int > calGrp_p
CalIterBase * calIter_p
Ptr to calibration table iterator.
casacore::Vector< casacore::Int > freqGrp_p
virtual casacore::Int append(CalTable &calTable)
Write the current buffer at the end of a specified cal table; returns the number of rows appended...
virtual casacore::Vector< casacore::Int > & arrayId()
virtual casacore::Vector< casacore::Int > & calGrp()
casacore::Array< casacore::Complex > gain_p
casacore::Vector< casacore::String > sourceName_p
casacore::Bool refFreqMeasOK_p
casacore::Bool fieldNameOK_p
casacore::Bool sourceNameOK_p
casacore::Array< casacore::MDirection > refDirMeas_p
virtual casacore::Array< casacore::Int > & refAnt()
virtual void invalidate()
Invalidate the current cache.
casacore::Bool pulsarGateIdOK_p
casacore::Bool connectedToIter()
Is the buffer connected to an underlying iterator ?
virtual casacore::Vector< casacore::String > & sourceCode()
virtual casacore::Vector< casacore::Int > & stateId()
casacore::Bool freqGrpOK_p
casacore::Vector< casacore::Int > pulsarBin_p
virtual casacore::Vector< casacore::Int > & asVecInt(const MSCalEnums::colDef &calEnum)
Generic access to integer columns by MSCalEnums enumeration.
casacore::Bool arrayIdOK_p
CalHistoryBuffer * calHistBuf_p
virtual casacore::Vector< casacore::String > & sourceName()
casacore::Vector< casacore::String > fieldName_p
casacore::Bool refReceptorOK_p
casacore::Bool feed1OK_p
virtual casacore::Array< casacore::Int > & refReceptor()
casacore::Vector< casacore::String > fieldCode_p
casacore::Vector< casacore::Int > calDescId_p
casacore::Bool timeEPQuantOK_p
casacore::Bool obsIdOK_p
casacore::Bool measFreqRefOK_p
casacore::Vector< casacore::Int > arrayId_p
casacore::Bool antenna1OK_p
casacore::Vector< casacore::Int > processorId_p
casacore::Vector< casacore::Int > scanNo_p
CalMainColumns * calMainCol_p
Ptr to cal main columns accessor.
virtual void fillIndices(const casacore::Vector< casacore::Int > &calIndices, const VisBuffer &vb)
Span an empty cal buffer by taking all permutations of the values of a specified set of cal indices...
CalTable: Calibration table access and creation.
Definition: CalTable.h:82
casacore::Vector< casacore::String > freqGrpName_p
casacore::Vector< casacore::Int > obsId_p
casacore::Bool intervalQuantOK_p
casacore::Array< casacore::MFrequency > refFreqMeas_p
casacore::Vector< casacore::Int > measDirRef_p
CalIterBase: Base class for calibration table iterators.
Definition: CalIterBase.h:74
virtual void fillCache()
Force an explicit read to cache for all columns (if attached to an iterator)
casacore::Bool phaseIdOK_p
virtual casacore::Vector< casacore::Int > & calDescId()
virtual casacore::Vector< casacore::String > & fieldCode()
casacore::Bool calDescIdOK_p
virtual casacore::Vector< casacore::String > & fieldName()
casacore::Bool fieldIdOK_p
virtual casacore::Vector< casacore::Int > & measFreqRef()
CalMainColumns: Read-write cal_main calibration table column access.
casacore::Bool stateIdOK_p
virtual casacore::Vector< casacore::Int > & feed1()
virtual casacore::Vector< casacore::Int > & calHistoryId()
virtual void fillAttributes(const casacore::Vector< casacore::Int > &calIndices, const VisBuffer &vb)
Fill the cal buffer attribute columns in an empty cal buffer, after the cal indices have been set usi...
virtual casacore::Array< casacore::MFrequency > & refFreqMeas()
virtual casacore::Vector< casacore::Int > & antenna1()
virtual casacore::Vector< casacore::Int > matchAntenna1AndFreqGrp(const casacore::Int &antennaId, const casacore::String &frqGrpName)
Find the matching rows for a given antenna1 id.
virtual casacore::Vector< casacore::Int > & measDirRef()
casacore::Vector< casacore::Int > fieldId_p
virtual CalDescBuffer & calDescBuffer()
Accessors for the contained cal_desc and cal_history buffers.
casacore::Bool calHistoryIdOK_p
virtual void synchronize()
Synchronize the buffer (if attached to an iterator)
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual casacore::Vector< casacore::Int > & pulsarBin()
virtual casacore::Vector< casacore::Int > & freqGrp()
casacore::Bool measDirRefOK_p
casacore::Vector< casacore::MEpoch > timeMeas_p
Buffer fields.
virtual casacore::Vector< casacore::Int > & phaseId()
casacore::Vector< casacore::Quantity > timeEPQuant_p
casacore::Bool gainOK_p
CalMainBuffer: Calibration main table buffer.
Definition: CalMainBuffer.h:80
casacore::Array< casacore::Int > refReceptor_p
casacore::Bool connectedToIter_p
true if connected to underlying iterator
virtual casacore::Vector< casacore::Int > & pulsarGateId()
virtual casacore::Array< casacore::Int > & refFeed()
casacore::Vector< casacore::Int > feed1_p
casacore::Bool calGrpOK_p
simple 1-D array
virtual ~CalMainBuffer()
Default destructor.
CalMainBuffer()
Default constructor.
virtual casacore::Vector< casacore::Int > & scanNo()
casacore::Bool scanNoOK_p
virtual casacore::Vector< casacore::Int > & processorId()
virtual casacore::Vector< casacore::Quantity > & timeEPQuant()
colDef
Enumerate all relevant data fields (columns and keywords)
Definition: MSCalEnums.h:92
casacore::Vector< casacore::Quantity > intervalQuant_p
casacore::Bool processorIdOK_p
virtual casacore::Vector< casacore::Int > & obsId()
casacore::Bool timeMeasOK_p
Buffer field status flags.
casacore::Array< casacore::Int > refFeed_p
casacore::Bool refDirMeasOK_p
virtual casacore::Vector< casacore::String > & asVecString(const MSCalEnums::colDef &calEnum)
Generic access to string columns by MSCalEnums enumeration.
virtual CalMainColumns * calMainCol()
Access to the columns accessor object.
virtual casacore::Vector< casacore::Quantity > & intervalQuant()
casacore::Bool refFeedOK_p
virtual casacore::Int nRow()
Maximum number of rows in the calibration buffer.
CalDescBuffer * calDescBuf_p
Contained sub-table cal_desc and cal_history buffers.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
virtual casacore::Array< casacore::MDirection > & refDirMeas()
VisBuffers encapsulate one chunk of visibility data for processing.
Definition: VisBuffer.h:153
virtual casacore::Vector< casacore::Int > matchAntenna1(const casacore::Int &antennaId)
Find the matching rows for a given antenna1 id.
casacore::Bool fieldCodeOK_p
CalDescBuffer: Calibration table cal_desc buffer.
Definition: CalDescBuffer.h:74
virtual casacore::Array< casacore::Complex > & gain()
virtual casacore::Vector< casacore::Int > matchAntenna1AndFieldId(const casacore::Int &antennaId, const casacore::Int &fldId)
Find the matching rows for a given antenna1 id.
CalHistoryBuffer: Calibration table cal_history buffer.
casacore::Vector< casacore::Int > calHistoryId_p
casacore::Array< casacore::Int > refAnt_p
virtual CalMainColumns * newCalMainCol(CalTable &calTable)
Factory method to create a columns accessor object of the appropriate type.
casacore::Bool pulsarBinOK_p
virtual casacore::Vector< casacore::MEpoch > & timeMeas()
casacore::Data field accessors
casacore::Bool refAntOK_p
virtual CalHistoryBuffer & calHistoryBuffer()
virtual casacore::Vector< casacore::Int > & fieldId()
casacore::Vector< casacore::Int > antenna1_p