casa
$Rev:20696$
|
00001 //# CalIntpMatch.h: A class to hold calibration interpolation index maps 00002 //# Copyright (C) 1996,1997,1998,1999,2001,2002,2003 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be adressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# 00027 //# $Id$ 00028 00029 #ifndef CALIBRATION_CALINTPMATCH_H 00030 #define CALIBRATION_CALINTPMATCH_H 00031 00032 #include <casa/aips.h> 00033 #include <casa/Arrays/Vector.h> 00034 #include <casa/Arrays/LogiArray.h> 00035 #include <casa/Containers/Record.h> 00036 #include <ms/MeasurementSets/MSSelection.h> 00037 #include <synthesis/MSVis/VisBuffer.h> 00038 #include <synthesis/CalTables/CalMainBuffer.h> 00039 00040 namespace casa { //# NAMESPACE CASA - BEGIN 00041 00042 // <summary> 00043 // CalIntpMatch: a class to hold calibration interpolation index maps 00044 // </summary> 00045 00046 // <use visibility=export> 00047 00048 // <reviewed reviewer="" date="" tests="" demos=""> 00049 00050 // <prerequisite> 00051 // <li> <linkto class="MSCalEnums">MSCalEnums</linkto> module 00052 // <li> <linkto class="VisBuffer">VisBuffer</linkto> module 00053 // <li> <linkto class="CalMainBuffer">CalMainBuffer</linkto> module 00054 // <li> <linkto class="MSSelection">MSSelection</linkto> module 00055 // </prerequisite> 00056 // 00057 // <etymology> 00058 // From "calibration", "interpolation index" and "match". 00059 // </etymology> 00060 // 00061 // <synopsis> 00062 // The CalIntpMatch class holds calibration interpolation index maps. 00063 // These define which subset of calibration table rows are associated 00064 // with any given visibility row, i.e. which data and calibration 00065 // indices need to match in selecting calibration for a given visibility 00066 // record. The map type is defined in terms of an enumerated set of 00067 // possibilities, including for example, requiring an exact match between 00068 // the antenna and spectral window id.'s. The most general interpolation 00069 // map is defined by a matching set of synthesis selections (as defined 00070 // by class MSSelection). The CalIntpMatch class has a match methods, 00071 // matchIndex() and calRows() which determine, for associated calibration 00072 // and visibility buffers, the calibration row mapping for a given visibility. 00073 // </synopsis> 00074 // 00075 // <example> 00076 // <srcblock> 00077 // </srcblock> 00078 // </example> 00079 // 00080 // <motivation> 00081 // Encapsulate match operations for calibration and visibility data indices. 00082 // </motivation> 00083 // 00084 // <todo asof="2002/05/01"> 00085 // (i) Expand the range of enumerated mappings. 00086 // </todo> 00087 00088 class CalIntpMatch 00089 { 00090 public: 00091 00092 // Basic interpolation index match type 00093 enum MatchType { 00094 // ANTENNA_ID and SPECTRAL_WINDOW_ID to match identically 00095 MATCHING_ANT_SPW = 0, 00096 00097 // Custom mapping between arbitrary visibility and calibration selections 00098 SELECTION_MATCH = 1 00099 }; 00100 00101 // Construct from an index match type and an index dimension. The 00102 // index dimension is one for baseline-based calibration and two 00103 // for antenna-based calibration. 00104 CalIntpMatch (const MatchType& matchType = MATCHING_ANT_SPW, 00105 const uInt& indexDim = 2); 00106 00107 // Destructor 00108 virtual ~CalIntpMatch(); 00109 00110 // Copy constructor and assignment operator 00111 CalIntpMatch (const CalIntpMatch& other); 00112 virtual CalIntpMatch& operator= (const CalIntpMatch& other); 00113 00114 // Reset the mapping type 00115 void setType (const MatchType& matchType, const uInt& indexDim); 00116 00117 // Add a selection mapping (NYI) 00118 // void add (const MSSelection& msIndex, const MSSelection& calIndex); 00119 00120 // Set the current visibility buffer to be used in interpolation matches 00121 void setVisBuffer (VisBuffer& vb); 00122 00123 // Set the current calibration buffer to be used in interpolation matches 00124 void setCalBuffer (CalMainBuffer& cb); 00125 00126 // Return the match index for a given visibility buffer 00127 // row and offset position (0,1) 00128 Int matchIndex (const Int& row, const uInt& pos) 00129 {return vbIndex_p(row,pos);}; 00130 00131 // Return the calibration buffer rows (and equivalent row mask) 00132 // associated with a given match index 00133 Vector<Int> calRows (const Int& matchIndex, LogicalArray& calRowMask); 00134 00135 protected: 00136 00137 private: 00138 // Common code for the assignment operator and the copy constructor 00139 void copy (const CalIntpMatch& other); 00140 void free(); 00141 00142 // Reset functions for the local index mappings 00143 void reset(); 00144 void resetVisIndex(); 00145 void resetCalIndex(); 00146 00147 // Match index keys 00148 Int matchOrAddKey (const Record& key); 00149 00150 // Index map type 00151 MatchType type_p; 00152 00153 // Index dimension (one for baseline-based calibration and 00154 // two for antenna-based calibration). 00155 Int indexDim_p; 00156 00157 // Map index assignment per visibility buffer row 00158 Matrix<Int> vbIndex_p; 00159 00160 // Map index assignment per calibration buffer row 00161 Block<Vector<Int> > cbIndex_p; 00162 00163 // List of visibility and calibration match keys 00164 PtrBlock<Record* > matchKeys_p; 00165 00166 // Pointer to the current VisBuffer 00167 VisBuffer* vb_p; 00168 00169 // Pointer to the current CalMainBuffer 00170 CalMainBuffer* cb_p; 00171 }; 00172 00173 00174 } //# NAMESPACE CASA - END 00175 00176 #endif 00177