casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSTransformIteratorFactory.h
Go to the documentation of this file.
1 //# MSTransformIteratorFactory.h: This file contains the interface definition of the MSTransformManager class.
2 //#
3 //# CASA - Common Astronomy Software Applications (http://casa.nrao.edu/)
4 //# Copyright (C) Associated Universities, Inc. Washington DC, USA 2011, All rights reserved.
5 //# Copyright (C) European Southern Observatory, 2011, All rights reserved.
6 //#
7 //# This library is free software; you can redistribute it and/or
8 //# modify it under the terms of the GNU Lesser General Public
9 //# License as published by the Free software Foundation; either
10 //# version 2.1 of the License, or (at your option) any later version.
11 //#
12 //# This library is distributed in the hope that it will be useful,
13 //# but WITHOUT ANY WARRANTY, without even the implied warranty of
14 //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 //# Lesser General Public License for more details.
16 //#
17 //# You should have received a copy of the GNU Lesser General Public
18 //# License along with this library; if not, write to the Free Software
19 //# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 //# MA 02111-1307 USA
21 //# $Id: $
22 
23 #ifndef MSTransformIteratorFactory_H_
24 #define MSTransformIteratorFactory_H_
25 
26 // Where ViFactory interface is defined
28 
29 // Class containing the actual transformation logic
31 
32 // Implementation returned by the factory method
35 
36 namespace casa {
37 
38 // <summary>
39 // A top level class defining the data handling interface for the MSTransform module
40 // </summary>
41 //
42 // <use visibility=export>
43 //
44 // <prerequisite>
45 // <li> <linkto class="VisibilityIterator2:description">VisibilityIterator2</linkto>
46 // <li> <linkto class="MSTransformIterator:description">MSTransformIterator</linkto>
47 // <li> <linkto class="MSTransformManager:description">MSTransformManager</linkto>
48 // </prerequisite>
49 //
50 // <etymology>
51 // MSTransformFactory is a class that generates a Visibility Iterator implementation based on mstransform
52 // </etymology>
53 //
54 // <synopsis>
55 // MSTransformFactory generates a Visibility Iterator implementation (ViImplementation2)
56 // object that can be plugged into a Visibility Iterator (VisibilityIterator2) object,
57 // so that the user can access the data using the Visibility Iterator interface.
58 // </synopsis>
59 //
60 // <motivation>
61 // The idea is that an external application (plotms, imaging) can consume data
62 // transformed using the mstransform code via a Visibility Iterator interface
63 // </motivation>
64 //
65 // <example>
66 // External usage is quite simple, and compliant with the 'normal' VI/VB framework.
67 //
68 // The user defines a dictionary with the parameters that would be normally passed to test_mstransform
69 // (therefore I point to task_mstransform help for doubts regarding the parameters)
70 //
71 // <srcblock>
72 // casacore::Record configuration;
73 // configuration.define ("inputms", filename);
74 // configuration.define ("spw", "8,9,10,11");
75 // configuration.define ("antenna", "1&&2");
76 // configuration.define ("combinespws", true);
77 // configuration.define ("regridms", true);
78 // configuration.define ("mode", "channel");
79 // configuration.define ("width", "2");
80 // configuration.define ("timeaverage", true);
81 // configuration.define ("timebin", "30s");
82 // </srcblock>
83 //
84 // casacore::Notice that some parameters don't make sense in the context of a VI/VB interface:
85 // * outputms
86 // * tileshape
87 // * datacolumn
88 // * realmodelcol
89 // * usewtspectrum
90 //
91 // With this configuration record the factory class MSTransformIteratorFactory will
92 // create internally a MSTransformIterator and return a pointer to a VisibilityIterator2
93 // object whose implementation is the newly created MSTransformIterator.
94 //
95 // <srcblock>
96 // MSTransformIteratorFactory factory(configuration);
97 // vi::VisibilityIterator2 *visIter = new vi::VisibilityIterator2 (factory);
98 // vi::VisBuffer2 *visBuffer = visIter->getVisBuffer();
99 // </srcblock>
100 //
101 // Once this is done one can normally iterate and access the transformed data:
102 //
103 // <srcblock>
104 // visIter->originChunks();
105 // while (visIter->moreChunks())
106 // {
107 // visIter->origin();
108 //
109 // while (visIter->more())
110 // {
111 //
112 // casacore::Vector<casacore::Int> ddi = visBuffer->dataDescriptionIds();
113 // casacore::Vector<casacore::Int> antenna1 = visBuffer->antenna1();
114 // casacore::Vector<casacore::Int> antenna2 = visBuffer->antenna2();
115 // // Etc
116 //
117 // visIter->next();
118 // }
119 //
120 // visIter->nextChunk();
121 // }
122 // </srcblock>
123 //
124 // It is also possible to access the transformed Sub-Tables
125 // (loaded in memory thanks to the casacore::Memory Resident Sub-Tables mechanism):
126 //
127 // <srcblock>
128 // casacore::MSSpectralWindow transformedSpwTable = visIter->ms().spectralWindow();
129 // </srcblock>
130 //
131 // casacore::Notice that it is the responsibility of the application layer to delete the VisibilityIterator2
132 // pointer returned by the factory method. However the life cycle of the VisBuffer2 object is
133 // responsibility of the VisibilityIterator2 object.
134 //
135 // <srcblock>
136 // delete visIter;
137 // </srcblock>
138 //
139 // </example>
140 
142 {
143 
144 public:
145 
147  MSTransformIteratorFactory(casacore::Record &configuration, casacore::MrsEligibility &eligibleSubTables);
149 
150  std::vector<casacore::IPosition> getVisBufferStructure();
151  vi::VisibilityIterator2 * getInputVI() {return manager_p->getVisIter();}
152 
153 protected:
154 
155  void setConfiguration(casacore::Record &configuration);
156  void initializeManager();
157  vi::ViImplementation2 * createVi () const;
158 
159 private:
160 
163  mutable std::shared_ptr<MSTransformManager> manager_p;
165 };
166 
167 } //# NAMESPACE CASA - END
168 
169 
170 #endif /* MSTransformIteratorFactory_H_ */
171 
std::shared_ptr< MSTransformManager > manager_p
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
MSTransformIteratorFactory(casacore::Record &configuration)
vi::ViImplementation2 * createVi() const
std::vector< casacore::IPosition > getVisBufferStructure()
A hierarchical collection of named fields of various types.
Definition: Record.h:180
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
A top level class defining the data handling interface for the MSTransform module.
void setConfiguration(casacore::Record &configuration)
String: the storage and methods of handling collections of characters.
Definition: String.h:223