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 <msvis/MSVis/TransformingVi2.h> 00034 #include <msvis/MSVis/ViColumns2.h> 00035 00036 #include <map> 00037 #include <vector> 00038 00039 namespace casa { //# NAMESPACE CASA - BEGIN 00040 00041 template <typename T> class Vector; 00042 00043 namespace vi { 00044 00045 //# forward decl 00046 00047 class VisBuffer2; 00048 00049 class ChannelSelector; 00050 class ChannelSelectorCache; 00051 typedef Vector<Vector <Slice> > ChannelSlicer; 00052 class SpectralWindowChannelsCache; 00053 class SpectralWindowChannels; 00054 class SubtableColumns; 00055 00056 00057 // <summary> 00058 // FinalTvi2 - Class that serves as the final Tvi2 in a pipeline; it adds simple write functionality that 00059 // allows writing back the data contained in the associated VB2. 00060 // </summary> 00061 00062 // <use visibility=export> 00063 00064 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00065 // </reviewed> 00066 00067 // <prerequisite> 00068 // </prerequisite> 00069 // 00070 // <etymology> 00071 // The FinalTvi2 in a transforming VI2 pipeline. 00072 // </etymology> 00073 // 00074 // <synopsis> 00075 // </synopsis> 00076 // 00077 // <example> 00078 // <code> 00079 // // 00080 // </code> 00081 // </example> 00082 // 00083 // <motivation> 00084 // At the end of a Transforming VI pipeline it can be handy to write out the result. Putting a FinalTvi2 00085 // as the last transforming VI allows the output to disk of the transformed data into a brand new MS. 00086 // </motivation> 00087 // 00088 // <thrown> 00089 // <li> 00090 // <li> 00091 // </thrown> 00092 // 00093 // <todo asof="2014/08/21"> 00094 // </todo> 00095 00096 class FinalTvi2 : public TransformingVi2 { 00097 00098 public: 00099 00100 FinalTvi2 (ViImplementation2 * inputVi, 00101 MeasurementSet & finalMs, 00102 Bool isWritable); 00103 00104 // Destructor 00105 00106 virtual ~FinalTvi2 (); 00107 00108 // +==================================+ 00109 // | | 00110 // | Iteration Control and Monitoring | 00111 // | | 00112 // +==================================+ 00113 00114 00115 virtual void origin (); 00116 virtual void next (); 00117 00118 // +=========================+ 00119 // | | 00120 // | Subchunk Data Accessors | 00121 // | | 00122 // +=========================+ 00123 00124 00125 // +------------------------+ 00126 // | | 00127 // | Angular Data Providers | 00128 // | | 00129 // +------------------------+ 00130 00131 00132 // +=========================+ 00133 // | | 00134 // | Chunk and MS Level Data | 00135 // | | 00136 // +=========================+ 00137 00138 00139 00140 // +-------------------+ 00141 // | | 00142 // | Writeback Methods | 00143 // | | 00144 // +-------------------+ 00145 00146 // This method writes back any changed (dirty) components of the provided 00147 // VisBuffer and is the preferred method for writing data out. 00148 00149 virtual void writeBackChanges (VisBuffer2 * vb); 00150 00151 // These methods will throw a not-implemented exception if called. They are here 00152 // because the interface requires them but the intended use of FinalTvi2 expects 00153 // that the data will be output using only the writeBackChanges method. 00154 00155 virtual void writeFlag (const Matrix<Bool> & flag); 00156 virtual void writeFlag (const Cube<Bool> & flag); 00157 virtual void writeFlagRow (const Vector<Bool> & rowflags); 00158 virtual void writeFlagCategory(const Array<Bool>& fc); 00159 virtual void writeVisCorrected (const Cube<Complex> & vis); 00160 virtual void writeVisModel (const Cube<Complex> & vis); 00161 virtual void writeVisObserved (const Cube<Complex> & vis); 00162 virtual void writeWeight (const Matrix<Float> & wt); 00163 virtual void writeWeightSpectrum (const Cube<Float> & wtsp); 00164 virtual void writeSigma (const Matrix <Float> & sig); 00165 virtual void writeModel(const RecordInterface& rec, Bool iscomponentlist=True, 00166 Bool incremental=False); 00167 00168 protected: 00169 00170 //void configureNewSubchunk (); 00171 00172 // These are the methods that actually write the data in the VB2 out to the new 00173 // MS when called by writeBackChanges. The VB's data are handled as four categories: 00174 // data - the various visibility data and the associated weight, weight spectrum, sigma, etc. 00175 // keys - the values of the columns that ID the row (e.g., antennas, DdId, etc.) 00176 // misc - the column values that don't fall in the data or key categories. 00177 00178 void writeDataValues (MeasurementSet & ms, const RefRows & rows); 00179 void writeKeyValues (MeasurementSet & ms, const RefRows & rows); 00180 void writeMiscellaneousValues (MeasurementSet & ms, const RefRows & rows); 00181 00182 private: 00183 00184 ViColumns2 columns_p; 00185 Bool columnsAttached_p; 00186 MeasurementSet ms_p; 00187 00188 }; 00189 00190 } // end namespace vi 00191 00192 } //# NAMESPACE CASA - END 00193 00194 #endif // ! defined (MSVIS_WritingVi2_H_121115_0950) 00195 00196