casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VisibilityIterator.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_VISIBILITYITERATOR_H
29 #define MSVIS_VISIBILITYITERATOR_H
30 
31 #include <casa/Arrays/Cube.h>
32 #include <casa/Arrays/Matrix.h>
33 #include <casa/Arrays/Slicer.h>
34 #include <casa/BasicSL/String.h>
36 #include <casa/Quanta/MVDoppler.h>
37 #include <casa/aips.h>
52 
53 #include <map>
54 #include <set>
55 #include <vector>
56 
57 namespace casa { //# NAMESPACE CASA - BEGIN
58 
59 //# forward decl
60 
61 namespace asyncio {
62 
63 class VLAT;
64 
65 // <summary>
66 // The PrefetchColumns class is used to specify a set of columns that
67 // can be prefetched when the (RO)VisibilityIterator is using asynchronous
68 // I/O.
69 // </summary>
70 //
71 // <synopsis>
72 // When creating an ROVisibilityIterator or VisibilityIterator that can
73 // potentially operate using asynchronous I/O it is necessary to specify
74 // which columns of the main table are to be prefetched by the lookahead
75 // thread. This class provides the way to specify those columns. The
76 // class is an STL set object of enum values defined in VisBufferComponents.h.
77 // These roughly correspond to the different components that can be access
78 // via a VisBuffer.
79 //
80 // </synopsis>
81 //
82 // <example>
83 // This is a simple example showing the construction of a PrefetchColumns
84 // and its use in a VisibilityIterator constructor. For more complex cases
85 // (e.g., where the columns to be prefetched depend on other factors) the
86 // class provides some additional utility methods.
87 //
88 // Usually the file that creates the VI will include VisBuffer which will
89 // then include VisBufferComponents.h; if not then the user will also need
90 // to add "#include <msvis/MSVis/VisBufferComponents.h>" to their file.
91 //
92 // <code>
93 // asyncio::PrefetchColumns prefetchColumns =
94 // PrefetchColumns::prefetchColumns (VisBufferComponents::Ant1,
95 // VisBufferComponents::Ant2,
96 // VisBufferComponents::ArrayId,
97 // VisBufferComponents::Direction1,
98 // VisBufferComponents::Direction2,
99 // VisBufferComponents::Feed1,
100 // VisBufferComponents::Feed1_pa,
101 // VisBufferComponents::Feed2,
102 // VisBufferComponents::Feed2_pa,
103 // VisBufferComponents::FieldId,
104 // VisBufferComponents::FlagCube,
105 // VisBufferComponents::Flag,
106 // VisBufferComponents::FlagRow,
107 // VisBufferComponents::Freq,
108 // VisBufferComponents::NChannel,
109 // VisBufferComponents::NCorr,
110 // VisBufferComponents::NRow,
111 // VisBufferComponents::ObservedCube,
112 // VisBufferComponents::PhaseCenter,
113 // VisBufferComponents::PolFrame,
114 // VisBufferComponents::SpW,
115 // VisBufferComponents::Time,
116 // VisBufferComponents::Uvw,
117 // VisBufferComponents::UvwMat,
118 // VisBufferComponents::Weight,
119 // -1);
120 //
121 // wvi_p = new VisibilityIterator (& prefetchColumns, * wvi_p);
122 //
123 //
124 // </code>
125 //
126 // </example
127 class PrefetchColumns : public std::set<VisBufferComponents::EnumType>{
128 
129 public:
130 
132 
135  static PrefetchColumns prefetchAllColumnsExcept (casacore::Int firstColumn, ...);
136  static PrefetchColumns prefetchColumns (casacore::Int firstColumn, ...);
137 };
138 
139 } // end namespace asyncio
140 
141 class VisBuffer;
144 
145 class SubChunkPair : public std::pair<casacore::Int, casacore::Int>{
146 
147 public:
148 
149  // First component is Chunk and second is subchunk
150 
153 
155  return first == other.first && second == other.second;
156  }
157 
159  return first < other.first ||
160  (first == other.first && second < other.second);
161  }
162 
163  casacore::Bool atOrigin () const { return * this == SubChunkPair ();}
164  casacore::Int chunk () const { return first;}
165  void incrementSubChunk () { second ++;}
166  void incrementChunk () { first ++; second = 0; }
167 
168  void resetSubChunk () { second = 0;} // position to start of chunk
169 
170  void resetToOrigin () { first = 0; second = 0; }
171  // Make a subchunk pair that is positioned to the first subchunk of the
172  // first chunk (i.e., 0,0)
173 
174  casacore::Int subchunk () const { return second;}
175  casacore::String toString () const;
176 
177  static SubChunkPair noMoreData ();
178 
179 private:
180 
181 
182 };
183 
184 
185 // <summary>
186 // ROVisibilityIterator iterates through one or more readonly MeasurementSets
187 // </summary>
188 // <use visibility=export>
189 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
190 // </reviewed>
191 // <prerequisite>
192 // <li> <linkto class="MSIter">MSIter</linkto>
193 // <li> <linkto class="casacore::MeasurementSet">casacore::MeasurementSet</linkto>
194 // <li> <linkto class="VisSet">VisSet</linkto>
195 // <li> <linkto class="PrefetchColumns">PrefetchColumns</linkto>
196 // </prerequisite>
197 //
198 // <etymology>
199 // The ROVisibilityIterator is a readonly iterator returning visibilities
200 // </etymology>
201 //
202 // <synopsis>
203 // ROVisibilityIterator provides iteration with various sort orders
204 // for one or more MSs. It has member functions to retrieve the fields
205 // commonly needed in synthesis calibration and imaging.
206 //
207 // One should use <linkto class="VisBuffer">VisBuffer</linkto>
208 // to access chunks of data.
209 //
210 // ROVisibilityIterators can be either synchronous or asynchronous, depending
211 // on the constructor used to create them as well as the current value of
212 // a CASARC file setting. A synchronous instance is works the same as
213 // this class ever worked; an asynchronous instance uses a second thread
214 // (the Visibility Lookahead Thread or VLAT) to fill the VisBuffers in
215 // advance of their use by the original thread.
216 //
217 // To create an asynchronous instance of ROVI you must use one of the two
218 // constructors which have a pointer to a PrefetchColumns object as the
219 // first argument. This object specifies which table columns should be
220 // prefetched by the VLAT; accessing columns not specified in the PrefetchColumns
221 // object will result in an exception containing an error message indicating
222 // that a the VisBuffer does not contain the requested column. In addition
223 // to using the appropriate constructor, the CASARC file setting
224 // VisibilityIterator.
225 //
226 // +-------------------+
227 // | |
228 // | *** Nota Bene *** |
229 // | |
230 // +-------------------+
231 //
232 // Because of the multithreaded nature of asynchronous I/O, the user
233 // needs to be a bit more careful in the use of the VI and it's attached VisBuffer.
234 // casacore::Data access operations need to be directed to the VisBuffer. Additionally
235 // the user must not attempt to access the data using a separate VI since
236 // the underlying casacore objects are not threadsafe and bizarre errors
237 // will likely occur.
238 //
239 // CASARC Settings
240 // ===============
241 //
242 // casacore::Normal settings
243 // ---------------
244 //
245 // VisibilityIterator.async.enabled - Boolean value that enables or disables
246 // async I/O. The default value is currently false (i.e., disabled).
247 // VisibilityIterator.async.nBuffers - The number of lookahead buffers. This
248 // defaults to 2.
249 //
250 //
251 // Debug settings
252 // --------------
253 //
254 // VisibilityIterator.async.doStats: true
255 // VisibilityIterator.async.debug.logFile: stderr
256 // VisibilityIterator.async.debug.logLevel: 1
257 //
258 
259 // </synopsis>
260 //
261 // <example>
262 // <code>
263 // //
264 // </code>
265 // </example>
266 //
267 // <motivation>
268 // For imaging and calibration you need to access an casacore::MS in some consistent
269 // order (by field, spectralwindow, time interval etc.). This class provides
270 // that access.
271 // </motivation>
272 //
273 // <thrown>
274 // <li>
275 // <li>
276 // </thrown>
277 //
278 // <todo asof="1997/05/30">
279 // <li> cleanup the currently dual interface for visibilities and flags
280 // <li> sort out what to do with weights when interpolating
281 // </todo>
283 {
284  friend class AsyncEnabler;
286  friend class ViReadImplAsync;
287  friend class asyncio::VLAT; // allow VI lookahead thread class to access protected functions
288  // VLAT should not access private parts, especially variables
289 public:
290 
291  class Factory {
292 
293  public:
294 
295  virtual ~Factory () {}
296 
298  operator() (const asyncio::PrefetchColumns * /*prefetchColumns*/,
300  const casacore::Block<casacore::Int>& /*sortColumns*/,
301  const casacore::Bool /*addDefaultSortCols*/,
302  casacore::Double /*timeInterval*/) const
303  {
304  return NULL;
305  }
306  };
307 
308  //# the following is a copy of the enum in MSIter
309  //# can't think of a way to get one that known to the outside world from here
310  enum PolFrame {
311  // Circular polarization
313  // Linear polarization
315  };
316 
317  typedef enum DataColumn {
318  Observed=0, // Observed data
319  Model, // Model data
320  Corrected // Corrected data
321  } DataColumn;
322 
323  class AsyncEnabler {
324  public:
327  ~AsyncEnabler ();
328  void release ();
329  private:
332  };
333 
334  // Default constructor - useful only to assign another iterator later
336  // Construct from an casacore::MS and a casacore::Block of casacore::MS column enums specifying the
337  // iteration order. If no order is specified, it uses the default sort
338  // order of MSIter, which is not necessarily the raw order of ms!
339  // The default ordering is ARRAY_ID, FIELD_ID, DATA_DESC_ID,
340  // and TIME, but check MSIter.h to be sure.
341  // These columns will be added first if they are not specified.
342  //
343  // An optional timeInterval (in seconds) can be given to iterate through
344  // chunks of time. The default interval of 0 groups all times together.
345  // Every 'chunk' of data contains all data within a certain time interval and
346  // with identical values of the other iteration columns (e.g. DATA_DESC_ID
347  // and FIELD_ID). Using selectChannel(), a number of groups of channels can
348  // be requested. At present the channel group iteration will always occur
349  // before the interval iteration.
351  const casacore::Block<casacore::Int>& sortColumns,
353  const Factory & factory = Factory());
354  // Same as above, but with the option of using the raw order of ms
355  // (addDefaultSortCols=false).
357  const casacore::Block<casacore::Int>& sortColumns,
358  const casacore::Bool addDefaultSortCols,
360 
361  // Same as previous constructors, but with multiple MSs to iterate over.
363  const casacore::Block<casacore::Int>& sortColumns,
365 
367  const casacore::Block<casacore::Int>& sortColumns,
368  const casacore::Bool addDefaultSortCols,
370 
371  ROVisibilityIterator(const asyncio::PrefetchColumns * prefetchColumns,
372  const casacore::MeasurementSet& ms,
373  const casacore::Block<casacore::Int>& sortColumns,
374  const casacore::Bool addDefaultSortCols = true,
376 
377  ROVisibilityIterator (const asyncio::PrefetchColumns * prefetchColumns,
379  const casacore::Block<casacore::Int>& sortColumns,
380  const casacore::Bool addDefaultSortCols = true,
382 
383  // Copy construct. This calls the assigment operator.
385  ROVisibilityIterator(const asyncio::PrefetchColumns * prefetchColumns, const ROVisibilityIterator & other);
386  // Assigment. Any attached VisBuffers are lost in the assign.
388  // Destructor
389  virtual ~ROVisibilityIterator();
390 
391 // static ROVisibilityIterator * create (const casacore::MeasurementSet & ms,
392 // const casacore::Block<casacore::Int>& sortColumns,
393 // const asyncio::PrefetchColumns * prefetchColumns = NULL,
394 // const casacore::Bool addDefaultSortCols = true,
395 // casacore::Double timeInterval=0);
396 //
397 // static ROVisibilityIterator * create (const casacore::Block<casacore::MeasurementSet>& mss,
398 // const casacore::Block<casacore::Int>& sortColumns,
399 // const asyncio::PrefetchColumns * prefetchColumns = NULL,
400 // const casacore::Bool addDefaultSortCols = true,
401 // casacore::Double timeInterval=0);
402 //
403 // static ROVisibilityIterator * create (const ROVisibilityIterator & rovi,
404 // const asyncio::PrefetchColumns * prefetchColumns,
405 // casacore::Int nReadAheadBuffers = 2);
406 
407  // Members
408 
411 
413  casacore::Bool isWritable () const;
414  // Reset iterator to origin/start of data (of current chunk)
415  void origin();
416  // Reset iterator to true start of data (first chunk)
417  void originChunks();
418 
419  // Return the time interval (in seconds) used for iteration.
420  // This is not the same as the INTERVAL column.
422  // Set or reset the time interval (in seconds) to use for iteration.
423  // You should call originChunks() to reset the iteration after
424  // calling this.
426 
427  // Set the 'blocking' size for returning data.
428  // With the default (0) only a single integration is returned at a time, this
429  // is what is currently required for the calibration software. With blocking
430  // set, up to nRows can be returned in one go. The chunk
431  // size determines the actual maximum.
432  void setRowBlocking(casacore::Int nRows=0);
433  // Return false if no more data (in current chunk)
434  casacore::Bool more() const;
435  SubChunkPair getSubchunkId () const;
436  // Advance iterator through data
439  // Return false if no more 'Chunks' of data left
440  casacore::Bool moreChunks() const;
441  // Check if ms has change since last iteration
442  casacore::Bool newMS() const;
443  casacore::Int msId() const;
444  VisBuffer * getVisBuffer ();
445  //reference to actual ms in interator
446  const casacore::MeasurementSet& ms() const;
447  // Advance to the next Chunk of data
449  // Return antenna1
451  // Return antenna2
453  // Return feed1
455  // Return feed2
457  // Return channel numbers in selected VisSet spectrum
458  // (i.e. disregarding possible selection on the iterator, but
459  // including the selection set when creating the VisSet)
461  // Return feed configuration matrix for specified antenna
464  // Return receptor angles for all antennae and feeds
465  // First axis of the cube is a receptor number,
466  // 2nd is antennaId, 3rd is feedId
467  // Note: the method is intended to provide an access to MSIter::receptorAngles
468  // for VisBuffer in the multi-feed case. It may be worth to change the
469  // interface of feed_pa to return the information for all feeds.
471  // return a string mount identifier for each antenna
473  // Return a cube containing pairs of coordinate offsets for each
474  // receptor of each feed (values are in radians, coordinate system is fixed
475  // with antenna and is the same one as used to define the BEAM_OFFSET
476  // parameter in the feed table). The cube axes are receptor, antenna, feed.
478  // true if all elements of the cube returned by getBeamOffsets are zero
480  // Return feed parallactic angles casacore::Vector(nant) (1 feed/ant)
483  casacore::Int nAntennas, const casacore::MEpoch & mEpoch0,
484  const casacore::Vector<casacore::Float> & receptor0Angle);
485  // Return nominal parallactic angle at specified time
486  // (does not include feed position angle offset--see feed_pa)
487  // A global value for all antennas (e.g., small array)
490  // Per antenna:
493  int nAntennas, const casacore::MEpoch mEpoch0);
494  // Return the antenna AZ/EL casacore::Vector(nant)
497  casacore::MDirection & azel0, const casacore::MEpoch & mEpoch0);
500  casacore::Int nAnt, const casacore::MEpoch & mEpoch0);
501  // Return the hour angle for the specified time
504  // Return the current FieldId
505  casacore::Int fieldId() const;
506  // Return the current ArrayId
507  casacore::Int arrayId() const;
508  // Return the current Field Name
509  casacore::String fieldName() const;
510  // Return the current Source Name
512  // Return flag for each polarization, channel and row
514  // Return flag for each channel & row
516 
517  // Determine whether FLAG_CATEGORY is valid.
519 
520  // Return flags for each polarization, channel, category, and row.
522  // Return row flag
524  // Return scan number
526  // Return the OBSERVATION_IDs
528  // Return the PROCESSOR_IDs
530  // Return the STATE_IDs
532  // Return current frequencies (in Hz, acc. to the casacore::MS def'n v.2)
534  // Return frequencies (in Hz, acc. to the casacore::MS def'n v.2) in selected velocity frame,
535  // returns the same as frequency() if there is no vel selection active.
537  // Return the current phase center as an MDirection
538  const casacore::MDirection& phaseCenter() const;
539  const casacore::MDirection phaseCenter(const casacore::Int fieldid, const casacore::Double time=-1.0) const;
540  // Return frame for polarization (returns PolFrame enum)
541  casacore::Int polFrame() const;
542  // Return the correlation type (returns casacore::Stokes enums)
544  // Return sigma
546  // Return sigma matrix (pol-dep)
548  // Return current SpectralWindow
550  // Return current Polarization Id
552  // Return current DataDescription Id
554  // Return MJD midpoint of interval.
556  // Return MJD centroid of interval.
558  // Return nominal time interval
560  // Return actual time interval
562  // Return the visibilities as found in the casacore::MS, casacore::Cube(npol,nchan,nrow).
564  DataColumn whichOne) const;
565  // Return FLOAT_DATA as a casacore::Cube(npol, nchan, nrow) if found in the MS.
567  // Return the visibility 4-vector of polarizations for each channel.
568  // If the casacore::MS doesn't contain all polarizations, it is assumed it
569  // contains one or two parallel hand polarizations.
571  DataColumn whichOne) const;
572  // Return the shape of the visibility Cube
574  // Return u,v and w (in meters)
577  // Return weight
579  // Returns the nPol_p x curNumRow_p weight matrix
581  // Determine whether WEIGHT_SPECTRUM exists.
583  // Return weightspectrum (a weight for each channel)
585  // Return imaging weight (a weight for each channel)
586  //casacore::Matrix<casacore::Float>& imagingWeight(casacore::Matrix<casacore::Float>& wt) const;
587  // Return true if FieldId/Source has changed since last iteration
588  casacore::Bool newFieldId() const;
589  // Return true if arrayID has changed since last iteration
590  casacore::Bool newArrayId() const;
591  // Return true if SpectralWindow has changed since last iteration
593  // Return the index of the first channel of the current channel group
594  // in the total (selected) spectrum.
595  casacore::Int channelIndex() const;
596  // Return the width of the current group of channels, i.e.,
597  // the number of channels returned by visibility() and frequency().
599 
600  // Return the number of correlations in the current iteration
601  casacore::Int nCorr() const;;
602  // Return the number of rows in the current iteration
603  casacore::Int nRow() const;
604  // Return the row ids as from the original root table. This is useful
605  // to find correspondance between a given row in this iteration to the
606  // original ms row
608  // Return the numbers of rows in the current chunk
609  casacore::Int nRowChunk() const;
610  // Return the number of sub-intervals in the current chunk
611  casacore::Int nSubInterval() const;
612  // Call to use the slurp i/o method for all scalar columns. This
613  // will set the casacore::BucketCache cache size to the full column length
614  // and cause the full column to be cached in memory, if
615  // any value of the column is used. In case of out-of-memory,
616  // it will automatically fall-back on the smaller cache size.
617  // Slurping the column is to be considered as a work-around for the
618  // casacore::Table i/o code, which uses casacore::BucketCache and performs extremely bad
619  // for random access. Slurping is useful when iterating non-sequentially
620  // an casacore::MS or parts of an casacore::MS, it is not tested with multiple MSs.
621  void slurp() const;
622  // Velocity selection - specify the output channels in velocity:
623  // nChan - number of output channels, vStart - start velocity,
624  // vInc - velocity increment. So channel i will have velocity
625  // vStart + i*vInc (i=0,nChan-1).
626  // Specify velocities as in e.g., casacore::MVRadialVelocity(casacore::Quantity(2001.,"km/s")).
627  // The reference type and velocity definition are specified separately.
628  // Note that no averaging is performed, the visibilities will be interpolated
629  // and sampled at the specified velocities, it's up to you to choose a vInc
630  // appropriate to the channel width.
631  // The REST_FREQUENCY column in the SPECTRAL_WINDOW subtable is used to
632  // determine the velocity-frequency conversion.
633  // By default calculations are done for a single velocity with offsets
634  // applied for the others (ok for non-rel velocities with RADIO defn),
635  // set precise to true to do a full conversion for each output channel.(NYI)
638  const casacore::MVRadialVelocity& vStart, const casacore::MVRadialVelocity& vInc,
641  // Select the velocity interpolation scheme.
642  // At present the choice is limited to : nearest and linear, linear
643  // is the default.
644  // TODO: add cubic, spline and possibly FFT
646  // Channel selection - only the selected channels will be returned by the
647  // access functions. The default spectralWindow is the current one (or 0)
648  // This allows selection of the input channels, producing
649  // nGroup groups of width output channels. Default is to return all channels
650  // in a single group.
652  casacore::Int increment=1, casacore::Int spectralWindow=-1);
653  //Same as above except when multiple ms's are to be accessed
659  //get the channel selection ...the block over the number of ms's associated
660  // with this iterator
666  // Translate slicesv from the form returned by casacore::MSSelection::getChanSlices()
667  // to matv as used by setChanAveBounds(). widthsv is the channel averaging
668  // width for each _selected_ spw.
671  const casacore::Vector<casacore::Int>& widthsv) const;
672  // Get the spw, start and nchan for all the ms's is this Visiter that
673  // match the frequecy "freqstart-freqStep" and "freqEnd+freqStep" range
674  // Can help in doing channel selection above..
675  // freqFrame is the frame the caller frequency values are in (freqStart and freqEnd)
676  // These will be converted to the frame of the selected spw to match
680  casacore::Double freqStart, casacore::Double freqEnd,
682 
683  //Get the frequency range of the data selection
685 
686  // Attach a VisBuffer object.
687  // Note that while more than one VisBuffer may be attached, only the
688  // last one is actively updated. A casacore::Stack is kept internally, so after
689  // a detach, the previous VisBuffer becomes active again.
690  void attachVisBuffer(VisBuffer& vb);
691  // Detach a VisBuffer object.
692  // If the object detached is not the last one attached an exception
693  // is thrown.
694  void detachVisBuffer(VisBuffer& vb);
695  // Access the current casacore::ROMSColumns object in MSIter
696  const casacore::ROMSColumns& msColumns() const;
697  // get back the selected spectral windows and spectral channels for
698  // current ms
700  // Convert the frequency from the observe frame to lsr frame.
701  // Returns true in convert if given spw was not observed
702  // in the LSRK frame
703  //when ignoreconv=true...no conversion is done from data frame
704  //frequency is served as is
705  void lsrFrequency(const casacore::Int& spw, casacore::Vector<casacore::Double>& freq, casacore::Bool& convert, const casacore::Bool ignoreconv=false);
706  //assign a VisImagingWeight object to this iterator
707  void useImagingWeight(const VisImagingWeight& imWgt);
709 
710  //return number of Ant
712  //Return number of rows in all selected ms's
714  // Return number of spws, polids, ddids
718 // casacore::ArrayColumn <casacore::Double> & getChannelFrequency () const;
719 // casacore::Block<casacore::Int> getChannelGroupNumber () const;
720 // casacore::Block<casacore::Int> getChannelIncrement () const;
721 // casacore::Block<casacore::Int> getChannelStart () const;
722 // casacore::Block<casacore::Int> getChannelWidth () const;
726  casacore::Int getNAntennas () const;
727  casacore::MEpoch getEpoch () const;
733 
734  // Returns the columns that the VisibilityIterator is sorting by.
736 
737  static void lsrFrequency (const casacore::Int& spw,
739  casacore::Bool & convert,
740  const casacore::Block<casacore::Int> & chanStart,
741  const casacore::Block<casacore::Int> & chanWidth,
742  const casacore::Block<casacore::Int> & chanInc,
743  const casacore::Block<casacore::Int> & numChanGroup,
745  const casacore::ScalarColumn<casacore::Int> & obsMFreqTypes,
746  const casacore::MEpoch & ep,
747  const casacore::MPosition & obsPos,
748  const casacore::MDirection & dir);
749 
750  static casacore::String getAipsRcBase () { return "VisibilityIterator";}
751  static casacore::String getAsyncRcBase () { return getAipsRcBase() + ".async";}
752 
753 protected:
754 
755  ROVisibilityIterator (const asyncio::PrefetchColumns * prefetchColumns,
757  const casacore::Block<casacore::Int>& sortColumns,
758  const casacore::Bool addDefaultSortCols,
760  casacore::Bool writable);
761 
762  void construct (const asyncio::PrefetchColumns * prefetchColumns,
764  const casacore::Block<casacore::Int>& sortColumns,
765  const casacore::Bool addDefaultSortCols,
767  casacore::Bool writable,
768  const Factory & factory);
769 
771 
773  // advance the iteration
774  virtual void advance();
775  // set the currently selected table
776  virtual void setSelTable();
777  // set the iteration state
778  void setState();
779  // get the TOPO frequencies from the selected velocities and the obs. vel.
780  void getTopoFreqs();
781  void getTopoFreqs(casacore::Vector<casacore::Double> & lsrFreq, casacore::Vector<casacore::Double> & selFreq); // for async i/o
782  void getLsrInfo (casacore::Block<casacore::Int> & channelGroupNumber,
783  casacore::Block<casacore::Int> & channelIncrement,
784  casacore::Block<casacore::Int> & channelStart,
785  casacore::Block<casacore::Int> & channelWidth,
786  casacore::MPosition & observatoryPositon,
788  casacore::Bool & velocitySelection) const;
789  std::vector<casacore::MeasurementSet> getMeasurementSets () const;
790  const casacore::MSDerivedValues & getMSD () const; // for use by Async I/O *ONLY*
791  // update the DATA slicer
792  virtual void updateSlicer();
793  // attach the column objects to the currently selected table
794  virtual void attachColumns(const casacore::Table &t);
795  // returns the table, to which columns are attached,
796  // can be overridden in derived classes
797  virtual const casacore::Table attachTable() const;
798  // get the (velocity selected) interpolated visibilities, flags and weights.
799  // It is not really const at all (it seems to use This-> trickery so callers
800  // like flag() can be declared const).
801 // void getInterpolatedVisFlagWeight(DataColumn whichOne) const;
802  // get the (velocity selected) interpolated FLOAT_DATA (as real Floats),
803  // flags and weights.
804 // void getInterpolatedFloatDataFlagWeight() const;
805  // get the visibility data (observed, corrected or model);
806  // deals with casacore::Float and casacore::Complex observed data (DATA or FLOAT_DATA)
807  void getDataColumn(DataColumn whichOne, const casacore::Slicer& slicer,
810  // get FLOAT_DATA as real Floats.
813 
814  void originChunks(casacore::Bool forceRewind);
815  //Re-Do the channel selection in multi ms case
816  void doChannelSelection();
817  //Set the tile cache size....when using slice access if tile cache size is
818  // not set memory usage can go wild. Specifically, the caching scheme is
819  // ephemeral and lives for that instance of setting the caching scheme.
820  //
821  // If you don't set any then the defaults come into play and caches a few
822  // tiles along every axis at the tile you requested...which is a waste when
823  // say you know you want to proceed along the row axis for example...and in
824  // fact now VisIter just reads one tile (thus the commenting in setTileCache)
825  // and lets the OS do the caching rather than than having the table system
826  // cache extra tiles.
827  virtual void setTileCache();
828  //Check if spw is in selected SPW for actual ms
830  // Updates, if necessary, rowIds_p member for the current chunk
831  void update_rowIds() const;
832  void setAsyncEnabled (casacore::Bool enable);
833  template<class T>
835  template<class T>
836  void getColArray(const casacore::ArrayColumn<T> &column, casacore::Array<T> &array, casacore::Bool resize) const;
837  // column access functions, can be overridden in derived classes
838  virtual void getCol(const casacore::ScalarColumn<casacore::Bool> &column, casacore::Vector<casacore::Bool> &array, casacore::Bool resize = false) const;
839  virtual void getCol(const casacore::ScalarColumn<casacore::Int> &column, casacore::Vector<casacore::Int> &array, casacore::Bool resize = false) const;
841  virtual void getCol(const casacore::ArrayColumn<casacore::Bool> &column, casacore::Array<casacore::Bool> &array, casacore::Bool resize = false) const;
842  virtual void getCol(const casacore::ArrayColumn<casacore::Float> &column, casacore::Array<casacore::Float> &array, casacore::Bool resize = false) const;
845  virtual void getCol(const casacore::ArrayColumn<casacore::Bool> &column, const casacore::Slicer &slicer, casacore::Array<casacore::Bool> &array, casacore::Bool resize = false) const;
846  virtual void getCol(const casacore::ArrayColumn<casacore::Float> &column, const casacore::Slicer &slicer, casacore::Array<casacore::Float> &array, casacore::Bool resize = false) const;
847  virtual void getCol(const casacore::ArrayColumn<casacore::Complex> &column, const casacore::Slicer &slicer, casacore::Array<casacore::Complex> &array, casacore::Bool resize = false) const;
848  // void getCol(const casacore::String &colName, casacore::Array<casacore::Double> &array,
849  // casacore::Array<casacore::Double> &all, casacore::Bool resize = false) const;
850  // void getCol(const casacore::String &colName, casacore::Vector<casacore::Bool> &array,
851  // casacore::Vector<casacore::Bool> &all, casacore::Bool resize = false) const;
852  // void getCol(const casacore::String &colName, casacore::Vector<casacore::Int> &array,
853  // casacore::Vector<casacore::Int> &all, casacore::Bool resize = false) const;
854  // void getCol(const casacore::String &colName, casacore::Vector<casacore::Double> &array,
855  // casacore::Vector<casacore::Double> &all, casacore::Bool resize = false) const;
856  template<class T>
857  void swapyz(casacore::Cube<T>& out, const casacore::Cube<T>& in) const;
858 
860 };
861 
862 
863 // <summary>
864 // VisibilityIterator iterates through one or more writable MeasurementSets
865 // </summary>
866 // <use visibility=export>
867 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
868 // </reviewed>
869 // <prerequisite>
870 // <li> <linkto class="ROVisibilityIterator">ROVisibilityIterator</linkto>
871 // </prerequisite>
872 //
873 // <etymology>
874 // The VisibilityIterator is a read/write iterator returning visibilities
875 // </etymology>
876 //
877 // <synopsis>
878 // VisibilityIterator provides iteration with various sort orders
879 // for one or more MSs. It has member functions to retrieve the fields
880 // commonly needed in synthesis calibration and imaging. It is
881 // derived from the read-only iterator
882 // <linkto class="ROVisibilityIterator">ROVisibilityIterator</linkto>.
883 //
884 // One should use <linkto class="VisBuffer">VisBuffer</linkto>
885 // to access chunks of data.
886 //
887 // As with an ROVI, a VI can be created to only utilize synchronous I/O
888 // (the "normal" way) or it can potentially use asynchronous I/O. To create
889 // an asynchronous instance of VI requires using an appropriate constructor
890 // (i.e., one that has PrefetchColumns * as its first argument) and setting
891 // the CASARC setting "VisibilityIterator.async.disabled: false".
892 //
893 // When a write operation is performed using the various setX methods of an
894 // asynchronous instance of this class, the data is shipped over to the VLAT
895 // which writes out when it is not in the middle of performing a read ahead
896 // of a VisBuffer.
897 //
898 // </synopsis>
899 //
900 // <example>
901 // <code>
902 // //
903 // </code>
904 // </example>
905 //
906 // <motivation>
907 // For imaging and calibration you need to access an casacore::MS in some consistent
908 // order (by field, spectralwindow, time interval etc.). This class provides
909 // that access.
910 // </motivation>
911 //
912 // #<thrown>
913 //
914 // #</thrown>
915 //
916 // <todo asof="1997/05/30">
917 // <li> cleanup the currently dual interface for visibilities and flags
918 // <li> sort out what to do with weights when interpolating
919 // </todo>
921 {
922 
924 
925 public:
926  // Constructors.
927  // Note: The VisibilityIterator is not initialized correctly by default, you
928  // need to call origin() before using it to iterate.
933  const casacore::Bool addDefaultSortCols,
935  // Same as previous constructor, but with multiple MSs to iterate over.
937  const casacore::Block<casacore::Int>& sortColumns,
940  const casacore::Block<casacore::Int>& sortColumns, const casacore::Bool addDefaultSortCols,
942  VisibilityIterator (const asyncio::PrefetchColumns * prefetchColumns,
944  const casacore::Block<casacore::Int>& sortColumns,
945  const casacore::Bool addDefaultSortCols = true,
947  VisibilityIterator (const asyncio::PrefetchColumns * prefetchColumns,
949  const casacore::Block<casacore::Int>& sortColumns,
950  const casacore::Bool addDefaultSortCols = true,
953  VisibilityIterator(const asyncio::PrefetchColumns * prefetchColumns, const VisibilityIterator & other);
954 
955 
956  virtual ~VisibilityIterator();
957 
959 
960 
961  // Members
962 
963  casacore::Bool isWritable () const;
964 
965  // Advance iterator through data
968  // Set/modify the flags in the data.
969  // This will flag all channels in the original data that contributed to
970  // the output channel in the case of channel averaging.
971  // All polarizations have the same flag value.
973  // Set/modify the flags in the data.
974  // This sets the flags as found in the casacore::MS, casacore::Cube(npol,nchan,nrow),
975  // where nrow is the number of rows in the current iteration (given by
976  // nRow()).
977  virtual void setFlag(const casacore::Cube<casacore::Bool>& flag);
978  // Set/modify the flag row column; dimension casacore::Vector(nrow)
979  virtual void setFlagRow(const casacore::Vector<casacore::Bool>& rowflags);
980 
982 
983  // Set/modify the visibilities.
984  // This is possibly only for a 'reference' casacore::MS which has a new DATA column.
985  // The first axis of the matrix should equal the selected number of channels
986  // in the original MS.
987  // If the casacore::MS does not contain all polarizations, only the parallel
988  // hand polarizations are used.
989  void setVis(const casacore::Matrix<CStokesVector>& vis, DataColumn whichOne);
990  // Set/modify the visibilities
991  // This sets the data as found in the casacore::MS, casacore::Cube(npol,nchan,nrow).
992  virtual void setVis(const casacore::Cube<casacore::Complex>& vis, DataColumn whichOne);
993  // Set the visibility and flags, and interpolate from velocities if needed
995  DataColumn whichOne);
996  // Set/modify the weights
998  // Set/modify the weightMat
999  virtual void setWeightMat(const casacore::Matrix<casacore::Float>& wtmat);
1000  // Set/modify the weightSpectrum
1001  virtual void setWeightSpectrum(const casacore::Cube<casacore::Float>& wtsp);
1002  // Set/modify the Sigma
1004  // Set/modify the ncorr x nrow SigmaMat.
1005  void setSigmaMat(const casacore::Matrix<casacore::Float>& sigmat);
1006 
1007  //This puts a model into the descriptor of the current ms in the iterator
1008  //Set iscomponentlist to true if the record represent a componentlist
1009  //if false then it is a FTMachine casacore::Record that holds the model image
1010  //note the spw and fields selected are going to be associated with this model
1011  //incremetal =true implies add the model to previous any existant model
1012  //in the ms for the spw and fields
1013  //false means any existant model will be replaces.
1014  void putModel(const casacore::RecordInterface& rec, casacore::Bool iscomponentlist=true, casacore::Bool incremental=false);
1015 
1016 
1017  void writeBack (VisBuffer *);
1018 
1019 protected:
1020 
1021  virtual void attachColumns(const casacore::Table &t);
1022 
1023  void construct ();
1024 
1025 
1027 
1028  void initializeBackWriters ();
1029 
1031 };
1032 
1033 } //# NAMESPACE CASA - END
1034 
1035 #ifndef AIPS_NO_TEMPLATE_SRC
1036 #include <msvis/MSVis/VisibilityIterator.tcc>
1037 #endif //# AIPS_NO_TEMPLATE_SRC
1038 
1039 #endif
casacore::Vector< casacore::Double > & timeInterval(casacore::Vector< casacore::Double > &ti) const
Return nominal time interval.
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
casacore::String toString() const
casacore::Vector< casacore::Int > & feed1(casacore::Vector< casacore::Int > &fd1) const
Return feed1.
casacore::Bool newSpectralWindow() const
Return true if SpectralWindow has changed since last iteration.
A Measure: astronomical direction.
Definition: MDirection.h:174
const casacore::MeasurementSet & getMeasurementSet() const
void getFreqInSpwRange(casacore::Double &freqStart, casacore::Double &freqEnd, casacore::MFrequency::Types freqframe=casacore::MFrequency::LSRK)
Get the frequency range of the data selection.
std::vector< casacore::MeasurementSet > getMeasurementSets() const
A Measure: position on Earth.
Definition: MPosition.h:79
VisibilityIteratorWriteImpl * getWriteImpl() const
void setAsyncEnabled(casacore::Bool enable)
int Int
Definition: aipstype.h:50
virtual VisibilityIteratorReadImpl * operator()(const asyncio::PrefetchColumns *, const casacore::Block< casacore::MeasurementSet > &, const casacore::Block< casacore::Int > &, const casacore::Bool, casacore::Double) const
casacore::Vector< casacore::uInt > getRowIds() const
MSDerivedValues calculates values derived from a MS.
casacore::Int numberPol()
void setSigmaMat(const casacore::Matrix< casacore::Float > &sigmat)
Set/modify the ncorr x nrow SigmaMat.
virtual void setWeightMat(const casacore::Matrix< casacore::Float > &wtmat)
Set/modify the weightMat.
static casacore::String columnName(casacore::Int id)
casacore::Int spectralWindow() const
Return current SpectralWindow.
casacore::Vector< casacore::Int > & scan(casacore::Vector< casacore::Int > &scans) const
Return scan number.
casacore::Int nRow() const
Return the number of rows in the current iteration.
casacore::Double getInterval() const
Return the time interval (in seconds) used for iteration.
casacore::Vector< casacore::Int > & observationId(casacore::Vector< casacore::Int > &obsids) const
Return the OBSERVATION_IDs.
static casacore::Bool isAsynchronousIoEnabled()
Object to hold type of imaging weight scheme to be used on the fly and to provide facilities to do th...
casacore::Bool operator==(const SubChunkPair &other)
virtual casacore::Vector< casacore::Int > & corrType(casacore::Vector< casacore::Int > &corrTypes) const
Return the correlation type (returns casacore::Stokes enums)
Main interface class to a read/write table.
Definition: Table.h:153
casacore::Bool isInSelectedSPW(const casacore::Int &spw)
Check if spw is in selected SPW for actual ms.
casacore::Vector< casacore::MDirection > azel(casacore::Double time) const
static casacore::Float parang0Calculate(casacore::Double time, casacore::MSDerivedValues &msd, const casacore::MEpoch &epoch0)
VisibilityIterator iterates through one or more writable MeasurementSets.
virtual void setSelTable()
set the currently selected table
const casacore::MeasurementSet & ms() const
reference to actual ms in interator
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
Definition: ExprNode.h:1886
struct Node * first
Definition: malloc.h:330
VLAT is the Visibility LookAhead Thread. This thread advances a visibility iterator and fills the dat...
Definition: VLAT.h:219
casacore::Int numberAnt()
return number of Ant
const casacore::Vector< casacore::String > & antennaMounts() const
return a string mount identifier for each antenna
VisibilityIterator & operator=(const VisibilityIterator &MSI)
const casacore::Block< casacore::Int > & getSortColumns() const
Returns the columns that the VisibilityIterator is sorting by.
virtual Type type()
Return the type enum.
ROVisibilityIterator & selectVelocity(casacore::Int nChan, const casacore::MVRadialVelocity &vStart, const casacore::MVRadialVelocity &vInc, casacore::MRadialVelocity::Types rvType=casacore::MRadialVelocity::LSR, casacore::MDoppler::Types dType=casacore::MDoppler::RADIO, casacore::Bool precise=false)
Velocity selection - specify the output channels in velocity: nChan - number of output channels...
ROVisibilityIterator()
Default constructor - useful only to assign another iterator later.
ROVisibilityIterator & velInterpolation(const casacore::String &type)
Select the velocity interpolation scheme.
PrefetchColumns operator+(const PrefetchColumns &other)
virtual casacore::Matrix< casacore::Float > & weightMat(casacore::Matrix< casacore::Float > &wtmat) const
Returns the nPol_p x curNumRow_p weight matrix.
static casacore::Vector< casacore::Float > feed_paCalculate(casacore::Double time, casacore::MSDerivedValues &msd, casacore::Int nAntennas, const casacore::MEpoch &mEpoch0, const casacore::Vector< casacore::Float > &receptor0Angle)
casacore::Int polFrame() const
Return frame for polarization (returns PolFrame enum)
casacore::Bool atOrigin() const
static casacore::Double hourangCalculate(casacore::Double time, casacore::MSDerivedValues &msd, const casacore::MEpoch &mEpoch0)
void getLsrInfo(casacore::Block< casacore::Int > &channelGroupNumber, casacore::Block< casacore::Int > &channelIncrement, casacore::Block< casacore::Int > &channelStart, casacore::Block< casacore::Int > &channelWidth, casacore::MPosition &observatoryPositon, casacore::MDirection &phaseCenter, casacore::Bool &velocitySelection) const
static PrefetchColumns prefetchAllColumnsExcept(casacore::Int firstColumn,...)
casacore::Int fieldId() const
Return the current FieldId.
void detachVisBuffer(VisBuffer &vb)
Detach a VisBuffer object.
void swapyz(casacore::Cube< T > &out, const casacore::Cube< T > &in) const
void getCol(const casacore::String &amp;colName, casacore::Array&lt;casacore::Double&gt; &amp;array, casacore::Array&lt;casacore::Double&gt; &amp;all, casacore::Bool resize = false) const; void getCol(const casacore::String &amp;colName, casacore::Vector&lt;casacore::Bool&gt; &amp;array, casacore::Vector&lt;casacore::Bool&gt; &amp;all, casacore::Bool resize = false) const; void getCol(const casacore::String &amp;colName, casacore::Vector&lt;casacore::Int&gt; &amp;array, casacore::Vector&lt;casacore::Int&gt; &amp;all, casacore::Bool resize = false) const; void getCol(const casacore::String &amp;colName, casacore::Vector&lt;casacore::Double&gt; &amp;array, casacore::Vector&lt;casacore::Double&gt; &amp;all, casacore::Bool resize = false) const;
const casacore::Cube< casacore::Double > & receptorAngles() const
Return receptor angles for all antennae and feeds First axis of the cube is a receptor number...
casacore::Bool isAsynchronous() const
static ROVisibilityIterator * create (const casacore::MeasurementSet &amp; ms, const casacore::Block&lt;casa...
SubChunkPair(casacore::Int a, casacore::Int b)
casacore::Bool newFieldId() const
Return imaging weight (a weight for each channel) casacore::Matrix&lt;casacore::Float&gt;&amp; imagingWeight(c...
void useImagingWeight(const VisImagingWeight &imWgt)
assign a VisImagingWeight object to this iterator
casacore::Vector< casacore::Float > & weight(casacore::Vector< casacore::Float > &wt) const
Return weight.
casacore::Int numberCoh()
Return number of rows in all selected ms&#39;s.
casacore::Double hourang(casacore::Double time) const
Return the hour angle for the specified time.
A Measure: instant in time.
Definition: MEpoch.h:104
casacore::Int nRowChunk() const
Return the numbers of rows in the current chunk.
casacore::Vector< casacore::Double > & lsrFrequency(casacore::Vector< casacore::Double > &freq) const
Return frequencies (in Hz, acc.
casacore::Int getDataDescriptionId() const
casacore::ArrayColumn &lt;casacore::Double&gt; &amp; getChannelFrequency () const; casacore::Block&lt;casacore::In...
SubChunkPair getSubchunkId() const
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
Definition: PlotData.h:48
ROVisibilityIterator & operator=(const ROVisibilityIterator &other)
Assigment.
Internal value for MRadialVelocity.
Fast Vector classes with fixed (templated) length.
virtual void updateSlicer()
update the DATA slicer
VisibilityIteratorReadImpl * getReadImpl() const
const casacore::ROMSColumns & msColumns() const
Access the current casacore::ROMSColumns object in MSIter.
VisibilityIterator & operator++()
casacore::Vector< casacore::Float > & sigma(casacore::Vector< casacore::Float > &sig) const
Return sigma.
virtual casacore::Matrix< casacore::Float > & sigmaMat(casacore::Matrix< casacore::Float > &sigmat) const
Return sigma matrix (pol-dep)
virtual casacore::Cube< casacore::Complex > & visibility(casacore::Cube< casacore::Complex > &vis, DataColumn whichOne) const
Return the visibilities as found in the casacore::MS, casacore::Cube(npol,nchan,nrow).
void allSelectedSpectralWindows(casacore::Vector< casacore::Int > &spws, casacore::Vector< casacore::Int > &nvischan)
get back the selected spectral windows and spectral channels for current ms
virtual void getCol(const casacore::ScalarColumn< casacore::Bool > &column, casacore::Vector< casacore::Bool > &array, casacore::Bool resize=false) const
column access functions, can be overridden in derived classes
void setState()
set the iteration state
casacore::Bool allBeamOffsetsZero() const
true if all elements of the cube returned by getBeamOffsets are zero
VisibilityIteratorWriteImpl * writeImpl_p
Fast Square Matrix class with fixed (templated) size.
static void azelCalculate(casacore::Double time, casacore::MSDerivedValues &msd, casacore::Vector< casacore::MDirection > &azel, casacore::Int nAnt, const casacore::MEpoch &mEpoch0)
virtual const casacore::Table attachTable() const
returns the table, to which columns are attached, can be overridden in derived classes ...
The PrefetchColumns class is used to specify a set of columns that can be prefetched when the (RO)Vis...
virtual void setVisAndFlag(const casacore::Cube< casacore::Complex > &vis, const casacore::Cube< casacore::Bool > &flag, DataColumn whichOne)
Set the visibility and flags, and interpolate from velocities if needed.
void slurp() const
Call to use the slurp i/o method for all scalar columns.
void doChannelSelection()
Re-Do the channel selection in multi ms case.
casacore::Int getNAntennas() const
ROVisibilityIterator & nextChunk()
Advance to the next Chunk of data.
const casacore::Cube< casacore::RigidVector< casacore::Double, 2 > > & getBeamOffsets() const
Return a cube containing pairs of coordinate offsets for each receptor of each feed (values are in ra...
casacore::Bool existsWeightSpectrum() const
Determine whether WEIGHT_SPECTRUM exists.
static casacore::String getAipsRcBase()
virtual casacore::Vector< casacore::uInt > & rowIds(casacore::Vector< casacore::uInt > &rowids) const
Return the row ids as from the original root table.
static SubChunkPair noMoreData()
double Double
Definition: aipstype.h:55
A class to provide easy read-only access to MeasurementSet columns.
Definition: MSColumns.h:111
casacore::Bool more() const
Return false if no more data (in current chunk)
void getColArray(const casacore::ArrayColumn< T > &column, casacore::Array< T > &array, casacore::Bool resize) const
const casacore::MSDerivedValues & getMSD() const
casacore::Vector< casacore::Int > & antenna2(casacore::Vector< casacore::Int > &ant2) const
Return antenna2.
ROVisibilityIterator iterates through one or more readonly MeasurementSets.
casacore::Bool moreChunks() const
Return false if no more &#39;Chunks&#39; of data left.
VLAT should not access private parts, especially variables.
static casacore::String getAsyncRcBase()
casacore::Bool existsFlagCategory() const
Determine whether FLAG_CATEGORY is valid.
void getColScalar(const casacore::ScalarColumn< T > &column, casacore::Vector< T > &array, casacore::Bool resize) const
void getSpwInFreqRange(casacore::Block< casacore::Vector< casacore::Int > > &spw, casacore::Block< casacore::Vector< casacore::Int > > &start, casacore::Block< casacore::Vector< casacore::Int > > &nchan, casacore::Double freqStart, casacore::Double freqEnd, casacore::Double freqStep, casacore::MFrequency::Types freqFrame=casacore::MFrequency::LSRK)
Get the spw, start and nchan for all the ms&#39;s is this Visiter that match the frequecy &quot;freqstart-freq...
virtual void attachColumns(const casacore::Table &t)
attach the column objects to the currently selected table
void setRowBlocking(casacore::Int nRows=0)
Set the &#39;blocking&#39; size for returning data.
const casacore::MDirection & phaseCenter() const
Return the current phase center as an MDirection.
Types
Types of known MRadialVelocity Warning: The order defines the order in the translation matrix FromTo...
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual void attachColumns(const casacore::Table &t)
attach the column objects to the currently selected table
Types
Types of known MDopplers Warning: The order defines the order in the translation matrix FromTo in th...
Definition: MDoppler.h:149
casacore::Vector< casacore::Double > & timeCentroid(casacore::Vector< casacore::Double > &t) const
Return MJD centroid of interval.
casacore::Vector< casacore::Int > & stateId(casacore::Vector< casacore::Int > &stateids) const
Return the STATE_IDs.
float Float
Definition: aipstype.h:54
casacore::Int nSubInterval() const
Return the number of sub-intervals in the current chunk.
virtual casacore::Vector< casacore::Double > & frequency(casacore::Vector< casacore::Double > &freq) const
Return current frequencies (in Hz, acc.
casacore::Int numberDDId()
void attachVisBuffer(VisBuffer &vb)
Attach a VisBuffer object.
casacore::Int dataDescriptionId() const
Return current DataDescription Id.
static PrefetchColumns prefetchColumnsAll()
casacore::Int subchunk() const
Make a subchunk pair that is positioned to the first subchunk of the first chunk (i.e., 0,0)
void originChunks()
Reset iterator to true start of data (first chunk)
casacore::Int nCorr() const
Return the number of correlations in the current iteration.
AsyncEnabler(ROVisibilityIterator &)
casacore::Vector< casacore::Double > & exposure(casacore::Vector< casacore::Double > &expo) const
Return actual time interval.
casacore::MDirection azel0(casacore::Double time) const
Return the antenna AZ/EL casacore::Vector(nant)
void origin()
Reset iterator to origin/start of data (of current chunk)
A Table intended to hold astronomical data (a set of Measurements).
casacore::Bool isWritable() const
void slicesToMatrices(casacore::Vector< casacore::Matrix< casacore::Int > > &matv, const casacore::Vector< casacore::Vector< casacore::Slice > > &slicesv, const casacore::Vector< casacore::Int > &widthsv) const
Translate slicesv from the form returned by casacore::MSSelection::getChanSlices() to matv as used by...
void setFlagCategory(const casacore::Array< casacore::Bool > &fc)
Specify which elements to extract from an n-dimensional array.
Definition: Slicer.h:289
const Double second
Time interval [T]:
casacore::String sourceName() const
Return the current Source Name.
casacore::Int channelIndex() const
Return the index of the first channel of the current channel group in the total (selected) spectrum...
virtual void setTileCache()
Set the tile cache size....when using slice access if tile cache size is not set memory usage can go ...
casacore::Vector< casacore::Bool > & flagRow(casacore::Vector< casacore::Bool > &rowflags) const
Return row flag.
casacore::Cube< casacore::Float > & weightSpectrum(casacore::Cube< casacore::Float > &wtsp) const
Return weightspectrum (a weight for each channel)
casacore::Matrix< casacore::Double > & uvwMat(casacore::Matrix< casacore::Double > &uvwmat) const
casacore::Array< casacore::Bool > & flagCategory(casacore::Array< casacore::Bool > &flagCategories) const
Return flags for each polarization, channel, category, and row.
bool existsColumn(VisBufferComponents::EnumType id) const
ROVisibilityIterator & selectChannel(casacore::Int nGroup=1, casacore::Int start=0, casacore::Int width=0, casacore::Int increment=1, casacore::Int spectralWindow=-1)
Channel selection - only the selected channels will be returned by the access functions.
virtual casacore::Vector< casacore::Int > & channel(casacore::Vector< casacore::Int > &chan) const
Return channel numbers in selected VisSet spectrum (i.e.
casacore::Vector< casacore::Int > & feed2(casacore::Vector< casacore::Int > &fd2) const
Return feed2.
void getChannelSelection(casacore::Block< casacore::Vector< casacore::Int > > &blockNGroup, casacore::Block< casacore::Vector< casacore::Int > > &blockStart, casacore::Block< casacore::Vector< casacore::Int > > &blockWidth, casacore::Block< casacore::Vector< casacore::Int > > &blockIncr, casacore::Block< casacore::Vector< casacore::Int > > &blockSpw)
get the channel selection...the block over the number of ms&#39;s associated with this iterator ...
casacore::Vector< casacore::Float > feed_pa(casacore::Double time) const
Return feed parallactic angles casacore::Vector(nant) (1 feed/ant)
casacore::Int chunk() const
casacore::Bool newArrayId() const
Return true if arrayID has changed since last iteration.
void construct(const asyncio::PrefetchColumns *prefetchColumns, const casacore::Block< casacore::MeasurementSet > &mss, const casacore::Block< casacore::Int > &sortColumns, const casacore::Bool addDefaultSortCols, casacore::Double timeInterval, casacore::Bool writable, const Factory &factory)
void getFloatDataColumn(const casacore::Slicer &slicer, casacore::Cube< casacore::Float > &data) const
get FLOAT_DATA as real Floats.
casacore::Int arrayId() const
Return the current ArrayId.
void writeBack(VisBuffer *)
casacore::Bool isWritable() const
Members.
const casacore::Float & parang0(casacore::Double time) const
Return nominal parallactic angle at specified time (does not include feed position angle offset–see f...
void setSigma(const casacore::Vector< casacore::Float > &sig)
Set/modify the Sigma.
casacore::Int getMeasurementSetId() const
casacore::Bool isAsyncEnabled() const
void setFlag(const casacore::Matrix< casacore::Bool > &flag)
Set/modify the flags in the data.
casacore::String fieldName() const
Return the current Field Name.
casacore::Vector< casacore::SquareMatrix< casacore::Complex, 2 > > & CJones(casacore::Vector< casacore::SquareMatrix< casacore::Complex, 2 > > &cjones) const
Return feed configuration matrix for specified antenna.
const VisImagingWeight & getImagingWeightGenerator() const
String: the storage and methods of handling collections of characters.
Definition: String.h:223
ROVisibilityIterator & operator++()
casacore::Vector< casacore::Double > & time(casacore::Vector< casacore::Double > &t) const
Return MJD midpoint of interval.
void update_rowIds() const
Updates, if necessary, rowIds_p member for the current chunk.
VisBuffers encapsulate one chunk of visibility data for processing.
Definition: VisBuffer.h:153
void getDataColumn(DataColumn whichOne, const casacore::Slicer &slicer, casacore::Cube< casacore::Complex > &data) const
get the (velocity selected) interpolated visibilities, flags and weights.
VisibilityIterator iterates through one or more writable MeasurementSets.
casacore::Vector< casacore::Float > getReceptor0Angle()
SubChunkPair()
First component is Chunk and second is subchunk.
casacore::Int channelGroupSize() const
Return the width of the current group of channels, i.e., the number of channels returned by visibilit...
casacore::Int msId() const
casacore::Cube< casacore::Float > & floatData(casacore::Cube< casacore::Float > &fcube) const
Return FLOAT_DATA as a casacore::Cube(npol, nchan, nrow) if found in the MS.
casacore::Int polarizationId() const
Return current Polarization Id.
virtual ~ROVisibilityIterator()
Destructor.
casacore::MEpoch getEpoch() const
Abstract base class for Record classes.
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition: MFrequency.h:176
casacore::Int numberSpw()
Return number of spws, polids, ddids.
ROVisibilityIterator iterates through one or more readonly MeasurementSets.
void setInterval(casacore::Double timeInterval)
Set or reset the time interval (in seconds) to use for iteration.
static casacore::Vector< casacore::Float > parangCalculate(casacore::Double time, casacore::MSDerivedValues &msd, int nAntennas, const casacore::MEpoch mEpoch0)
VisibilityIteratorReadImpl * readImpl_p
virtual void setFlagRow(const casacore::Vector< casacore::Bool > &rowflags)
Set/modify the flag row column; dimension casacore::Vector(nrow)
static PrefetchColumns prefetchColumns(casacore::Int firstColumn,...)
void setWeight(const casacore::Vector< casacore::Float > &wt)
Set/modify the weights.
virtual void setWeightSpectrum(const casacore::Cube< casacore::Float > &wtsp)
Set/modify the weightSpectrum.
casacore::Bool newMS() const
Check if ms has change since last iteration.
casacore::Vector< casacore::Int > & antenna1(casacore::Vector< casacore::Int > &ant1) const
Return antenna1.
virtual void advance()
advance the iteration
void getTopoFreqs()
get the TOPO frequencies from the selected velocities and the obs.
static void azel0Calculate(casacore::Double time, casacore::MSDerivedValues &msd, casacore::MDirection &azel0, const casacore::MEpoch &mEpoch0)
virtual casacore::Vector< casacore::RigidVector< casacore::Double, 3 > > & uvw(casacore::Vector< casacore::RigidVector< casacore::Double, 3 > > &uvwvec) const
Return u,v and w (in meters)
casacore::Vector< casacore::Float > parang(casacore::Double time) const
Per antenna:
void putModel(const casacore::RecordInterface &rec, casacore::Bool iscomponentlist=true, casacore::Bool incremental=false)
This puts a model into the descriptor of the current ms in the iterator Set iscomponentlist to true i...
VisibilityIterator()
Constructors.
casacore::IPosition visibilityShape() const
Return the shape of the visibility Cube.
void setVis(const casacore::Matrix< CStokesVector > &vis, DataColumn whichOne)
Set/modify the visibilities.
virtual casacore::Cube< casacore::Bool > & flag(casacore::Cube< casacore::Bool > &flags) const
Return flag for each polarization, channel and row.
casacore::Bool operator<(const SubChunkPair &other)
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42
casacore::Vector< casacore::Int > & processorId(casacore::Vector< casacore::Int > &procids) const
Return the PROCESSOR_IDs.