00001 //# CalibratingVi2Factory.h: Interface definition of the CalibratingVi2Factory class. 00002 //# 00003 //# CASA - Common Astronomy Software Applications (http://casa.nrao.edu/) 00004 //# Copyright (C) Associated Universities, Inc. Washington DC, USA 2011, All rights reserved. 00005 //# Copyright (C) European Southern Observatory, 2011, All rights reserved. 00006 //# 00007 //# This library is free software; you can redistribute it and/or 00008 //# modify it under the terms of the GNU Lesser General Public 00009 //# License as published by the Free software Foundation; either 00010 //# version 2.1 of the License, or (at your option) any later version. 00011 //# 00012 //# This library is distributed in the hope that it will be useful, 00013 //# but WITHOUT ANY WARRANTY, without even the implied warranty of 00014 //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 //# Lesser General Public License for more details. 00016 //# 00017 //# You should have received a copy of the GNU Lesser General Public 00018 //# License along with this library; if not, write to the Free Software 00019 //# Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00020 //# MA 02111-1307 USA 00021 //# $Id: $ 00022 00023 #ifndef CalibratingVi2Factory_H_ 00024 #define CalibratingVi2Factory_H_ 00025 00026 // Where ViFactory interface is defined 00027 #include <msvis/MSVis/VisibilityIterator2.h> 00028 #include <msvis/MSVis/IteratingParameters.h> 00029 #include <msvis/MSVis/CalibratingVi2FactoryI.h> 00030 00031 00032 // Implementation returned by the factory method 00033 #include <synthesis/MeasurementComponents/CalibratingVi2.h> 00034 00035 00036 namespace casa { //# NAMESPACE CASA - BEGIN 00037 namespace vi { //# NAMESPACE VI - BEGIN 00038 00039 // <summary> 00040 // A top level class defining the data handling interface for the CalibratingTvi2 module 00041 // </summary> 00042 // 00043 // <use visibility=export> 00044 // 00045 // <prerequisite> 00046 // <li> <linkto class="VisibilityIterator2:description">VisibilityIterator2</linkto> 00047 // <li> <linkto class="CalibratingVi2:description">CalibratingVi2</linkto> 00048 // </prerequisite> 00049 // 00050 // <etymology> 00051 // CalibratingVi2Factory is a class that generates a Visibility Iterator implementation 00052 // that can calibrate data 00053 // </etymology> 00054 // 00055 // <synopsis> 00056 // CalibratingVi2Factory generates a Visibility Iterator implementation (ViImplementation2) 00057 // object that can be plugged into a Visibility Iterator (VisibilityIterator2) object, 00058 // so that the user can access _corrected_ data (and related) using the VisibilityIterator2 00059 // interface. 00060 // </synopsis> 00061 // 00062 // <motivation> 00063 // This class makes calibration application portable, and available for all VisibilityIterator2 00064 // users 00065 // </motivation> 00066 // 00067 // <example> 00068 // External usage is quite simple, and compliant with the 'normal' VI/VB framework. 00069 // 00070 // The user first makes objects describing the data iteration and calibration parameters: 00071 // 00072 // <srcblock> 00073 // IteratingParameters iterpar; 00074 // iterpar.setChunkInterval(60.0); 00075 // 00076 // CalibratingParameters calpar(10.0); // a simple factor of 10.0 to multiply the data 00077 // // (in leiu of full VisEquation functionality (TBD) 00078 // 00079 // 00080 // </srcblock> 00081 // 00082 // Then these parameter objects, along with a MeasurementSet pointer, are used to make 00083 // a factory suitable for the generic VisibilityIterator2 ctor, which is then invoked 00084 // 00085 // <srcblock> 00086 // CalibratingVi2Factory factory(ms,calpar,iterpar); 00087 // vi::VisibilityIterator2 *visIter = new vi::VisibilityIterator2 (factory); 00088 // vi::VisBuffer2 *visBuffer = visIter->getVisBuffer(); 00089 // </srcblock> 00090 // 00091 // Once this is done one can normally iterate and access OTF calibrated data: 00092 // 00093 // <srcblock> 00094 // while (visIter->moreChunks()) 00095 // { 00096 // visIter->origin(); 00097 // 00098 // while (visIter->more()) 00099 // { 00100 // 00101 // Vector<Int> ddi = visBuffer->dataDescriptionIds(); 00102 // Vector<Int> antenna1 = visBuffer->antenna1(); 00103 // Vector<Int> antenna2 = visBuffer->antenna2(); 00104 // Cube<Complex> cvis = visBuffer->visCubeCorrected(); 00105 // 00106 // visIter->next(); 00107 // } 00108 // 00109 // visIter->nextChunk(); 00110 // } 00111 // </srcblock> 00112 // 00113 // 00114 // Notice that it is the responsibility of the application layer to delete the VisibilityIterator2 00115 // pointer returned by the factory method. However the life cycle of the VisBuffer2 object is 00116 // responsibility of the VisibilityIterator2 object. 00117 // 00118 // <srcblock> 00119 // delete visIter; 00120 // </srcblock> 00121 // 00122 // </example> 00123 00124 class CalibratingVi2Factory : public vi::CalibratingVi2FactoryI 00125 { 00126 00127 public: 00128 00129 CalibratingVi2Factory(MeasurementSet* ms, 00130 const CalibratingParameters& calpar, 00131 const IteratingParameters& iterpar=IteratingParameters()); 00132 00133 CalibratingVi2Factory(); 00134 00135 CalibratingVi2Factory(MeasurementSet* ms, 00136 const Record& calrec, 00137 const IteratingParameters& iterpar=IteratingParameters()); 00138 00139 CalibratingVi2Factory(MeasurementSet* ms, 00140 const String& callib, 00141 const IteratingParameters& iterpar=IteratingParameters()); 00142 00143 virtual ~CalibratingVi2Factory(); 00144 00145 // Public functions to initialize a generic CVi2F 00146 virtual void initialize(MeasurementSet* ms, 00147 const Record& calrec, 00148 const IteratingParameters& iterpar); 00149 virtual void initialize(MeasurementSet* ms, 00150 const String& callib, 00151 const IteratingParameters& iterpar); 00152 00153 00154 00155 protected: 00156 00157 // Create CalibratingVi2 implementation 00158 // If vii=NULL, create underlying vii internally 00159 virtual vi::ViImplementation2 * createVi () const; 00160 virtual vi::ViImplementation2 * createVi (vi::ViImplementation2 * vii) const; 00161 00162 private: 00163 00164 Bool valid_p; 00165 MeasurementSet* ms_p; 00166 CalibratingParameters calpar_p; 00167 IteratingParameters iterpar_p; 00168 00169 }; 00170 00171 00172 } //# NAMESPACE VI - END 00173 } //# NAMESPACE CASA - END 00174 00175 00176 #endif /* CalibratingVi2Factory_H_ */ 00177