Line data Source code
1 : //# SimpleSimVi2.h: Rudimentary data simulator
2 : //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003
3 : //# Associated Universities, Inc. Washington DC, USA.
4 : //#
5 : //# This library is free software; you can redistribute it and/or modify it
6 : //# under the terms of the GNU Library General Public License as published by
7 : //# the Free Software Foundation; either version 2 of the License, or (at your
8 : //# option) any later version.
9 : //#
10 : //# This library is distributed in the hope that it will be useful, but WITHOUT
11 : //# ANY WARRANTY; without even the Implied warranty of MERCHANTABILITY or
12 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 : //# License for more details.
14 : //#
15 : //# You should have received a copy of the GNU Library General Public License
16 : //# along with this library; if not, write to the Free Software Foundation,
17 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 : //#
19 : //# Correspondence concerning AIPS++ should be addressed as follows:
20 : //# Internet email: casa-feedback@nrao.edu.
21 : //# Postal address: AIPS++ Project Office
22 : //# National Radio Astronomy Observatory
23 : //# 520 Edgemont Road
24 : //# Charlottesville, VA 22903-2475 USA
25 : //#
26 : //# $Id: VisibilityIterator2.h,v 19.14 2006/02/28 04:48:58 mvoronko Exp $
27 :
28 : #if ! defined (MSVIS_SimplSimVi2_H)
29 : #define MSVIS_SimplSimVi2_H
30 :
31 : #include <casacore/casa/aips.h>
32 : #include <casacore/casa/Exceptions/Error.h>
33 : #include <casacore/casa/BasicSL.h>
34 : #include <casacore/ms/MeasurementSets/MSAntennaColumns.h>
35 : #include <casacore/ms/MeasurementSets/MSSpWindowColumns.h>
36 : #include <casacore/ms/MeasurementSets/MSDataDescColumns.h>
37 : #include <casacore/ms/MeasurementSets/MSPolColumns.h>
38 : #include <msvis/MSVis/VisBufferComponents2.h>
39 : #include <msvis/MSVis/ViImplementation2.h>
40 : #include <msvis/MSVis/ViiLayerFactory.h>
41 : #include <msvis/MSVis/VisBufferImpl2.h>
42 : #include <msvis/MSVis/VisibilityIterator2.h>
43 : #include <msvis/MSVis/VisBuffer2.h>
44 : #include <casacore/measures/Measures/MFrequency.h>
45 : #include <casacore/measures/Measures/Stokes.h>
46 : #include <casacore/casa/Arrays.h>
47 : #include <casacore/casa/Arrays/ArrayFwd.h>
48 :
49 : #include <map>
50 : #include <vector>
51 :
52 : #define SSVi2NotPossible() ThrowCc("Not Possible in SimpleSimVi2");
53 : #define SSVi2NotYetImplemented() ThrowCc("Not yet implemented in SimpleSimVi2");
54 :
55 : namespace casacore{
56 :
57 : class AipsError;
58 : class RecordInterface;
59 : class String;
60 : template <typename T, Int n> class SquareMatrix;
61 :
62 : }
63 :
64 : namespace casa { //# NAMESPACE CASA - BEGIN
65 :
66 : class VisImagingWeight;
67 :
68 : namespace vi {
69 :
70 :
71 : //# forward decl
72 :
73 : class Subchunk;
74 : class VisBuffer2;
75 :
76 :
77 : class SimpleSimVi2Parameters {
78 :
79 : public:
80 :
81 : // Default ctor (sets default values, useful for self-testing)
82 : SimpleSimVi2Parameters();
83 :
84 : // Simple, shape-oriented ctor
85 : SimpleSimVi2Parameters(casacore::Int nField,casacore::Int nScan,
86 : casacore::Int nSpw, casacore::Int nAnt, casacore::Int nCorr,
87 : const casacore::Vector<casacore::Int>& nTimePerField,
88 : const casacore::Vector<casacore::Int>& nChan,
89 : casacore::Complex c0=casacore::Complex(0.0f),
90 : casacore::String polBasis="circ",
91 : casacore::Bool autoPol=false,casacore::Bool doParang=false,
92 : casacore::Bool doAC=false);
93 :
94 : // Full control
95 : SimpleSimVi2Parameters(casacore::Int nField,casacore::Int nScan,casacore::Int nSpw,
96 : casacore::Int nAnt,casacore::Int nCorr,
97 : const casacore::Vector<casacore::Int>& nTimePerField,
98 : const casacore::Vector<casacore::Int>& nChan,
99 : casacore::String date0, casacore::Double dt,
100 : const casacore::Vector<casacore::Double>& refFreq,
101 : const casacore::Vector<casacore::Double>& df,
102 : const casacore::Matrix<casacore::Float>& stokes,
103 : casacore::Bool doNoise,
104 : const casacore::Matrix<casacore::Float>& gain,
105 : const casacore::Matrix<casacore::Float>& tsys,
106 : casacore::Bool doNorm=true,
107 : casacore::String polBasis="circ", casacore::Bool doAC=false,
108 : casacore::Complex c0 = casacore::Complex(0.0f),
109 : casacore::Bool doParang=false,
110 : MetadataScope spwScope = ChunkScope,
111 : MetadataScope antennaScope = RowScope);
112 :
113 : SimpleSimVi2Parameters(const SimpleSimVi2Parameters& other);
114 : SimpleSimVi2Parameters& operator=(const SimpleSimVi2Parameters& other);
115 :
116 : ~SimpleSimVi2Parameters();
117 :
118 :
119 : void summary() const;
120 :
121 : casacore::Int nField_, nScan_, nSpw_, nAnt_, nCorr_;
122 : casacore::Vector<casacore::Int> nTimePerField_, nChan_;
123 : casacore::String date0_;
124 : casacore::Double dt_;
125 : casacore::Vector<casacore::Double> refFreq_, df_;
126 : casacore::Bool doNoise_;
127 : casacore::Matrix<casacore::Float> stokes_, gain_, tsys_;
128 : casacore::Bool doNorm_;
129 : casacore::String polBasis_;
130 : casacore::Bool doAC_;
131 : casacore::Complex c0_;
132 : casacore::Bool autoPol_; // set non-trivial linear polarization
133 : casacore::Bool doParang_; // Simple linear-in-time, for now
134 : MetadataScope spwScope_; // is SPW constant on each chunk, subchunk or row?
135 : MetadataScope antennaScope_; // are ANTENNA1, ANTENNA2 constant on each subchunk or row? (chunk scope not supported for the time being)
136 :
137 : // Return frequencies for specified spw
138 : casacore::Vector<casacore::Double> freqs(casacore::Int spw) const;
139 :
140 : private:
141 : void initialize(const casacore::Vector<casacore::Int>& nTimePerField, const casacore::Vector<casacore::Int>& nChan,
142 : const casacore::Vector<casacore::Double>& refFreq, const casacore::Vector<casacore::Double>& df,
143 : const casacore::Matrix<casacore::Float>& stokes,
144 : const casacore::Matrix<casacore::Float>& gain, const casacore::Matrix<casacore::Float>& tsys);
145 :
146 : };
147 :
148 : class SimpleSimVi2 : public ViImplementation2 {
149 :
150 : public:
151 :
152 : SimpleSimVi2 (const SimpleSimVi2Parameters& pars);
153 :
154 : // make noncopyable...
155 : SimpleSimVi2( const SimpleSimVi2& ) = delete;
156 : SimpleSimVi2& operator=( const SimpleSimVi2& ) = delete;
157 :
158 : // Destructor
159 : virtual ~SimpleSimVi2 ();
160 :
161 : // Report the the ViImplementation type
162 0 : virtual casacore::String ViiType() const override {return casacore::String("Simulated(*)"); };
163 :
164 : // +==================================+
165 : // | |
166 : // | Iteration Control and Monitoring |
167 : // | |
168 : // +==================================+
169 :
170 :
171 : // Methods to control and monitor subchunk iteration
172 :
173 : virtual void origin () override;
174 : virtual casacore::Bool more () const override;
175 : virtual void next () override;
176 : virtual Subchunk getSubchunkId () const override;
177 :
178 : // Methods to control chunk iterator
179 :
180 : virtual void originChunks (casacore::Bool forceRewind = false) override;
181 : virtual casacore::Bool moreChunks () const override;
182 : virtual void nextChunk () override;
183 :
184 : virtual void result(casacore::Record& res) const override;
185 :
186 : // Detecting the key change isn't possible (yet?)
187 0 : virtual casacore::String keyChange() const override { SSVi2NotPossible() };
188 :
189 0 : virtual casacore::Bool isWritable () const override { return false; };
190 :
191 : // Return the time interval (in seconds) used for iteration.
192 : // This is not the same as the INTERVAL column. Setting the
193 : // the interval requires calling origin chunks before performing
194 : // further iterator.
195 :
196 0 : virtual casacore::Double getInterval() const override {return 1.0e9; };
197 0 : virtual void setInterval (casacore::Double) override { SSVi2NotPossible() };
198 :
199 : // Select the channels to be returned. Requires calling originChunks before
200 : // performing additional iteration.
201 :
202 : virtual void setFrequencySelections (const FrequencySelections & selection) override;
203 :
204 : // Set the 'blocking' size for returning data.
205 0 : virtual void setRowBlocking (casacore::rownr_t) override { SSVi2NotPossible() };
206 0 : virtual casacore::rownr_t getRowBlocking() const { SSVi2NotPossible() };
207 :
208 : virtual casacore::Bool existsColumn (VisBufferComponent2 id) const override;
209 :
210 0 : virtual const SortColumns & getSortColumns() const override { SSVi2NotPossible() };
211 :
212 0 : virtual casacore::Bool isNewArrayId () const override { return false; };
213 0 : virtual casacore::Bool isNewFieldId () const override { return thisField_!=lastField_; };
214 0 : virtual casacore::Bool isNewMs () const override { return false; };
215 0 : virtual casacore::Bool isNewSpectralWindow () const override { return thisSpw_!=lastSpw_; };
216 :
217 : // Return the number of rows in the current iteration
218 : virtual casacore::rownr_t nRows () const override;
219 :
220 : // Return the number of distinct cube/array shapes in the current iteration
221 : virtual casacore::rownr_t nShapes () const override;
222 :
223 : // Return the number of rows for each distinct array/cube shapes in the current iteration
224 : virtual const casacore::Vector<casacore::rownr_t>& nRowsPerShape () const override;
225 :
226 : // Return the number of channels for each distinct array/cube shapes in the current iteration
227 : virtual const casacore::Vector<casacore::Int>& nChannelsPerShape () const override;
228 :
229 : // Return the number of correlations for each distinct array/cube shapes in the current iteration
230 : virtual const casacore::Vector<casacore::Int>& nCorrelationsPerShape () const override;
231 :
232 : // Return the row ids as from the original root table. This is useful
233 : // to find correspondance between a given row in this iteration to the
234 : // original ms row
235 :
236 : virtual void getRowIds (casacore::Vector<casacore::rownr_t> & rowids) const override;
237 :
238 : virtual VisBuffer2 * getVisBuffer () const override;
239 :
240 :
241 : // +=========================+
242 : // | |
243 : // | Subchunk casacore::Data Accessors |
244 : // | |
245 : // +=========================+
246 :
247 : // Return info
248 : virtual void antenna1 (casacore::Vector<casacore::Int> & ant1) const override;
249 : virtual void antenna2 (casacore::Vector<casacore::Int> & ant2) const override;
250 : virtual void corrType (casacore::Vector<casacore::Int> & corrTypes) const override;
251 : virtual casacore::Int dataDescriptionId () const override;
252 : virtual void dataDescriptionIds (casacore::Vector<casacore::Int> & ddis) const override;
253 : virtual void exposure (casacore::Vector<casacore::Double> & expo) const override;
254 : virtual void feed1 (casacore::Vector<casacore::Int> & fd1) const override;
255 : virtual void feed2 (casacore::Vector<casacore::Int> & fd2) const override;
256 : virtual void fieldIds (casacore::Vector<casacore::Int>&) const override;
257 : virtual void arrayIds (casacore::Vector<casacore::Int>&) const override;
258 : virtual casacore::String fieldName () const override;
259 :
260 : virtual void flag (casacore::Cube<casacore::Bool> & flags) const override;
261 : virtual void flag (casacore::Vector<casacore::Cube<casacore::Bool>> & flags) const override;
262 0 : virtual void flag (casacore::Matrix<casacore::Bool> &) const override { SSVi2NotPossible() };
263 0 : virtual casacore::Bool flagCategoryExists () const override { return false; };
264 0 : virtual void flagCategory (casacore::Array<casacore::Bool> &) const override { SSVi2NotPossible() };
265 : virtual void flagRow (casacore::Vector<casacore::Bool> & rowflags) const override;
266 : virtual void observationId (casacore::Vector<casacore::Int> & obsids) const override;
267 : virtual casacore::Int polarizationId () const override;
268 : virtual void processorId (casacore::Vector<casacore::Int> & procids) const override;
269 : virtual void scan (casacore::Vector<casacore::Int> & scans) const override;
270 : virtual casacore::String sourceName () const override;
271 : virtual void stateId (casacore::Vector<casacore::Int> & stateids) const override;
272 0 : virtual void jonesC (casacore::Vector<casacore::SquareMatrix<casacore::Complex, 2> > &) const override { SSVi2NotPossible() };
273 : virtual casacore::Int polFrame () const override;
274 : virtual void sigma (casacore::Matrix<casacore::Float> & sigmat) const override;
275 : virtual void sigma (casacore::Vector<casacore::Matrix<casacore::Float>> & sigmat) const override;
276 : virtual void spectralWindows (casacore::Vector<casacore::Int> & spws) const override;
277 : virtual void polarizationIds (casacore::Vector<casacore::Int> & polIds) const override;
278 : virtual void time (casacore::Vector<casacore::Double> & t) const override;
279 : virtual void timeCentroid (casacore::Vector<casacore::Double> & t) const override;
280 : virtual void timeInterval (casacore::Vector<casacore::Double> & ti) const override;
281 : virtual void uvw (casacore::Matrix<casacore::Double> & uvwmat) const override;
282 :
283 : virtual void visibilityCorrected (casacore::Cube<casacore::Complex> & vis) const override;
284 : virtual void visibilityCorrected (casacore::Vector<casacore::Cube<casacore::Complex>> & vis) const override;
285 : virtual void visibilityModel (casacore::Cube<casacore::Complex> & vis) const override;
286 : virtual void visibilityModel (casacore::Vector<casacore::Cube<casacore::Complex>> & vis) const override;
287 : virtual void visibilityObserved (casacore::Cube<casacore::Complex> & vis) const override;
288 : virtual void visibilityObserved (casacore::Vector<casacore::Cube<casacore::Complex>> & vis) const override;
289 : virtual void floatData (casacore::Cube<casacore::Float> & fcube) const override;
290 : virtual void floatData (casacore::Vector<casacore::Cube<casacore::Float>> & fcubes) const override;
291 :
292 : virtual casacore::IPosition visibilityShape () const override;
293 :
294 : virtual void weight (casacore::Matrix<casacore::Float> & wtmat) const override;
295 : virtual void weight (casacore::Vector<casacore::Matrix<casacore::Float>> & wtmat) const override;
296 : virtual casacore::Bool weightSpectrumExists () const override;
297 : virtual casacore::Bool sigmaSpectrumExists () const override;
298 : virtual void weightSpectrum (casacore::Cube<casacore::Float> & wtsp) const override;
299 : virtual void weightSpectrum (casacore::Vector<casacore::Cube<casacore::Float>> & wtsp) const override;
300 : virtual void sigmaSpectrum (casacore::Cube<casacore::Float> & wtsp) const override;
301 : virtual void sigmaSpectrum (casacore::Vector<casacore::Cube<casacore::Float>> & wtsp) const override;
302 :
303 0 : virtual void setWeightScaling (casacore::CountedPtr<WeightScaling>) override { SSVi2NotPossible() };
304 0 : virtual casacore::Bool hasWeightScaling () const override { return false; };
305 : virtual casacore::CountedPtr<WeightScaling> getWeightScaling () const override; // { SSVi2NotPossible() };
306 :
307 : // +------------------------+
308 : // | |
309 : // | Angular casacore::Data Providers |
310 : // | |
311 : // +------------------------+
312 :
313 : // No underlying geometry is available for these!
314 0 : virtual casacore::Bool allBeamOffsetsZero () const override { SSVi2NotPossible() };
315 0 : virtual casacore::MDirection azel0 (casacore::Double) const override { SSVi2NotPossible() };
316 0 : virtual const casacore::Vector<casacore::MDirection> & azel (casacore::Double) const override { SSVi2NotPossible() };
317 : virtual const casacore::Vector<casacore::Float> & feed_pa (casacore::Double t) const override;
318 0 : virtual std::pair<bool, casacore::MDirection> getPointingAngle (int /*antenna*/, double /*time*/) const override
319 0 : { return std::make_pair (true, phaseCenter()); }
320 0 : virtual const casacore::Cube<casacore::RigidVector<casacore::Double, 2> > & getBeamOffsets () const override { SSVi2NotPossible() };
321 0 : virtual casacore::Double hourang (casacore::Double) const override { SSVi2NotPossible() };
322 0 : virtual const casacore::Float & parang0 (casacore::Double) const override { SSVi2NotPossible() };
323 0 : virtual const casacore::Vector<casacore::Float> & parang (casacore::Double) const override { SSVi2NotPossible() };
324 0 : virtual const casacore::MDirection & phaseCenter () const override { return phaseCenter_; }; // trivial value (for now)
325 0 : virtual const casacore::Cube<casacore::Double> & receptorAngles () const override { SSVi2NotPossible() };
326 :
327 : // +=========================+
328 : // | |
329 : // | Chunk and casacore::MS Level casacore::Data |
330 : // | |
331 : // +=========================+
332 :
333 0 : virtual const casacore::Vector<casacore::String> & antennaMounts () const override { SSVi2NotPossible() };
334 0 : virtual const VisImagingWeight & getImagingWeightGenerator () const override { SSVi2NotPossible() };
335 :
336 0 : virtual casacore::MFrequency::Types getObservatoryFrequencyType () const override { SSVi2NotPossible() };
337 0 : virtual casacore::MPosition getObservatoryPosition () const override { SSVi2NotPossible() };
338 0 : virtual casacore::Vector<casacore::Float> getReceptor0Angle () override { SSVi2NotPossible() };
339 :
340 0 : virtual casacore::Int getReportingFrameOfReference () const override { return -2; /*SSVi2NotPossible()*/ };
341 0 : virtual void setReportingFrameOfReference (casacore::Int) override { SSVi2NotPossible() };
342 :
343 : virtual casacore::MEpoch getEpoch () const override;
344 :
345 : virtual casacore::Vector<casacore::Int> getCorrelations () const override;
346 :
347 0 : virtual casacore::Vector<casacore::Stokes::StokesTypes> getCorrelationTypesDefined () const override { return corrdef_; /*SSVi2NotPossible()*/ };
348 0 : virtual casacore::Vector<casacore::Stokes::StokesTypes> getCorrelationTypesSelected () const override { return corrdef_; /*SSVi2NotPossible()*/ };
349 :
350 : virtual casacore::Vector<casacore::Int> getChannels (casacore::Double time, casacore::Int frameOfReference, casacore::Int spectralWndow = -1,
351 : casacore::Int msId = -1) const override;
352 : virtual casacore::Vector<casacore::Double> getFrequencies (casacore::Double time, casacore::Int frameOfReference, casacore::Int spectralWndow = -1,
353 : casacore::Int msId = -1) const override;
354 : virtual casacore::Vector<casacore::Double> getChanWidths (casacore::Double time, casacore::Int frameOfReference, casacore::Int spectralWndow = -1,
355 : casacore::Int msId = -1) const override;
356 :
357 : //reference to actual ms in interator (TRIVIAL returns
358 0 : virtual casacore::Int msId () const override { return -1; }; // zero-based index of current casacore::MS in set of MSs
359 0 : virtual const casacore::MeasurementSet & ms () const override { SSVi2NotPossible() };
360 0 : virtual casacore::Int getNMs () const override { return 0; };
361 :
362 : // Name of the MS in the interator
363 0 : virtual casacore::String msName() const override { return casacore::String("<noms>"); };
364 :
365 : // Call to use the slurp i/o method for all scalar columns.
366 : // Not meaningful for non-I/O
367 0 : virtual void slurp () const override { SSVi2NotPossible() };
368 :
369 : // Access the current casacore::MSColumns object in MSIter -- NOT POSSIBLE
370 0 : virtual const vi::SubtableColumns & subtableColumns () const override { SSVi2NotPossible() };
371 :
372 :
373 : // get back the selected spectral windows and spectral channels for
374 : // current ms
375 :
376 : virtual const SpectralWindowChannels & getSpectralWindowChannels (casacore::Int msId, casacore::Int spectralWindowId) const override;
377 :
378 : //assign a VisImagingWeight object to this iterator
379 0 : virtual void useImagingWeight (const VisImagingWeight & ) override { SSVi2NotPossible() };
380 :
381 : // Return number of antennasm spws, polids, ddids
382 :
383 : virtual casacore::Int nAntennas () const override;
384 : virtual casacore::Int nDataDescriptionIds () const override;
385 : virtual casacore::Int nPolarizationIds () const override;
386 : virtual casacore::rownr_t nRowsInChunk () const override; // number rows in current chunk
387 : virtual casacore::rownr_t nRowsViWillSweep () const override; // number of rows in all selected ms's
388 : virtual casacore::Int nSpectralWindows () const override;
389 : virtual casacore::Int nTimes() const override;
390 :
391 : // Writeback methods are Irrelevant for non-disk-reading VI2
392 0 : virtual void writeBackChanges (VisBuffer2* ) override { SSVi2NotPossible() };
393 0 : virtual void writeFlag (const casacore::Cube<casacore::Bool> &) override { SSVi2NotPossible() };
394 0 : virtual void writeFlagRow (const casacore::Vector<casacore::Bool> &) override { SSVi2NotPossible() };
395 0 : virtual void writeFlagCategory(const casacore::Array<casacore::Bool>&) override { SSVi2NotPossible() };
396 0 : virtual void writeVisCorrected (const casacore::Cube<casacore::Complex> &) override { SSVi2NotPossible() };
397 0 : virtual void writeVisModel (const casacore::Cube<casacore::Complex> &) override { SSVi2NotPossible() };
398 0 : virtual void writeVisObserved (const casacore::Cube<casacore::Complex> &) override { SSVi2NotPossible() };
399 0 : virtual void writeWeight (const casacore::Matrix<casacore::Float> &) override { SSVi2NotPossible() };
400 0 : virtual void writeWeightSpectrum (const casacore::Cube<casacore::Float> &) override { SSVi2NotPossible() };
401 0 : virtual void initWeightSpectrum (const casacore::Cube<casacore::Float> &) override { SSVi2NotPossible() };
402 0 : virtual void writeSigmaSpectrum (const casacore::Cube<casacore::Float> &) override { SSVi2NotPossible() };
403 0 : virtual void writeSigma (const casacore::Matrix<casacore::Float> &) override { SSVi2NotPossible() };
404 0 : virtual void writeModel(const casacore::RecordInterface&,casacore::Bool,casacore::Bool) override { SSVi2NotPossible() };
405 :
406 : //**********************************************************************
407 : // Methods to access the subtables.
408 : //**********************************************************************
409 :
410 : // Access to antenna subtable
411 : const casacore::MSAntennaColumns& antennaSubtablecols() const override;
412 :
413 : // Access to dataDescription subtable
414 : const casacore::MSDataDescColumns& dataDescriptionSubtablecols() const override;
415 :
416 : // Access to feed subtable
417 : const casacore::MSFeedColumns& feedSubtablecols() const override;
418 :
419 : // Access to field subtable
420 : const casacore::MSFieldColumns& fieldSubtablecols() const override;
421 :
422 : // Access to flagCmd subtable
423 : const casacore::MSFlagCmdColumns& flagCmdSubtablecols() const override;
424 :
425 : // Access to history subtable
426 : const casacore::MSHistoryColumns& historySubtablecols() const override;
427 :
428 : // Access to observation subtable
429 : const casacore::MSObservationColumns& observationSubtablecols() const override;
430 :
431 : // Access to pointing subtable
432 : const casacore::MSPointingColumns& pointingSubtablecols() const override;
433 :
434 : // Access to polarization subtable
435 : const casacore::MSPolarizationColumns& polarizationSubtablecols() const override;
436 :
437 : // Access to processor subtable
438 : const casacore::MSProcessorColumns& processorSubtablecols() const override;
439 :
440 : // Access to spectralWindow subtable
441 : const casacore::MSSpWindowColumns& spectralWindowSubtablecols() const override;
442 :
443 : // Access to state subtable
444 : const casacore::MSStateColumns& stateSubtablecols() const override;
445 :
446 : // Access to doppler subtable
447 : const casacore::MSDopplerColumns& dopplerSubtablecols() const override;
448 :
449 : // Access to freqOffset subtable
450 : const casacore::MSFreqOffsetColumns& freqOffsetSubtablecols() const override;
451 :
452 : // Access to source subtable
453 : const casacore::MSSourceColumns& sourceSubtablecols() const override;
454 :
455 : // Access to sysCal subtable
456 : const casacore::MSSysCalColumns& sysCalSubtablecols() const override;
457 :
458 : // Access to weather subtable
459 : const casacore::MSWeatherColumns& weatherSubtablecols() const override;
460 :
461 : private:
462 :
463 : // Make default ctor invisible
464 : SimpleSimVi2 ();
465 :
466 : // Keep VB2 sync'd
467 : void configureNewSubchunk();
468 :
469 : // Generate noise on data
470 : void addNoise(casacore::Cube<casacore::Complex>& vis, casacore::rownr_t vbRowOffset) const;
471 :
472 : // Corrupt by (ad hoc) parang factors
473 : void corruptByParang(casacore::Cube<casacore::Complex>& vis, casacore::rownr_t vbRowOffset) const;
474 :
475 : // Generate the antenna, spw and DD subtables
476 : void generateSubtables();
477 :
478 : // casacore::Input parameters
479 : const SimpleSimVi2Parameters pars_;
480 : /*
481 : casacore::Int nField_,nScan_,nSpw_,nAnt_,nCorr_;
482 : casacore::Vector<casacore::Int> nTimePerField_, nChan_;
483 : casacore::String date0_;
484 : casacore::Double dt_;
485 : casacore::Vector<casacore::Double> refFreq_, df_;
486 : casacore::Matrix<casacore::Float> stokes_, sefd_;
487 : casacore::String polBasis_;
488 : casacore::Bool doAC_;
489 : */
490 :
491 : // Derived parameters
492 : casacore::Int nChunk_, nBsln_;
493 : casacore::rownr_t nSubchunk_;
494 : casacore::Complex c0_;
495 : casacore::Double t0_;
496 : casacore::Vector<casacore::Float> wt0_;
497 : casacore::Matrix<casacore::Complex> vis0_;
498 :
499 :
500 : // Counters
501 : casacore::Int iChunk_;
502 : casacore::rownr_t iSubChunk_;
503 : casacore::Int iRow0_;
504 : casacore::Int iScan_;
505 : casacore::Double iChunkTime0_;
506 :
507 : // Meta-info for current iteration
508 : casacore::Int thisScan_, thisField_, thisSpw_, thisAntenna1_, thisAntenna2_;
509 : casacore::Int lastScan_, lastField_, lastSpw_;
510 : casacore::Double thisTime_;
511 : casacore::rownr_t nRows_;
512 : casacore::rownr_t nShapes_;
513 : casacore::Vector<casacore::rownr_t> nRowsPerShape_;
514 : casacore::Vector<casacore::Int> nChannPerShape_;
515 : casacore::Vector<casacore::Int> nCorrsPerShape_;
516 :
517 : // Correlation stuff
518 : casacore::Vector<casacore::Stokes::StokesTypes> corrdef_;
519 :
520 : // The associated VB
521 : std::unique_ptr<VisBuffer2> vb_;
522 :
523 : // Subtables
524 : casacore::MSAntenna antennaSubTable_p;
525 : std::unique_ptr<casacore::MSAntennaColumns> antennaSubTablecols_p;
526 : casacore::MSSpectralWindow spwSubTable_p;
527 : std::unique_ptr<casacore::MSSpWindowColumns> spwSubTablecols_p;
528 : casacore::MSDataDescription ddSubTable_p;
529 : std::unique_ptr<casacore::MSDataDescColumns> ddSubTablecols_p;
530 : casacore::MSPolarization polSubTable_p;
531 : std::unique_ptr<casacore::MSPolarizationColumns> polSubTablecols_p;
532 :
533 : // Trivial (for now) MDirection, so phaseCenter() has something to return
534 : casacore::MDirection phaseCenter_;
535 :
536 : // Trivial (for now) parang
537 : mutable casacore::Vector<casacore::Float> feedpa_;
538 :
539 : };
540 :
541 :
542 :
543 : class SimpleSimVi2Factory : public ViFactory {
544 :
545 : public:
546 :
547 : SimpleSimVi2Factory(const SimpleSimVi2Parameters& pars);
548 :
549 : ~SimpleSimVi2Factory ();
550 :
551 : protected:
552 :
553 : virtual ViImplementation2 * createVi () const;
554 :
555 : private:
556 :
557 : const SimpleSimVi2Parameters& pars_;
558 :
559 : };
560 :
561 :
562 : class SimpleSimVi2LayerFactory : public ViiLayerFactory {
563 :
564 : public:
565 :
566 : SimpleSimVi2LayerFactory(const SimpleSimVi2Parameters& pars);
567 :
568 0 : virtual ~SimpleSimVi2LayerFactory () {}
569 :
570 : protected:
571 :
572 : // SimpleSimVi2-specific layer-creater
573 : //
574 : virtual ViImplementation2 * createInstance (ViImplementation2* vii0) const;
575 :
576 : private:
577 :
578 : // Store a copy of the parameters
579 : const SimpleSimVi2Parameters pars_;
580 :
581 :
582 : };
583 :
584 :
585 :
586 :
587 :
588 :
589 : } // end namespace vi
590 :
591 : } //# NAMESPACE CASA - END
592 :
593 : #endif // ! defined (MSVIS_SimpleSimVi2_H)
594 :
595 :
|