casa
$Rev:20696$
|
00001 //# VisibilityIterator.h: Step through the MeasurementEquation by visibility 00002 //# Copyright (C) 1996,1997,1998,1999,2000,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 addressed 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 //# $Id: VisibilityIterator2.h,v 19.14 2006/02/28 04:48:58 mvoronko Exp $ 00027 00028 #if ! defined (MSVIS_WritingVi2_H_121115_0950) 00029 #define MSVIS_WritingVi2_H_121115_0950 00030 00031 #include <casa/aips.h> 00032 #include <ms/MeasurementSets.h> 00033 #include <synthesis/MSVis/TransformingVi2.h> 00034 #include <synthesis/MSVis/ViColumns2.h> 00035 00036 #include <boost/noncopyable.hpp> 00037 #include <map> 00038 #include <vector> 00039 00040 namespace casa { //# NAMESPACE CASA - BEGIN 00041 00042 template <typename T> class Vector; 00043 00044 namespace vi { 00045 00046 //# forward decl 00047 00048 class VisBuffer2; 00049 00050 class ChannelSelector; 00051 class ChannelSelectorCache; 00052 typedef Vector<Vector <Slice> > ChannelSlicer; 00053 class SpectralWindowChannelsCache; 00054 class SpectralWindowChannels; 00055 class SubtableColumns; 00056 00057 00058 // <summary> 00059 // VisibilityIterator2 iterates through one or more readonly MeasurementSets 00060 // </summary> 00061 00062 // <use visibility=export> 00063 00064 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00065 // </reviewed> 00066 00067 // <prerequisite> 00068 // <li> <linkto class="MSIter">MSIter</linkto> 00069 // <li> <linkto class="MeasurementSet">MeasurementSet</linkto> 00070 // <li> <linkto class="VisSet">VisSet</linkto> 00071 // </prerequisite> 00072 // 00073 // <etymology> 00074 // The VisibilityIterator2 is a readonly iterator returning visibilities 00075 // </etymology> 00076 // 00077 // <synopsis> 00078 // VisibilityIterator2 provides iteration with various sort orders 00079 // for one or more MSs. It has member functions to retrieve the fields 00080 // commonly needed in synthesis calibration and imaging. 00081 // 00082 // One should use <linkto class="VisBuffer">VisBuffer</linkto> 00083 // to access chunks of data. 00084 // </synopsis> 00085 // 00086 // <example> 00087 // <code> 00088 // // 00089 // </code> 00090 // </example> 00091 // 00092 // <motivation> 00093 // For imaging and calibration you need to access an MS in some consistent 00094 // order (by field, spectralwindow, time interval etc.). This class provides 00095 // that access. 00096 // </motivation> 00097 // 00098 // <thrown> 00099 // <li> 00100 // <li> 00101 // </thrown> 00102 // 00103 // <todo asof="1997/05/30"> 00104 // <li> cleanup the currently dual interface for visibilities and flags 00105 // <li> sort out what to do with weights when interpolating 00106 // </todo> 00107 00108 class FinalTvi2 : public TransformingVi2 { 00109 00110 public: 00111 00112 FinalTvi2 (ViImplementation2 * inputVi, 00113 VisibilityIterator2 * vi, 00114 MeasurementSet & finalMs, 00115 Bool isWritable); 00116 00117 // Destructor 00118 00119 virtual ~FinalTvi2 (); 00120 00121 // +==================================+ 00122 // | | 00123 // | Iteration Control and Monitoring | 00124 // | | 00125 // +==================================+ 00126 00127 00128 virtual void origin (); 00129 virtual void next (); 00130 00131 // +=========================+ 00132 // | | 00133 // | Subchunk Data Accessors | 00134 // | | 00135 // +=========================+ 00136 00137 00138 // +------------------------+ 00139 // | | 00140 // | Angular Data Providers | 00141 // | | 00142 // +------------------------+ 00143 00144 00145 // +=========================+ 00146 // | | 00147 // | Chunk and MS Level Data | 00148 // | | 00149 // +=========================+ 00150 00151 00152 00153 // +-------------------+ 00154 // | | 00155 // | Writeback Methods | 00156 // | | 00157 // +-------------------+ 00158 00159 // This method writes back any changed (dirty) components of the provided 00160 // VisBuffer and is the preferred method for writing data out. 00161 00162 virtual void writeBackChanges (VisBuffer2 * vb); 00163 00164 // Write/modify the flags in the data. 00165 // This will flag all channels in the original data that contributed to 00166 // the output channel in the case of channel averaging. 00167 // All polarizations have the same flag value. 00168 virtual void writeFlag (const Matrix<Bool> & flag); 00169 00170 // Write/modify the flags in the data. 00171 // This writes the flags as found in the MS, Cube (npol,nchan,nrow), 00172 // where nrow is the number of rows in the current iteration (given by 00173 // nRow ()). 00174 virtual void writeFlag (const Cube<Bool> & flag); 00175 00176 // Write/modify the flag row column; dimension Vector (nrow) 00177 virtual void writeFlagRow (const Vector<Bool> & rowflags); 00178 00179 virtual void writeFlagCategory(const Array<Bool>& fc); 00180 00181 // Write/modify the visibilities. 00182 // This is possibly only for a 'reference' MS which has a new DATA column. 00183 // The first axis of the matrix should equal the selected number of channels 00184 // in the original MS. 00185 // If the MS does not contain all polarizations, only the parallel 00186 // hand polarizations are used. 00187 // virtual void writeVisCorrected (const Matrix<CStokesVector> & visibilityStokes); 00188 // virtual void writeVisModel (const Matrix<CStokesVector> & visibilityStokes); 00189 // virtual void writeVisObserved (const Matrix<CStokesVector> & visibilityStokes); 00190 00191 // Write/modify the visibilities 00192 // This writes the data as found in the MS, Cube (npol,nchan,nrow). 00193 virtual void writeVisCorrected (const Cube<Complex> & vis); 00194 virtual void writeVisModel (const Cube<Complex> & vis); 00195 virtual void writeVisObserved (const Cube<Complex> & vis); 00196 00197 // Write/modify the weights 00198 virtual void writeWeight (const Vector<Float> & wt); 00199 00200 // Write/modify the weightMat 00201 virtual void writeWeightMat (const Matrix<Float> & wtmat); 00202 00203 // Write/modify the weightSpectrum 00204 virtual void writeWeightSpectrum (const Cube<Float> & wtsp); 00205 00206 // Write/modify the Sigma 00207 virtual void writeSigma (const Vector<Float> & sig); 00208 00209 // Write/modify the ncorr x nrow SigmaMat. 00210 virtual void writeSigmaMat (const Matrix<Float> & sigmat); 00211 00212 // Write the information needed to generate on-the-fly model visibilities. 00213 00214 virtual void writeModel(const RecordInterface& rec, Bool iscomponentlist=True, 00215 Bool incremental=False); 00216 00217 protected: 00218 00219 void configureNewSubchunk (); 00220 00221 void writeDataValues (MeasurementSet & ms, const RefRows & rows); 00222 void writeKeyValues (MeasurementSet & ms, const RefRows & rows); 00223 void writeMiscellaneousValues (MeasurementSet & ms, const RefRows & rows); 00224 00225 private: 00226 00227 ViColumns2 columns_p; 00228 Bool columnsAttached_p; 00229 MeasurementSet ms_p; 00230 00231 }; 00232 00233 } // end namespace vi 00234 00235 } //# NAMESPACE CASA - END 00236 00237 #endif // ! defined (MSVIS_WritingVi2_H_121115_0950) 00238 00239