casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VisibilityIterator2.h
Go to the documentation of this file.
1 //# VisibilityIterator.h: Step through the MeasurementEquation by visibility
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: aips2-request@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: VisibilityIterator.h,v 19.14 2006/02/28 04:48:58 mvoronko Exp $
27 
28 #ifndef MSVIS_VISIBILITYITERATOR2_H
29 #define MSVIS_VISIBILITYITERATOR2_H
30 
31 #include <casa/aips.h>
32 
35 #include <msvis/MSVis/VisBuffer2.h>
38 
39 #include <map>
40 #include <set>
41 #include <utility>
42 #include <vector>
43 
44 namespace casacore{
45 
46 class MDirection;
47 class MSDerivedValues;
48 class MSIter;
49 class RecordInterface;
50 class ROMSAntennaColumns;
51 class ROMSDataDescColumns;
52 class ROMSFeedColumns;
53 class ROMSFieldColumns;
54 class ROMSFlagCmdColumns;
55 class ROMSHistoryColumns;
56 class ROMSObservationColumns;
57 class ROMSPointingColumns;
58 class ROMSPolarizationColumns;
59 class ROMSProcessorColumns;
60 class ROMSSpWindowColumns;
61 class ROMSStateColumns;
62 class ROMSDopplerColumns;
63 class ROMSFreqOffsetColumns;
64 class ROMSSourceColumns;
65 class ROMSSysCalColumns;
66 class ROMSWeatherColumns;
67 template <typename T, Int N> class RigidVector;
68 template <typename T, Int N> class SquareMatrix;
69 }
70 
71 namespace casa { //# NAMESPACE CASA - BEGIN
72 
73 //# forward decl
74 
75 //class CStokesVector;
76 class VisBufferType;
77 class VisBufferOptions;
78 class VisImagingWeight;
79 
80 namespace asyncio {
81 
82 class VLAT;
83 
84 } // end namespace asyncio
85 
86 // Forward declarations outside namespace vi
88 
89 namespace vi {
90 
91 class FrequencySelection;
93 class VisBuffer2;
95 class VisBufferImpl2;
96 class ViImplementation2;
97 
99 
100 public:
101 
102  // Simple wrapper class to limit access to only the columns associated with the
103  // current casacore::MS's subtables. This prevents misuse of the main table data columns
104  // which are provided as part of the casacore::MSColumns object returned by
105  // MSIter::msColumns.
106 
108 
109  const casacore::ROMSAntennaColumns& antenna() const;
111  const casacore::ROMSFeedColumns& feed() const;
112  const casacore::ROMSFieldColumns& field() const;
113  const casacore::ROMSFlagCmdColumns& flagCmd() const;
114  const casacore::ROMSHistoryColumns& history() const;
120  const casacore::ROMSStateColumns& state() const;
121  const casacore::ROMSDopplerColumns& doppler() const;
123  const casacore::ROMSSourceColumns& source() const;
124  const casacore::ROMSSysCalColumns& sysCal() const;
125  const casacore::ROMSWeatherColumns& weather() const;
126 
127 private:
128 
130 };
131 
133 //
134 // Subchunk class
135 //
136 // Provides the ordered pair identifying the current subchunk. The first
137 // component is the chunk (goes from 0 to nChunks-1 during the outer loop
138 // iteration). The second component is the subchunk number which is
139 // zero after VisibilityIterator::origin is called and is increment
140 // until ROVI::more returns false.
141 
142 class Subchunk : public std::pair<casacore::Int, casacore::Int>{
143 
144 public:
145 
146  // First component is Chunk and second is Subchunk
147 
148  Subchunk () { resetToOrigin ();}
149  Subchunk (casacore::Int a , casacore::Int b) : std::pair<casacore::Int,casacore::Int> (a,b) {}
150 
151  casacore::Bool operator== (const Subchunk & other){
152  return first == other.first && second == other.second;
153  }
154 
155  casacore::Bool operator< (const Subchunk & other){
156  return first < other.first ||
157  (first == other.first && second < other.second);
158  }
159 
160  casacore::Bool atOrigin () const { return * this == Subchunk ();}
161  casacore::Int chunk () const { return first;}
162  void incrementSubChunk () { second ++;}
163  void incrementChunk () { first ++; second = 0; }
164 
165  void resetSubChunk () { second = 0;} // position to start of chunk
166 
167  void resetToOrigin () { first = 0; second = 0; }
168  // Make a subchunk pair that is positioned to the first subchunk of the
169  // first chunk (i.e., 0,0)
170 
171  casacore::Int subchunk () const { return second;}
172  casacore::String toString () const;
173 
174  static Subchunk noMoreData ();
175 
176 private:
177 
178 };
179 
180 
181 
183 //
184 // Code to provide interface to weight function
185 //
186 // WeightScaling is essentially the interface to the function
187 // used for weight scaling while WeightScalingImpl is the class
188 // to actually use to create WeightScaling functors. The use of
189 // a templated implementation allows the wrapping of both functors
190 // and functions while the base class allows polymorphic storage.
191 
193 public:
194 
195  virtual ~WeightScaling () {}
197 
201 
202 protected:
203 
204  virtual casacore::Float apply (casacore::Float) = 0;
208 };
209 
210 template<typename F>
212 public:
213 
214  // Provide either a unary function, casacore::Float (*) (casacore::Float), or
215  // a functor class having a casacore::Float operator() (casacore::Float) method.
216 
218 
220 
221 private:
222 
224 };
225 
226 
227 template<typename F>
229 
230 class SortColumns {
231 public:
232 
233  explicit SortColumns (const casacore::Block<casacore::Int> & columnIds = casacore::Block<casacore::Int> (), casacore::Bool addDefaultColumns = true);
234 
237 
238 private:
239 
242 };
243 
244 class VisibilityIterator2;
245 
247 //
248 // Class ViFactory
249 //
250 // The ViFactory is a class that can be used to initialize the implementation of
251 // a VisibilityIterator2. It is passed into VI2's constructor where it creates
252 // the needed ViImplementation object used by the VI2. The first example of this
253 // factory is the AveragingVi2Factory which is used to create a VI2 which will
254 // return time-averaged data.
255 
256 class ViFactory {
257 
258 public:
259 
260  virtual ~ViFactory () {}
261 
262 protected:
263 
264  friend class VisibilityIterator2;
265 
266  virtual ViImplementation2 * createVi () const = 0;
267 };
268 
269 // <summary>
270 // VisibilityIterator2 iterates through one or more readonly MeasurementSets
271 // </summary>
272 // <use visibility=export>
273 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
274 // </reviewed>
275 // <prerequisite>
276 // <li> <linkto class="MSIter">MSIter</linkto>
277 // <li> <linkto class="casacore::MeasurementSet">casacore::MeasurementSet</linkto>
278 // <li> <linkto class="VisSet">VisSet</linkto>
279 // <li> <linkto class="PrefetchColumns">PrefetchColumns</linkto>
280 // </prerequisite>
281 //
282 // <etymology>
283 // The VisibilityIterator2 is a readonly iterator returning visibilities
284 // </etymology>
285 //
286 // <synopsis>
287 // VisibilityIterator2 provides iteration with various sort orders
288 // for one or more MSs. It has member functions to retrieve the fields
289 // commonly needed in synthesis calibration and imaging.
290 //
291 // One should use <linkto class="VisBuffer">VisBuffer</linkto>
292 // to access chunks of data.
293 //
294 // VisibilityIterator2s can be either synchronous or asynchronous, depending
295 // on the constructor used to create them as well as the current value of
296 // a CASARC file setting. A synchronous instance is works the same as
297 // this class ever worked; an asynchronous instance uses a second thread
298 // (the Visibility Lookahead Thread or VLAT) to fill the VisBuffers in
299 // advance of their use by the original thread.
300 //
301 // To create an asynchronous instance of ROVI you must use one of the two
302 // constructors which have a pointer to a PrefetchColumns object as the
303 // first argument. This object specifies which VisBuffer components should be
304 // prefetched by the VLAT; accessing components not specified in the PrefetchColumns
305 // object will result in an exception containing an error message indicating
306 // that the VisBuffer does not contain the requested column. In addition
307 // to using the appropriate constructor, the CASARC file setting
308 // VisibilityIterator2.async.enabled can be used to turn asynchronous I/O
309 // off globally; if it's globally enabled then it is still possible for the
310 // user to choose to enable/disable it on a VI by VI basis.
311 //
312 // +-------------------+
313 // | |
314 // | *** Nota Bene *** |
315 // | |
316 // +-------------------+
317 //
318 // Because of the multithreaded nature of asynchronous I/O, the user
319 // needs to be a bit more careful in the use of the VI and it's attached VisBuffer.
320 // casacore::Data access operations need to be directed to the VisBuffer. Additionally
321 // the user must not attempt to access the data using a separate VI since
322 // the underlying casacore objects are not threadsafe and bizarre errors
323 // will likely occur.
324 //
325 // CASARC Settings
326 // ===============
327 //
328 // casacore::Normal settings
329 // ---------------
330 //
331 // VisibilityIterator2.async.enabled - Boolean value that enables or disables
332 // async I/O. The default value is currently false (i.e., disabled).
333 // VisibilityIterator2.async.nBuffers - The number of lookahead buffers. This
334 // defaults to 2.
335 //
336 //
337 // Debug settings
338 // --------------
339 //
340 // VisibilityIterator2.async.doStats: true
341 // VisibilityIterator2.async.debug.logFile: stderr
342 // VisibilityIterator2.async.debug.logLevel: 1
343 //
344 
345 // </synopsis>
346 //
347 // <example>
348 // <code>
349 // //
350 // </code>
351 // </example>
352 //
353 // <motivation>
354 // For imaging and calibration you need to access an casacore::MS in some consistent
355 // order (by field, spectralwindow, time interval etc.). This class provides
356 // that access.
357 // </motivation>
358 //
359 // <thrown>
360 // <li>
361 // <li>
362 // </thrown>
363 //
364 // <todo asof="1997/05/30">
365 // <li> cleanup the currently dual interface for visibilities and flags
366 // <li> sort out what to do with weights when interpolating
367 // </todo>
369 {
370  // These classes are members of the VI/VB framework and need extra
371  // access to the non-public methods of this class. Any additions of
372  // classes not in this framework is strongly discouraged.
373  //
374  // Friends of the class should limit themselves to accessing the protected
375  // area of this class so that items in the private area can remeain de
376  // facto private.
377 
378  //friend class VisibilityIteratorImpl2;
379 // friend VisBuffer2 * VisBuffer2::factory (VisibilityIterator2 * vi, VisBufferType t,
380 // VisBufferOptions options);
381  friend class VisBuffer2Adapter;
382  //friend class VisBufferImpl2;
383  //friend class VisBufferState;
384  friend class asyncio::VLAT; // allow VI lookahead thread class to access protected
385  // functions VLAT should not access private parts,
386  // especially variables
388 
389 public:
390 
391  VisibilityIterator2( const VisibilityIterator2& ) = delete;
393  class Factory { // Interface for implementation creation factory
394 
395  public:
396 
397  virtual ~Factory () {}
398 
399  virtual ViImplementation2 *
400  operator() (const VisBufferComponents2 * /*prefetchColumns*/,
402  const casacore::Block<casacore::Int>& /*sortColumns*/,
403  const casacore::Bool /*addDefaultSortCols*/,
404  casacore::Double /*timeInterval*/) const
405  {
406  return NULL;
407  }
408  };
409 
411 
412  typedef enum DataColumn {
413  Observed=0, // Observed data
414  Model, // Model data
415  Corrected // Corrected data
416  } DataColumn;
417 
418  // Construct from an casacore::MS and a casacore::Block of casacore::MS column enums specifying the
419  // iteration order. These can be specified as casacore::MS::ANTENNA1, casacore::MS::ARRAY_ID,
420  // etc.; they are defined in MSMainEnums.h.
421  // If no order is specified, it uses the default sort
422  // order of MSIter, which is not necessarily the raw order of ms!
423  // The default ordering is ARRAY_ID, FIELD_ID, DATA_DESC_ID,
424  // and TIME, but check MSIter.h to be sure.
425  // These columns will be added first if they are not specified.
426  //
427  // An optional timeInterval (in seconds) can be given to iterate through
428  // chunks of time. The default interval of 0 groups all times together.
429  // Every 'chunk' of data contains all data within a certain time interval and
430  // with identical values of the other iteration columns (e.g. DATA_DESC_ID
431  // and FIELD_ID).
432  //
433  // A set of prefetch columns can be specified for asynchronous I/O use. These
434  // roughly correspond to the fields accessible from the VisBuffer. Specifying
435  // prefetch columns will cause an asynchronous VI to be created if asynchronous
436  // I/O is globally enabled. If the user wishes to have application-specific
437  // enable/disable of asynchronous I/O then they must implement logic that
438  // either either provides prefetch columns (enables) or a null pointer (disables).
439 
441  const SortColumns & sortColumns = SortColumns (),
442  casacore::Bool isWritable = false,
443  const VisBufferComponents2 * prefetchColumns = 0,
444  casacore::Double timeInterval = 0);
445 
447  const SortColumns & sortColumns = SortColumns (),
448  casacore::Bool isWritable = false,
449  const VisBufferComponents2 * prefetchColumns = 0,
450  casacore::Double timeInterval = 0);
451 
452  VisibilityIterator2 (const ViFactory & factory);
453 
454  // Creates an iterator from a stack of VI factories
455  // <thrown>
456  // <li> AipsError if the last factory is NULL
457  // </thrown>
459 
460  // Destructor
461 
462  virtual ~VisibilityIterator2();
463 
464  // Report the the ViImplementation type
465  casacore::String ViiType() const;
466 
468  //
469  // BEGIN Experimental Section
470  //
471 
473  casacore::MeasurementSet & dstMs);
474 
475  //
476  // END Experimental Section
477  //
479 
481  //
482  // Iteration movement methods
483  //
484  // The typical use case for VisibilityIteration looks like
485  //
486  // for (vi.originChunks(); vi.moreChunks(); nextChunk()){
487  // for (vi.origin (); vi.more(); vi++){
488  // }
489  // }
490  //
491  // The outer loop is the "chunk" loop and the inner loop is the "subchunk"
492  // loop. A chunk contains all the rows having identical values for the
493  // sort columns values except time; time can have an optional interval
494  // value specified either in the constructor or via the setInterval
495  // method. If an interval is specified the set of rows will all have
496  // timestamps that are within that interval of the first row in the
497  // chunk; if no interval is specified then the chunk will contain only
498  // rows having the identical timestamp. If multiple MSs are specified
499  // in the constructor then changing from one casacore::MS to the next will occur
500  // on a chunk boundary (i.e., a chunk will never contain data from more
501  // than one casacore::MS).
502  //
503  // A subchunk typically contains all the rows in the chunk having identical
504  // timestamps. The only exception is when the user calls setRowBlocking(N)
505  // with a positive value. In this case, the subchunk *may* contain up to
506  // N rows; however, this is only a suggestion to the VI. If there are
507  // less than N rows remaining in the chunk then fewer than N rows will be
508  // contained in the chunk. The number of rows in a subchunk will also be
509  // less than N if a larger set of rows would create an inconsistently
510  // shaped visibility cube; this could happen if the number of channels
511  // changes from one timestamp to another or the framed frequency
512  // selection selects a different number of channels from one timestamp to
513  // the next.
514  //
515  // origin () - positions VI to the start of the current chunk
516  // operator++ - advance VI to next subchunk if it exists
517  // more - returns true if the VI is pointing to a valid subchunk
518  //
519  // originChunks - Move to the first chunk of data.
520  // operator++ - advance VI to the next chunk if it exists
521  // moreChunks - returns true if the VI is pointing to a valid chunk.
522 
523  void origin(); // Reset to start of the chunk
524  void next ();
525  casacore::Bool more() const;
526 
527  void originChunks();
528  void nextChunk();
529  casacore::Bool moreChunks() const;
530 
531  // Report Name of slowest column that changes at end of current iteration
532  virtual casacore::String keyChange() const;
533 
534  // Returns the pair (chunk,subchunk) for the current position of the VI. Only
535  // valid after origin has been called.
536 
537  Subchunk getSubchunkId () const;
538 
540  //
541  // Iterator operation methods
542  //
543  // These methods alter the way that the VI operates. After applying any of these
544  // (except slurp which should be called after originChunks) originChunks must be
545  // called before the VI is advanced again; otherwise an exception will be thrown
546  // (changing these values in the middle of a sweep can lead to unexpected behavior).
547  //
548  // Selecting ranges of frequencies involves initializing a
549  // FrequencySelection(s) object and providing it to the VI. Once
550  // properly applied the VI will only return data for the selected
551  // frequencies. No interpolation is performed; the data returned is
552  // simply the channels that currently map to the selected frequencies for
553  // the specified frame of reference.
554 
555  void setFrequencySelection (const FrequencySelection &); // for single MS
556  void setFrequencySelection (const FrequencySelections &); // when using multiple MSs
557 
558  // RowBlocking is a suggestion to the iterator that it try to use subchunks
559  // having the suggested number of rows. The VI will attempt to honor the
560  // suggestion except when there are not enough rows remaining in the chunk
561  // or when putting the suggested number of rows in the subchunk cannot
562  // be contained in a cube (e.g., there are sets of row with different
563  // numbers of frequencies, etc.). The latter case will mainly occur
564  // when the row visibility shape changes from one row to the next.
565 
567  void setRowBlocking(casacore::Int nRows=0);
568 
569  // In this context the interval determines what rows will be contained
570  // in a chunk. A chunk is all the rows in an casacore::MS that have the same values
571  // in the sort columns, except for time; all rows that otherwise have the
572  // same values for the sort columns will be in the chunk if they are no
573  // later than "interval" seconds after the first row in the chunk.
574  //
575  // *** This value is unrelated to the interval field of the casacore::MS main table.
576 
578  void setInterval(casacore::Double timeInterval);
579 
580  // Call to use the slurp i/o method for all scalar columns. This
581  // will set the casacore::BucketCache cache size to the full column length
582  // and cause the full column to be cached in memory, if
583  // any value of the column is used. In case of out-of-memory,
584  // it will automatically fall-back on the smaller cache size.
585  // Slurping the column is to be considered as a work-around for the
586  // casacore::Table i/o code, which uses casacore::BucketCache and performs extremely bad
587  // for random access. Slurping is useful when iterating non-sequentially
588  // an casacore::MS or parts of an casacore::MS, it is not tested with multiple MSs.
589 
590  void slurp() const;
591 
593  //
594  // Other methods
595  //
596 
597  // Returns true if this is an asynchronous VI
598 
600 
601  // Returns true if async I/O is globally enabled.
602 
604 
605  // Returns true if this VI is writable (always false for ROVI and
606  // true for VI; see VisibilityIterator class).
607 
608  casacore::Bool isWritable () const;
609 
610  // Returns the columns that the VisibilityIterator2 is sorting by. These are
611  // defined in MSMainEnums.h. These can be specified as casacore::MS::ANTENNA1,
612  // casacore::MS::ARRAY_ID, etc.
613 
614  const SortColumns & getSortColumns() const;
615 
616  // Returns true if the specified column exists.
617 
618  bool existsColumn (VisBufferComponent2 id) const;
619 
620  // Returns the VisBuffer permanently attached to this VisibilityIterator.
621 
623 
624  // Manages the weight function that can be used to process the weights
625  // produced by the "scaled" variants of the weight accessors. Use
626  // generateWeightscaling to create a WeightScaling object. This allow you
627  // to use either a function (FLoat (casacore::Float)) or a functor (object having
628  // method casacore::Float operator () (casacore::Float)).
629  //
630  // To revert to having no scaling function, call setWeightScaling with
631  // 0 as the argument. Any call to setWeightScaling needs to be followed
632  // by an originChunks call before any further data access is performed
633  // using the VI.
634  //
635  // The method hasWeightScaling will return false if either no weightScaling
636  // object has installed or setWeightScaling (0) was called. There is not
637  // way for VI to know if the user has passed in the identity function;
638  // doing so will still cause hasWeightScaling to return true.
639 
640  virtual void setWeightScaling (casacore::CountedPtr<WeightScaling> weightscaling);
641  virtual casacore::Bool hasWeightScaling () const;
642 
643  // Return number of spws, polids, ddids for the current MS
644 
646  casacore::Int nPolarizationIds () const; // number of different polarization configurations
647  // (i.e., length of polarization subtable)
649 
650  // Determine whether WEIGHT_SPECTRUM exists.
651 
653 
654  // Determine whether WEIGHT_SPECTRUM exists.
655 
657 
658  //reference to actual ms in interator
659 
660  const casacore::MeasurementSet& ms() const /*__attribute__((deprecated))*/;
661 
662  const vi::SubtableColumns & subtableColumns () const /*__attribute__((deprecated))*/;
663 
664  static casacore::String getAipsRcBase () { return "VisibilityIterator2";}
665 
666  // The reporting frame of reference is the default frame of reference to be
667  // used when the user requests the frequencies of the current data selection
668  // in a VisBuffer. This is useful when the user wishes to select the data
669  // using one frame of reference but use the frequencies from another frame
670  // of reference. If not specified then the default will be to use the
671  // frame of reference used to select the data.
672  //
673  // These *do not* change the selection in any way.
674 
677 
678  // Return the numbers of rows in the current chunk
679 
680  casacore::Int nRowsInChunk() const;
681 
682  // Assign a VisImagingWeight object to this iterator. This object is used
683  // to generate imaging weights.
684 
685  void useImagingWeight(const VisImagingWeight& imWgt);
687 
688  // Write/modify the flags in the data.
689  // This will flag all channels in the original data that contributed to
690  // the output channel in the case of channel averaging.
691  // All polarizations have the same flag value.
692 
693  // Write/modify the flags in the data.
694  // This writes the flags as found in the casacore::MS, casacore::Cube(npol,nchan,nrow),
695  // where nrow is the number of rows in the current iteration (given by
696  // nRow()).
697 
698  virtual void writeFlag(const casacore::Cube<casacore::Bool>& flag);
699 
700  // Write/modify the flag row column; dimension casacore::Vector(nrow)
701 
702  virtual void writeFlagRow(const casacore::Vector<casacore::Bool>& rowflags);
703 
705 
706  // Write/modify the visibilities.
707  // This is possibly only for a 'reference' casacore::MS which has a new DATA column.
708  // The first axis of the matrix should equal the selected number of channels
709  // in the original MS.
710  // If the casacore::MS does not contain all polarizations, only the parallel
711  // hand polarizations are used.
712 
713 // void writeVisCorrected (const casacore::Matrix<CStokesVector>& vis);
714 // void writeVisModel (const casacore::Matrix<CStokesVector>& vis);
715 // void writeVisObserved (const casacore::Matrix<CStokesVector>& vis);
716 
717  // Write/modify the visibilities
718  // This writes the data as found in the casacore::MS, casacore::Cube(npol,nchan,nrow).
719 
723 
724  // Write/modify the weights
725 
727 
728  // Write/modify the weightMat
729 
730  //virtual void writeWeightMat(const casacore::Matrix<casacore::Float>& wtmat);
731 
732  // Write/modify the weightSpectrum
733 
734  virtual void writeWeightSpectrum(const casacore::Cube<casacore::Float>& wtsp);
735 
736 
737  // Initialize the weightSpectrum
738  virtual void initWeightSpectrum(const casacore::Cube<casacore::Float>& wtsp);
739 
740  // Write/modify the Sigma
741 
743 
744  // Write/modify the ncorr x nrow SigmaMat.
745 
746  //void writeSigmaMat(const casacore::Matrix<casacore::Float>& sigmat);
747 
748  // This puts a model into the descriptor of the current ms in the iterator.
749  // Set isComponentList to true if the record represents a componentList;
750  // if false then it is a FTMachine Record that holds the model image.
751  // Note that the spw and fields selected are going to be associated with this model.
752  // Setting addToExistingModel to true adds the model to the previous existent model
753  // in the ms for the spw and fields; setting it to false means any existing
754  // model will be replaced.
755 
756  void writeModel(const casacore::RecordInterface & record,
757  casacore::Bool isComponentList = true,
758  casacore::Bool addToExistingModel = false);
759 
760  // Requests that the modified VisBuffer2 be written back to the visibility
761  // at the same spot that it came from. The dirtyComponents feature of
762  // VisBuffer is used to mark which portions of the VisBuffer actually need
763  // to be written back out.
764 
765  void writeBackChanges (VisBuffer2 *);
766 
767  //**********************************************************************
768  // Methods to access the subtables.
769  //**********************************************************************
770 
771  // Access to antenna subtable
773 
774  // Access to dataDescription subtable
776 
777  // Access to feed subtable
779 
780  // Access to field subtable
782 
783  // Access to flagCmd subtable
785 
786  // Access to history subtable
788 
789  // Access to observation subtable
791 
792  // Access to pointing subtable
794 
795  // Access to polarization subtable
797 
798  // Access to processor subtable
800 
801  // Access to spectralWindow subtable
803 
804  // Access to state subtable
806 
807  // Access to doppler subtable
809 
810  // Access to freqOffset subtable
812 
813  // Access to source subtable
815 
816  // Access to sysCal subtable
818 
819  // Access to weather subtable
821 
822 
823 //**********************************************************************
824 // Internal methods below this line
825 //**********************************************************************
826 
827  ViImplementation2 * getImpl() const;
828 
829 protected:
830 
831 
833 
834  void construct (const VisBufferComponents2 * prefetchColumns,
836  const SortColumns & sortColumns,
837  casacore::Double timeInterval,
838  casacore::Bool writable);
839 
840 // advance the iteration
841 
842  void originChunks(casacore::Bool forceRewind);
843 
844 
845 private:
846 
848 };
849 
850 } // end namespace vi
851 
852 } //# NAMESPACE CASA - END
853 
854 #endif
const casacore::ROMSDataDescColumns & dataDescriptionSubtablecols() const
Access to dataDescription subtable.
const casacore::ROMSProcessorColumns & processorSubtablecols() const
Access to processor subtable.
const casacore::ROMSPolarizationColumns & polarizationSubtablecols() const
Access to polarization subtable.
void writeVisObserved(const casacore::Cube< casacore::Complex > &vis)
A 1-D Specialization of the Array class.
static casacore::Float square(casacore::Float x)
int Int
Definition: aipstype.h:50
casacore::Double getInterval() const
In this context the interval determines what rows will be contained in a chunk.
Other methods Returns true if this is an asynchronous VI *casacore::Bool isAsynchronous() const
virtual ViImplementation2 * operator()(const VisBufferComponents2 *, const casacore::Block< casacore::MeasurementSet > &, const casacore::Block< casacore::Int > &, const casacore::Bool, casacore::Double) const
casacore::Bool shouldAddDefaultColumns() const
const casacore::ROMSStateColumns & state() const
virtual void writeFlag(const casacore::Cube< casacore::Bool > &flag)
Write/modify the flags in the data.
Object to hold type of imaging weight scheme to be used on the fly and to provide facilities to do th...
const casacore::ROMSSpWindowColumns & spectralWindowSubtablecols() const
Access to spectralWindow subtable.
const casacore::ROMSDopplerColumns & doppler() const
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
virtual void writeWeightSpectrum(const casacore::Cube< casacore::Float > &wtsp)
Write/modify the weightMat.
A class to provide easy access to MSField columns.
const casacore::ROMSFieldColumns & fieldSubtablecols() const
Access to field subtable.
void construct(const VisBufferComponents2 *prefetchColumns, const casacore::Block< const casacore::MeasurementSet * > &mss, const SortColumns &sortColumns, casacore::Double timeInterval, casacore::Bool writable)
struct Node * first
Definition: malloc.h:330
virtual void writeFlagRow(const casacore::Vector< casacore::Bool > &rowflags)
Write/modify the flag row column; dimension casacore::Vector(nrow)
VLAT is the Visibility LookAhead Thread. This thread advances a visibility iterator and fills the dat...
Definition: VLAT.h:219
const casacore::ROMSSourceColumns & source() const
A class to provide easy read-only access to MSSource columns.
casacore::Int nSpectralWindows() const
Return number of spws, polids, ddids for the current MS.
enum casacore::MSIter::PolFrame PolFrame
casacore::Int getReportingFrameOfReference() const
The reporting frame of reference is the default frame of reference to be used when the user requests ...
virtual casacore::Bool hasWeightScaling() const
casacore::String toString() const
casacore::CountedPtr< casacore::MSIter > msIter_p
casacore::Bool sigmaSpectrumExists() const
Determine whether WEIGHT_SPECTRUM exists.
casacore::Int getRowBlocking() const
RowBlocking is a suggestion to the iterator that it try to use subchunks having the suggested number ...
const casacore::ROMSFlagCmdColumns & flagCmd() const
WeightScalingImpl(F f)
Provide either a unary function, casacore::Float (*) (casacore::Float), or a functor class having a c...
virtual casacore::Float apply(casacore::Float)=0
casacore::Bool more() const
const casacore::ROMSPointingColumns & pointing() const
VisBufferOptions
These are options to be applied to a VisBuffer, usually when it&#39;s created.
Definition: VisBuffer2.h:80
casacore::Bool moreChunks() const
casacore::Int nPolarizationIds() const
const casacore::ROMSFlagCmdColumns & flagCmdSubtablecols() const
Access to flagCmd subtable.
A class to provide easy read-only access to MSProcessor columns.
A class to provide easy read-only access to MSWeather columns.
A class to provide easy read-only access to MSASpectralWindow columns.
void slurp() const
Call to use the slurp i/o method for all scalar columns.
const casacore::ROMSFreqOffsetColumns & freqOffsetSubtablecols() const
Access to freqOffset subtable.
A class to provide easy read-only access to MSFreqOffset columns.
A class to provide easy read-only access to MSState columns.
Subchunk getSubchunkId() const
Returns the pair (chunk,subchunk) for the current position of the VI.
const casacore::ROMSObservationColumns & observationSubtablecols() const
Access to observation subtable.
void origin()
END Experimental Section.
casacore::Int nDataDescriptionIds() const
(i.e., length of polarization subtable)
static casacore::CountedPtr< WeightScaling > generateSquareWeightScaling()
SortColumns(const casacore::Block< casacore::Int > &columnIds=casacore::Block< casacore::Int >(), casacore::Bool addDefaultColumns=true)
static casacore::CountedPtr< WeightScaling > generateUnityWeightScaling()
void writeBackChanges(VisBuffer2 *)
Requests that the modified VisBuffer2 be written back to the visibility at the same spot that it came...
const casacore::ROMSSysCalColumns & sysCal() const
void useImagingWeight(const VisImagingWeight &imWgt)
Assign a VisImagingWeight object to this iterator.
const casacore::ROMSFreqOffsetColumns & freqOffset() const
const casacore::ROMSWeatherColumns & weatherSubtablecols() const
Access to weather subtable.
static casacore::Float identity(casacore::Float x)
const casacore::ROMSHistoryColumns & historySubtablecols() const
Access to history subtable.
VisibilityIterator2 & operator=(const VisibilityIterator2 &)=delete
ViImplementation2 * getImpl() const
static casacore::Float unity(casacore::Float)
casacore::Float apply(casacore::Float f)
const casacore::MeasurementSet & ms() const
reference to actual ms in interator
virtual ViImplementation2 * createVi() const =0
Referenced counted pointer for constant data.
Definition: VisModelData.h:42
const casacore::ROMSPointingColumns & pointingSubtablecols() const
Access to pointing subtable.
const casacore::ROMSPolarizationColumns & polarization() const
A class to provide easy read-only access to MSPointing columns.
const casacore::ROMSFieldColumns & field() const
A class to provide easy read-only access to MSDoppler columns.
void writeVisModel(const casacore::Cube< casacore::Complex > &vis)
void setRowBlocking(casacore::Int nRows=0)
casacore::Bool isWritable() const
Returns true if this VI is writable (always false for ROVI and true for VI; see VisibilityIterator cl...
double Double
Definition: aipstype.h:55
casacore::CountedPtr< WeightScaling > generateWeightScaling(F f)
A class to provide easy read-only access to MSHistory columns.
static casacore::Bool isAsynchronousIoEnabled()
Returns true if async I/O is globally enabled.
const casacore::ROMSProcessorColumns & processor() const
bool existsColumn(VisBufferComponent2 id) const
Returns true if the specified column exists.
bool operator<(const HeaderItemInfo &left, const HeaderItemInfo &right)
A class to provide easy read-only access to MSDataDesc columns.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void writeWeight(const casacore::Matrix< casacore::Float > &wt)
Write/modify the weights.
void writeFlagCategory(const casacore::Array< casacore::Bool > &fc)
float Float
Definition: aipstype.h:54
const casacore::ROMSSpWindowColumns & spectralWindow() const
const casacore::ROMSWeatherColumns & weather() const
const casacore::ROMSFeedColumns & feedSubtablecols() const
Access to feed subtable.
static casacore::String getAipsRcBase()
casacore::String ViiType() const
Report the the ViImplementation type.
casacore::Float operator()(casacore::Float x)
the data returned is simply the channels that currently map to the selected frequencies for the specified frame of reference *void setFrequencySelection(const FrequencySelection &)
virtual ~VisibilityIterator2()
Destructor.
A Table intended to hold astronomical data (a set of Measurements).
casacore::Bool weightSpectrumExists() const
Determine whether WEIGHT_SPECTRUM exists.
const casacore::ROMSAntennaColumns & antenna() const
const casacore::ROMSSourceColumns & sourceSubtablecols() const
Access to source subtable.
const Double second
Time interval [T]:
void writeSigma(const casacore::Matrix< casacore::Float > &sig)
Write/modify the Sigma.
SubtableColumns(casacore::CountedPtr< casacore::MSIter > msIter)
Simple wrapper class to limit access to only the columns associated with the current casacore::MS&#39;s s...
static casacore::CountedPtr< WeightScaling > generateIdentityWeightScaling()
const casacore::ROMSDopplerColumns & dopplerSubtablecols() const
Access to doppler subtable.
casacore::Block< casacore::Int > columnIds_p
void setReportingFrameOfReference(casacore::Int)
void writeVisCorrected(const casacore::Cube< casacore::Complex > &vis)
Write/modify the visibilities.
A class to provide easy read-only access to MSObservation columns.
Definition: MSObsColumns.h:80
VisBuffer2s encapsulate one chunk of visibility data for processing.
Definition: VisBuffer2.h:141
const casacore::ROMSSysCalColumns & sysCalSubtablecols() const
Access to sysCal subtable.
A class to provide easy read-only access to MSPolarization columns.
Definition: MSPolColumns.h:75
casacore::Bool addDefaultColumns_p
const casacore::Block< casacore::Int > & getColumnIds() const
A class to provide easy read-only access to MSFeed columns.
Definition: MSFeedColumns.h:84
void writeModel(const casacore::RecordInterface &record, casacore::Bool isComponentList=true, casacore::Bool addToExistingModel=false)
Write/modify the ncorr x nrow SigmaMat.
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
virtual casacore::String keyChange() const
Report Name of slowest column that changes at end of current iteration.
A top level class defining the data handling interface for the MSTransform module.
VisBuffer2 * getVisBuffer()
Returns the VisBuffer permanently attached to this VisibilityIterator.
A class to provide easy read-only access to MSAntenna columns.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
const SortColumns & getSortColumns() const
Returns the columns that the VisibilityIterator2 is sorting by.
Bool operator==(const MVTime &lh, const MVTime &rh)
is equal operator, uses operator Double which returns days
Definition: MVTime.h:465
BEGIN Experimental Section *static VisibilityIterator2 * copyingViFactory(const casacore::MeasurementSet &srcMs, casacore::MeasurementSet &dstMs)
const casacore::ROMSDataDescColumns & dataDescription() const
virtual void initWeightSpectrum(const casacore::Cube< casacore::Float > &wtsp)
Initialize the weightSpectrum.
const VisImagingWeight & getImagingWeightGenerator() const
const casacore::ROMSFeedColumns & feed() const
const casacore::ROMSStateColumns & stateSubtablecols() const
Access to state subtable.
virtual void setWeightScaling(casacore::CountedPtr< WeightScaling > weightscaling)
Manages the weight function that can be used to process the weights produced by the &quot;scaled&quot; variants...
This class encapsulates an enum with values corresponding to the various data components accessible v...
const casacore::ROMSHistoryColumns & history() const
Abstract base class for Record classes.
const casacore::ROMSAntennaColumns & antennaSubtablecols() const
Subchunk class Provides the ordered pair identifying the current subchunk The first component is the chunk(goes from 0 to nChunks-1 during the outer loop iteration).The second component is the subchunk number which is zero after VisibilityIterator
VisBufferImpls encapsulate one chunk of visibility data for processing.
A class to provide easy read-only access to MSFlagCmd columns.
A class to provide easy read-only access to MSSysCal columns.
void setInterval(casacore::Double timeInterval)
const vi::SubtableColumns & subtableColumns() const
casacore::Int nRowsInChunk() const
Return the numbers of rows in the current chunk.
const casacore::ROMSObservationColumns & observation() const
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42